spi_alloc_master - allocate SPI master controller
2. SYNOPSIS ▲
struct spi_master * spi_alloc_master(struct device * dev , unsigned size );
3. ARGUMENTS ▲
the controller, possibly using the platform_bus
how much zeroed driver-private data to allocate; the pointer to this memory is in the driver_data field of the returned device, accessible with spi_master_get_devdata.
4. CONTEXT ▲
5. DESCRIPTION ▲
This call is used only by SPI master controller drivers, which are the only ones directly touching chip registers. ItAqs how they allocate an spi_master structure, prior to calling spi_register_master.
This must be called from context that can sleep. It returns the SPI master structure on success, else NULL.
The caller is responsible for assigning the bus number and initializing the masterAqs methods before calling spi_register_master; and (after errors adding the device) calling spi_master_put and kfree to prevent a memory leak.
6. COPYRIGHT ▲