1SPI_ALLOC_MASTER(9) Serial Peripheral Interface (S SPI_ALLOC_MASTER(9)
2
3
4
6 spi_alloc_master - allocate SPI master controller
7
9 struct spi_master * spi_alloc_master(struct device * dev,
10 unsigned size);
11
13 dev
14 the controller, possibly using the platform_bus
15
16 size
17 how much zeroed driver-private data to allocate; the pointer to
18 this memory is in the driver_data field of the returned device,
19 accessible with spi_master_get_devdata.
20
22 can sleep
23
25 This call is used only by SPI master controller drivers, which are the
26 only ones directly touching chip registers. It's how they allocate an
27 spi_master structure, prior to calling spi_register_master.
28
29 This must be called from context that can sleep. It returns the SPI
30 master structure on success, else NULL.
31
32 The caller is responsible for assigning the bus number and initializing
33 the master's methods before calling spi_register_master; and (after
34 errors adding the device) calling spi_master_put and kfree to prevent a
35 memory leak.
36
38Kernel Hackers Manual 3.10 June 2019 SPI_ALLOC_MASTER(9)