<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel/linux.git/include/linux/spi/spi.h, branch v4.19.170</title>
<subtitle>Linux kernel stable tree (mirror)</subtitle>
<id>https://git.radix-linux.su/kernel/linux.git/atom?h=v4.19.170</id>
<link rel='self' href='https://git.radix-linux.su/kernel/linux.git/atom?h=v4.19.170'/>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/'/>
<updated>2020-12-11T12:25:03+00:00</updated>
<entry>
<title>spi: Introduce device-managed SPI controller allocation</title>
<updated>2020-12-11T12:25:03+00:00</updated>
<author>
<name>Lukas Wunner</name>
<email>lukas@wunner.de</email>
</author>
<published>2020-12-06T12:31:00+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=234b432c7b6184b2d6c5ba2c55f0dd5023c0edf0'/>
<id>urn:sha1:234b432c7b6184b2d6c5ba2c55f0dd5023c0edf0</id>
<content type='text'>
[ Upstream commit 5e844cc37a5cbaa460e68f9a989d321d63088a89 ]

SPI driver probing currently comprises two steps, whereas removal
comprises only one step:

    spi_alloc_master()
    spi_register_controller()

    spi_unregister_controller()

That's because spi_unregister_controller() calls device_unregister()
instead of device_del(), thereby releasing the reference on the
spi_controller which was obtained by spi_alloc_master().

An SPI driver's private data is contained in the same memory allocation
as the spi_controller struct.  Thus, once spi_unregister_controller()
has been called, the private data is inaccessible.  But some drivers
need to access it after spi_unregister_controller() to perform further
teardown steps.

Introduce devm_spi_alloc_master() and devm_spi_alloc_slave(), which
release a reference on the spi_controller struct only after the driver
has unbound, thereby keeping the memory allocation accessible.  Change
spi_unregister_controller() to not release a reference if the
spi_controller was allocated by one of these new devm functions.

The present commit is small enough to be backportable to stable.
It allows fixing drivers which use the private data in their -&gt;remove()
hook after it's been freed.  It also allows fixing drivers which neglect
to release a reference on the spi_controller in the probe error path.

Long-term, most SPI drivers shall be moved over to the devm functions
introduced herein.  The few that can't shall be changed in a treewide
commit to explicitly release the last reference on the controller.
That commit shall amend spi_unregister_controller() to no longer release
a reference, thereby completing the migration.

As a result, the behaviour will be less surprising and more consistent
with subsystems such as IIO, which also includes the private data in the
allocation of the generic iio_dev struct, but calls device_del() in
iio_device_unregister().

Signed-off-by: Lukas Wunner &lt;lukas@wunner.de&gt;
Link: https://lore.kernel.org/r/272bae2ef08abd21388c98e23729886663d19192.1605121038.git.lukas@wunner.de
Signed-off-by: Mark Brown &lt;broonie@kernel.org&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>spi: Get rid of the spi_flash_read() API</title>
<updated>2018-05-11T02:34:41+00:00</updated>
<author>
<name>Boris Brezillon</name>
<email>boris.brezillon@bootlin.com</email>
</author>
<published>2018-04-26T16:18:20+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=c1f5ba70decfc2f35edcc10505e3e78fb528d212'/>
<id>urn:sha1:c1f5ba70decfc2f35edcc10505e3e78fb528d212</id>
<content type='text'>
This API has been replaced by the spi_mem_xx() one, its only user
(spi-nor) has been converted to spi_mem_xx() and all SPI controller
drivers that were implementing the -&gt;spi_flash_xxx() hooks are also
implementing the spi_mem ones. So we can safely get rid of this API.

Signed-off-by: Boris Brezillon &lt;boris.brezillon@bootlin.com&gt;
Reviewed-by: Frieder Schrempf &lt;frieder.schrempf@exceet.de&gt;
Tested-by: Frieder Schrempf &lt;frieder.schrempf@exceet.de&gt;
Signed-off-by: Mark Brown &lt;broonie@kernel.org&gt;
</content>
</entry>
<entry>
<title>spi: Extend the core to ease integration of SPI memory controllers</title>
<updated>2018-05-11T02:32:43+00:00</updated>
<author>
<name>Boris Brezillon</name>
<email>boris.brezillon@bootlin.com</email>
</author>
<published>2018-04-26T16:18:14+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=c36ff266dc82f4ae797a6f3513c6ffa344f7f1c7'/>
<id>urn:sha1:c36ff266dc82f4ae797a6f3513c6ffa344f7f1c7</id>
<content type='text'>
Some controllers are exposing high-level interfaces to access various
kind of SPI memories. Unfortunately they do not fit in the current
spi_controller model and usually have drivers placed in
drivers/mtd/spi-nor which are only supporting SPI NORs and not SPI
memories in general.

This is an attempt at defining a SPI memory interface which works for
all kinds of SPI memories (NORs, NANDs, SRAMs).

Signed-off-by: Boris Brezillon &lt;boris.brezillon@bootlin.com&gt;
Reviewed-by: Frieder Schrempf &lt;frieder.schrempf@exceet.de&gt;
Tested-by: Frieder Schrempf &lt;frieder.schrempf@exceet.de&gt;
Signed-off-by: Mark Brown &lt;broonie@kernel.org&gt;
</content>
</entry>
<entry>
<title>spi: Fix double "when"</title>
<updated>2017-11-30T16:55:35+00:00</updated>
<author>
<name>Geert Uytterhoeven</name>
<email>geert+renesas@glider.be</email>
</author>
<published>2017-11-30T13:35:08+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=8d26fdfcb45dc420115b267ac9d6b3ac13457f1b'/>
<id>urn:sha1:8d26fdfcb45dc420115b267ac9d6b3ac13457f1b</id>
<content type='text'>
Signed-off-by: Geert Uytterhoeven &lt;geert+renesas@glider.be&gt;
Signed-off-by: Mark Brown &lt;broonie@kernel.org&gt;
</content>
</entry>
<entry>
<title>spi: Generalize SPI "master" to "controller"</title>
<updated>2017-06-13T17:51:11+00:00</updated>
<author>
<name>Geert Uytterhoeven</name>
<email>geert+renesas@glider.be</email>
</author>
<published>2017-06-13T11:23:52+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=8caab75fd2c2a92667cbb1cd315720bede3feaa9'/>
<id>urn:sha1:8caab75fd2c2a92667cbb1cd315720bede3feaa9</id>
<content type='text'>
Now struct spi_master is used for both SPI master and slave controllers,
it makes sense to rename it to struct spi_controller, and replace
"master" by "controller" where appropriate.

For now this conversion is done for SPI core infrastructure only.
Wrappers are provided for backwards compatibility, until all SPI drivers
have been converted.

Noteworthy details:
  - SPI_MASTER_GPIO_SS is retained, as it only makes sense for SPI
    master controllers,
  - spi_busnum_to_master() is retained, as it looks up masters only,
  - A new field spi_device.controller is added, but spi_device.master is
    retained for compatibility (both are always initialized by
    spi_alloc_device()),
  - spi_flash_read() is used by SPI masters only.

Signed-off-by: Geert Uytterhoeven &lt;geert+renesas@glider.be&gt;
Signed-off-by: Mark Brown &lt;broonie@kernel.org&gt;
</content>
</entry>
<entry>
<title>spi: core: Add support for registering SPI slave controllers</title>
<updated>2017-05-26T12:11:00+00:00</updated>
<author>
<name>Geert Uytterhoeven</name>
<email>geert+renesas@glider.be</email>
</author>
<published>2017-05-22T13:11:41+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=6c364062bfed3c34490e85bea52ff6e2d4f0f281'/>
<id>urn:sha1:6c364062bfed3c34490e85bea52ff6e2d4f0f281</id>
<content type='text'>
Add support for registering SPI slave controllers using the existing SPI
master framework:
  - SPI slave controllers must use spi_alloc_slave() instead of
    spi_alloc_master(), and should provide an additional callback
    "slave_abort" to abort an ongoing SPI transfer request,
  - SPI slave controllers are added to a new "spi_slave" device class,
  - SPI slave handlers can be bound to the SPI slave device represented
    by an SPI slave controller using a DT child node named "slave",
  - Alternatively, (un)binding an SPI slave handler to the SPI slave
    device represented by an SPI slave controller can be done by
    (un)registering the slave device through a sysfs virtual file named
    "slave".

From the point of view of an SPI slave protocol handler, an SPI slave
controller looks almost like an ordinary SPI master controller. The only
exception is that a transfer request will block on the remote SPI
master, and may be cancelled using spi_slave_abort().

Signed-off-by: Geert Uytterhoeven &lt;geert+renesas@glider.be&gt;
Signed-off-by: Mark Brown &lt;broonie@kernel.org&gt;
</content>
</entry>
<entry>
<title>Merge remote-tracking branches 'spi/topic/ti-qspi' and 'spi/topic/xlp' into spi-next</title>
<updated>2017-04-26T14:58:22+00:00</updated>
<author>
<name>Mark Brown</name>
<email>broonie@kernel.org</email>
</author>
<published>2017-04-26T14:58:22+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=282ec0ea65dab88fda51b5b9b649958ae42f4ac0'/>
<id>urn:sha1:282ec0ea65dab88fda51b5b9b649958ae42f4ac0</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Merge remote-tracking branches 'spi/topic/devprop', 'spi/topic/fsl', 'spi/topic/fsl-dspi', 'spi/topic/imx' and 'spi/topic/lantiq' into spi-next</title>
<updated>2017-04-26T14:58:04+00:00</updated>
<author>
<name>Mark Brown</name>
<email>broonie@kernel.org</email>
</author>
<published>2017-04-26T14:58:04+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=a2d5eda07224680cb711677eff014ea15d809aae'/>
<id>urn:sha1:a2d5eda07224680cb711677eff014ea15d809aae</id>
<content type='text'>
</content>
</entry>
<entry>
<title>spi: Add can_dma like interface for spi_flash_read</title>
<updated>2017-04-21T17:03:53+00:00</updated>
<author>
<name>Vignesh R</name>
<email>vigneshr@ti.com</email>
</author>
<published>2017-04-11T11:52:24+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=2bca34455b257d75080d87e800ae14afe49001bf'/>
<id>urn:sha1:2bca34455b257d75080d87e800ae14afe49001bf</id>
<content type='text'>
Add an interface analogous to -&gt;can_dma() for spi_flash_read()
interface. This will enable SPI controller drivers to inform SPI core
when not to do DMA mappings.

Signed-off-by: Vignesh R &lt;vigneshr@ti.com&gt;
Signed-off-by: Mark Brown &lt;broonie@kernel.org&gt;
</content>
</entry>
<entry>
<title>spi: dynamycally allocated message initialization</title>
<updated>2017-03-29T10:40:39+00:00</updated>
<author>
<name>Emiliano Ingrassia</name>
<email>ingrassia@epigenesys.com</email>
</author>
<published>2017-03-28T07:49:29+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=ed77d6bcafd75d247cf3c6ad685aa221cda1b8ba'/>
<id>urn:sha1:ed77d6bcafd75d247cf3c6ad685aa221cda1b8ba</id>
<content type='text'>
Invoke the proper function while initializing
a dynamically allocated spi_message to avoid
NULL pointer dereference during resources deallocation.

Signed-off-by: Emiliano Ingrassia &lt;ingrassia@epigenesys.com&gt;
Signed-off-by: Mark Brown &lt;broonie@kernel.org&gt;
</content>
</entry>
</feed>
