<feed xmlns='http://www.w3.org/2005/Atom'>
<title>lwn.git/drivers/spi/spi.c, branch v2.6.37</title>
<subtitle>Linux kernel documentation tree maintained by Jonathan Corbet</subtitle>
<id>http://mirrors.hust.edu.cn/git/lwn.git/atom?h=v2.6.37</id>
<link rel='self' href='http://mirrors.hust.edu.cn/git/lwn.git/atom?h=v2.6.37'/>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/lwn.git/'/>
<updated>2010-12-23T03:43:34+00:00</updated>
<entry>
<title>drivers/spi/spi.c: don't release the spi device twice</title>
<updated>2010-12-23T03:43:34+00:00</updated>
<author>
<name>Sebastian Andrzej Siewior</name>
<email>bigeasy@linutronix.de</email>
</author>
<published>2010-12-22T01:24:31+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/lwn.git/commit/?id=97dbf37d89b6d387a5fe79ffe3b72c37ec12db43'/>
<id>urn:sha1:97dbf37d89b6d387a5fe79ffe3b72c37ec12db43</id>
<content type='text'>
This was fixed by David Lamparter in v2.6.36-rc5 3486008 ("spi: free
children in spi_unregister_master, not siblings") and broken again in
v2.6.37-rc1~2^2~4 during the merge of 2b9603a0 ("spi: enable
spi_board_info to be registered after spi_master").

Signed-off-by: Sebastian Andrzej Siewior &lt;bigeasy@linutronix.de&gt;
Signed-off-by: David Lamparter &lt;equinox@diac24.net&gt;
Cc: Grant Likely &lt;grant.likely@secretlab.ca&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>spi: fixed odd static string conventions in core code</title>
<updated>2010-10-22T15:51:05+00:00</updated>
<author>
<name>Linus Walleij</name>
<email>linus.walleij@stericsson.com</email>
</author>
<published>2010-10-21T19:06:44+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/lwn.git/commit/?id=eb288a1f45e2aa903ac8edf67dc6d59df0369fe1'/>
<id>urn:sha1:eb288a1f45e2aa903ac8edf67dc6d59df0369fe1</id>
<content type='text'>
This patch removes convention of passing a static string as a
parameter to another static string.  The convention is intended to
reduce text usage by sharing the common bits of the string, but the
implementation is inherently fragile (a change to one format string
but not the other will nullify any possible advantage), it isn't
necessarily a net win depending on what this compiler does, and it
it reduces code readability.

Signed-off-by: Linus Walleij &lt;linus.walleij@stericsson.com&gt;
[grant.likely@secretlab.ca: removed dev_dbg-&gt;dev_err hunk]
Signed-off-by: Grant Likely &lt;grant.likely@secretlab.ca&gt;
</content>
</entry>
<entry>
<title>spi: enable spi_board_info to be registered after spi_master</title>
<updated>2010-10-22T05:52:16+00:00</updated>
<author>
<name>Feng Tang</name>
<email>feng.tang@intel.com</email>
</author>
<published>2010-08-02T07:52:15+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/lwn.git/commit/?id=2b9603a0d7e395fb844af90fba71448bc8019077'/>
<id>urn:sha1:2b9603a0d7e395fb844af90fba71448bc8019077</id>
<content type='text'>
Currently spi_register_board_info() has to be called before its related
spi_master be registered, otherwise these board info will be just ignored.

This patch will remove this order limit, it adds a global spi master list
like the existing global board info listr. Whenever a board info or a
spi_master is registered, the spi master list or board info list
will be scanned, and a new spi device will be created if there is a
master-board info match.

Signed-off-by: Feng Tang &lt;feng.tang@intel.com&gt;
Signed-off-by: Grant Likely &lt;grant.likely@secretlab.ca&gt;
</content>
</entry>
<entry>
<title>of/spi: Fix OF-style driver binding of spi devices</title>
<updated>2010-10-03T03:28:29+00:00</updated>
<author>
<name>Sinan Akman</name>
<email>sinan@writeme.com</email>
</author>
<published>2010-10-03T03:28:29+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/lwn.git/commit/?id=2b7a32f7ecb24d01bd0b2d5097d7c7ebe7082ba7'/>
<id>urn:sha1:2b7a32f7ecb24d01bd0b2d5097d7c7ebe7082ba7</id>
<content type='text'>
This patch adds the OF hook to the spi core so that devices
can automatically be registered based on device tree data.  This fixes
a problem with spi devices not binding to drivers after the cleanup of
the spi &amp; i2c binding code.

Signed-off-by: Sinan Akman &lt;sinan@writeme.com&gt;
Signed-off-by: Grant Likely &lt;grant.likely@secretlab.ca&gt;
</content>
</entry>
<entry>
<title>spi: free children in spi_unregister_master, not siblings</title>
<updated>2010-09-01T15:15:24+00:00</updated>
<author>
<name>David Lamparter</name>
<email>equinox@diac24.net</email>
</author>
<published>2010-08-30T21:54:17+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/lwn.git/commit/?id=34860089c9e8abcc77428d29743b37ff756197e7'/>
<id>urn:sha1:34860089c9e8abcc77428d29743b37ff756197e7</id>
<content type='text'>
introduced by 49dce689 ("spi doesn't need class_device") and bad-fixed
by 350d0076 ("spi: fix double-free on spi_unregister_master"),
spi_unregister_master would previously device_unregister all of the spi
master's siblings (instead of its children). hilarity ensues.

fix it to unregister children.

Signed-off-by: David Lamparter &lt;equinox@diac24.net&gt;
Signed-off-by: Grant Likely &lt;grant.likely@secretlab.ca&gt;
</content>
</entry>
<entry>
<title>Merge branch 'next-spi' of git://git.secretlab.ca/git/linux-2.6</title>
<updated>2010-08-14T18:54:09+00:00</updated>
<author>
<name>Linus Torvalds</name>
<email>torvalds@linux-foundation.org</email>
</author>
<published>2010-08-14T18:54:09+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/lwn.git/commit/?id=b171aa27700c78511086a759383b033949c9d7f0'/>
<id>urn:sha1:b171aa27700c78511086a759383b033949c9d7f0</id>
<content type='text'>
* 'next-spi' of git://git.secretlab.ca/git/linux-2.6:
  spi/amba_pl022: Fix probe and remove hook section annotations.
  spi/mpc5121: change annotations for probe and remove functions
  spi/bitbang: reinitialize transfer parameters for every message
  spi/spi-gpio: add support for controllers without MISO or MOSI pin
  spi/bitbang: add support for SPI_MASTER_NO_{TX, RX} modes
  SPI100k: Fix 8-bit and RX-only transfers
  spi/mmc_spi: mmc_spi adaptations for SPI bus locking API
  spi/mmc_spi: SPI bus locking API, using mutex

Fix trivial conflict in drivers/spi/mpc512x_psc_spi.c due to 'struct
of_device' =&gt; 'struct platform_device' rename and __init/__exit to
__devinit/__devexit fix.
</content>
</entry>
<entry>
<title>of/spi: call of_register_spi_devices() from spi core code</title>
<updated>2010-07-30T06:03:59+00:00</updated>
<author>
<name>Anatolij Gustschin</name>
<email>agust@denx.de</email>
</author>
<published>2010-07-27T20:35:58+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/lwn.git/commit/?id=12b15e83289bc7cf2ec9a342412e0c955beeb395'/>
<id>urn:sha1:12b15e83289bc7cf2ec9a342412e0c955beeb395</id>
<content type='text'>
Move of_register_spi_devices() call from drivers to
spi_register_master(). Also change the function to use
the struct device_node pointer from master spi device
instead of passing it as function argument.

Signed-off-by: Anatolij Gustschin &lt;agust@denx.de&gt;
Signed-off-by: Grant Likely &lt;grant.likely@secretlab.ca&gt;
</content>
</entry>
<entry>
<title>spi/mmc_spi: SPI bus locking API, using mutex</title>
<updated>2010-06-29T00:49:29+00:00</updated>
<author>
<name>Ernst Schwab</name>
<email>eschwab@online.de</email>
</author>
<published>2010-06-29T00:49:29+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/lwn.git/commit/?id=cf32b71e981ca63e8f349d8585ca2a3583b556e0'/>
<id>urn:sha1:cf32b71e981ca63e8f349d8585ca2a3583b556e0</id>
<content type='text'>
SPI bus locking API to allow exclusive access to the SPI bus, especially, but
not limited to, for the mmc_spi driver.

Coded according to an outline from Grant Likely; here is his
specification (accidentally swapped function names corrected):

It requires 3 things to be added to struct spi_master.
- 1 Mutex
- 1 spin lock
- 1 flag.

The mutex protects spi_sync, and provides sleeping "for free"
The spinlock protects the atomic spi_async call.
The flag is set when the lock is obtained, and checked while holding
the spinlock in spi_async().  If the flag is checked, then spi_async()
must fail immediately.

The current runtime API looks like this:
spi_async(struct spi_device*, struct spi_message*);
spi_sync(struct spi_device*, struct spi_message*);

The API needs to be extended to this:
spi_async(struct spi_device*, struct spi_message*)
spi_sync(struct spi_device*, struct spi_message*)
spi_bus_lock(struct spi_master*)  /* although struct spi_device* might
be easier */
spi_bus_unlock(struct spi_master*)
spi_async_locked(struct spi_device*, struct spi_message*)
spi_sync_locked(struct spi_device*, struct spi_message*)

Drivers can only call the last two if they already hold the spi_master_lock().

spi_bus_lock() obtains the mutex, obtains the spin lock, sets the
flag, and releases the spin lock before returning.  It doesn't even
need to sleep while waiting for "in-flight" spi_transactions to
complete because its purpose is to guarantee no additional
transactions are added.  It does not guarantee that the bus is idle.

spi_bus_unlock() clears the flag and releases the mutex, which will
wake up any waiters.

The difference between spi_async() and spi_async_locked() is that the
locked version bypasses the check of the lock flag.  Both versions
need to obtain the spinlock.

The difference between spi_sync() and spi_sync_locked() is that
spi_sync() must hold the mutex while enqueuing a new transfer.
spi_sync_locked() doesn't because the mutex is already held.  Note
however that spi_sync must *not* continue to hold the mutex while
waiting for the transfer to complete, otherwise only one transfer
could be queued up at a time!

Almost no code needs to be written.  The current spi_async() and
spi_sync() can probably be renamed to __spi_async() and __spi_sync()
so that spi_async(), spi_sync(), spi_async_locked() and
spi_sync_locked() can just become wrappers around the common code.

spi_sync() is protected by a mutex because it can sleep
spi_async() needs to be protected with a flag and a spinlock because
it can be called atomically and must not sleep

Signed-off-by: Ernst Schwab &lt;eschwab@online.de&gt;
[grant.likely@secretlab.ca: use spin_lock_irqsave()]
Signed-off-by: Grant Likely &lt;grant.likely@secretlab.ca&gt;
Tested-by: Matt Fleming &lt;matt@console-pimps.org&gt;
Tested-by: Antonio Ospite &lt;ospite@studenti.unina.it&gt;
</content>
</entry>
<entry>
<title>spi: spi_device memory should be released instead of device.</title>
<updated>2010-04-28T07:17:58+00:00</updated>
<author>
<name>Roman Tereshonkov</name>
<email>roman.tereshonkov@nokia.com</email>
</author>
<published>2010-04-12T09:56:35+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/lwn.git/commit/?id=07a389feefd79d41c8542cf31ce1cf25a1466e2c'/>
<id>urn:sha1:07a389feefd79d41c8542cf31ce1cf25a1466e2c</id>
<content type='text'>
The memory for dev variable is allocated as a part of
spi_device structure memory which the dev belongs to.
Thus when the memory is released the right pointer is used.

Signed-off-by: Roman Tereshonkov &lt;roman.tereshonkov@nokia.com&gt;
Signed-off-by: Grant Likely &lt;grant.likely@secretlab.ca&gt;
</content>
</entry>
<entry>
<title>spi: release device claimed by bus_find_device_by_name</title>
<updated>2010-04-28T07:14:05+00:00</updated>
<author>
<name>Roman Tereshonkov</name>
<email>roman.tereshonkov@nokia.com</email>
</author>
<published>2010-04-16T09:52:59+00:00</published>
<link rel='alternate' type='text/html' href='http://mirrors.hust.edu.cn/git/lwn.git/commit/?id=8ec130a017ebd8b931344edde7013ffb18fa1965'/>
<id>urn:sha1:8ec130a017ebd8b931344edde7013ffb18fa1965</id>
<content type='text'>
In success case the function bus_find_device_by_name calls
get_device. In our context put_device should be called to
decrease the device count usage.

Signed-off-by: Roman Tereshonkov &lt;roman.tereshonkov@nokia.com&gt;
Signed-off-by: Grant Likely &lt;grant.likely@secretlab.ca&gt;
</content>
</entry>
</feed>
