---
name: "spi_alloc_device"
section: "9"
platform: "linux"
package: "linux-manual-3.16"
version: "3.16.56-1+deb8u1"
release: "Debian 8 (Jessie)"
platforms: ["linux"]
url: "https://new.carta.tech/spi_alloc_device"
---

# spi\_alloc\_device(9)

Allocate a new SPI device

## NAME

spi\_alloc\_device - Allocate a new SPI device

## SYNOPSIS

**struct spi\_device \* spi\_alloc\_device(struct spi\_master \*** *master***);**

## ARGUMENTS

*master*

Controller to which device is connected

## CONTEXT

can sleep

## DESCRIPTION

Allows a driver to allocate and initialize a spi\_device without registering it immediately. This allows a driver to directly fill the spi\_device with device parameters before calling **spi\_add\_device** on it.

Caller is responsible to call **spi\_add\_device** on the returned spi\_device structure to add it to the SPI master. If the caller needs to discard the spi\_device without adding it, then it should call **spi\_dev\_put** on it.

Returns a pointer to the new device, or NULL.

## COPYRIGHT
