1<html><head><meta http-equiv="Content-Type" content="text/html; charset=ANSI_X3.4-1968"><title>spi_register_master</title><meta name="generator" content="DocBook XSL Stylesheets V1.78.1"><link rel="home" href="index.html" title="Linux Device Drivers"><link rel="up" href="spi.html" title="Chapter 9. Serial Peripheral Interface (SPI)"><link rel="prev" href="API-spi-alloc-master.html" title="spi_alloc_master"><link rel="next" href="API-devm-spi-register-master.html" title="devm_spi_register_master"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center"><span class="phrase">spi_register_master</span></th></tr><tr><td width="20%" align="left"><a accesskey="p" href="API-spi-alloc-master.html">Prev</a> </td><th width="60%" align="center">Chapter 9. Serial Peripheral Interface (SPI)</th><td width="20%" align="right"> <a accesskey="n" href="API-devm-spi-register-master.html">Next</a></td></tr></table><hr></div><div class="refentry"><a name="API-spi-register-master"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>spi_register_master — 2 register SPI master controller 3 </p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><div class="funcsynopsis"><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">int <b class="fsfunc">spi_register_master </b>(</code></td><td>struct spi_master * <var class="pdparam">master</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div></div></div><div class="refsect1"><a name="idp1115104828"></a><h2>Arguments</h2><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="parameter"><code>master</code></em></span></dt><dd><p> 4 initialized master, originally from <code class="function">spi_alloc_master</code> 5 </p></dd></dl></div></div><div class="refsect1"><a name="idp1115106804"></a><h2>Context</h2><p> 6 can sleep 7</p></div><div class="refsect1"><a name="idp1115107420"></a><h2>Description</h2><p> 8 SPI master controllers connect to their drivers using some non-SPI bus, 9 such as the platform bus. The final stage of <code class="function">probe</code> in that code 10 includes calling <code class="function">spi_register_master</code> to hook up to this SPI bus glue. 11 </p><p> 12 13 SPI controllers use board specific (often SOC specific) bus numbers, 14 and board-specific addressing for SPI devices combines those numbers 15 with chip select numbers. Since SPI does not directly support dynamic 16 device identification, boards need configuration tables telling which 17 chip is at which address. 18 </p><p> 19 20 This must be called from context that can sleep. It returns zero on 21 success, else a negative error code (dropping the master's refcount). 22 After a successful return, the caller is responsible for calling 23 <code class="function">spi_unregister_master</code>. 24</p></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="API-spi-alloc-master.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="spi.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="API-devm-spi-register-master.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top"><span class="phrase">spi_alloc_master</span> </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> <span class="phrase">devm_spi_register_master</span></td></tr></table></div></body></html> 25