'\" t .\" Title: spi_alloc_master .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] .\" Generator: DocBook XSL Stylesheets v1.78.1 .\" Date: May 2018 .\" Manual: Serial Peripheral Interface (SPI) .\" Source: Kernel Hackers Manual 3.16.56 .\" Language: English .\" .TH "SPI_ALLOC_MASTER" "9" "May 2018" "Kernel Hackers Manual 3\&.16\&" "Serial Peripheral Interface (S" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .\" http://bugs.debian.org/507673 .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- .\" disable hyphenation .nh .\" disable justification (adjust text to left margin only) .ad l .\" ----------------------------------------------------------------- .\" * MAIN CONTENT STARTS HERE * .\" ----------------------------------------------------------------- .SH "NAME" spi_alloc_master \- allocate SPI master controller .SH "SYNOPSIS" .HP \w'struct\ spi_master\ *\ spi_alloc_master('u .BI "struct spi_master * spi_alloc_master(struct\ device\ *\ " "dev" ", unsigned\ " "size" ");" .SH "ARGUMENTS" .PP \fIdev\fR .RS 4 the controller, possibly using the platform_bus .RE .PP \fIsize\fR .RS 4 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 \fBspi_master_get_devdata\fR\&. .RE .SH "CONTEXT" .PP can sleep .SH "DESCRIPTION" .PP This call is used only by SPI master controller drivers, which are the only ones directly touching chip registers\&. It\*(Aqs how they allocate an spi_master structure, prior to calling \fBspi_register_master\fR\&. .PP This must be called from context that can sleep\&. It returns the SPI master structure on success, else NULL\&. .PP The caller is responsible for assigning the bus number and initializing the master\*(Aqs methods before calling \fBspi_register_master\fR; and (after errors adding the device) calling \fBspi_master_put\fR to prevent a memory leak\&. .SH "COPYRIGHT" .br