diff options
author | Tony Jones <tonyj@suse.de> | 2007-10-16 04:27:48 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-10-16 12:43:10 -0400 |
commit | 49dce689ad4ef0fd1f970ef762168e4bd46f69a3 (patch) | |
tree | e9e6d07c704118d82a638ae1f01a7ef5b59dd68b /Documentation/spi | |
parent | cd58310d775fc10cc820b27c10f619187b8c4133 (diff) |
spi doesn't need class_device
Make the SPI framework and drivers stop using class_device. Update docs
accordingly ... highlighting just which sysfs paths should be
"safe"/stable.
Signed-off-by: Tony Jones <tonyj@suse.de>
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Cc: Greg KH <greg@kroah.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'Documentation/spi')
-rw-r--r-- | Documentation/spi/spi-summary | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/Documentation/spi/spi-summary b/Documentation/spi/spi-summary index 76ea6c837be5..8861e47e5a2d 100644 --- a/Documentation/spi/spi-summary +++ b/Documentation/spi/spi-summary | |||
@@ -156,21 +156,29 @@ using the driver model to connect controller and protocol drivers using | |||
156 | device tables provided by board specific initialization code. SPI | 156 | device tables provided by board specific initialization code. SPI |
157 | shows up in sysfs in several locations: | 157 | shows up in sysfs in several locations: |
158 | 158 | ||
159 | /sys/devices/.../CTLR ... physical node for a given SPI controller | ||
160 | |||
159 | /sys/devices/.../CTLR/spiB.C ... spi_device on bus "B", | 161 | /sys/devices/.../CTLR/spiB.C ... spi_device on bus "B", |
160 | chipselect C, accessed through CTLR. | 162 | chipselect C, accessed through CTLR. |
161 | 163 | ||
164 | /sys/bus/spi/devices/spiB.C ... symlink to that physical | ||
165 | .../CTLR/spiB.C device | ||
166 | |||
162 | /sys/devices/.../CTLR/spiB.C/modalias ... identifies the driver | 167 | /sys/devices/.../CTLR/spiB.C/modalias ... identifies the driver |
163 | that should be used with this device (for hotplug/coldplug) | 168 | that should be used with this device (for hotplug/coldplug) |
164 | 169 | ||
165 | /sys/bus/spi/devices/spiB.C ... symlink to the physical | ||
166 | spiB.C device | ||
167 | |||
168 | /sys/bus/spi/drivers/D ... driver for one or more spi*.* devices | 170 | /sys/bus/spi/drivers/D ... driver for one or more spi*.* devices |
169 | 171 | ||
170 | /sys/class/spi_master/spiB ... class device for the controller | 172 | /sys/class/spi_master/spiB ... symlink (or actual device node) to |
171 | managing bus "B". All the spiB.* devices share the same | 173 | a logical node which could hold class related state for the |
174 | controller managing bus "B". All spiB.* devices share one | ||
172 | physical SPI bus segment, with SCLK, MOSI, and MISO. | 175 | physical SPI bus segment, with SCLK, MOSI, and MISO. |
173 | 176 | ||
177 | Note that the actual location of the controller's class state depends | ||
178 | on whether you enabled CONFIG_SYSFS_DEPRECATED or not. At this time, | ||
179 | the only class-specific state is the bus number ("B" in "spiB"), so | ||
180 | those /sys/class entries are only useful to quickly identify busses. | ||
181 | |||
174 | 182 | ||
175 | How does board-specific init code declare SPI devices? | 183 | How does board-specific init code declare SPI devices? |
176 | ------------------------------------------------------ | 184 | ------------------------------------------------------ |
@@ -337,7 +345,8 @@ SPI protocol drivers somewhat resemble platform device drivers: | |||
337 | 345 | ||
338 | The driver core will autmatically attempt to bind this driver to any SPI | 346 | The driver core will autmatically attempt to bind this driver to any SPI |
339 | device whose board_info gave a modalias of "CHIP". Your probe() code | 347 | device whose board_info gave a modalias of "CHIP". Your probe() code |
340 | might look like this unless you're creating a class_device: | 348 | might look like this unless you're creating a device which is managing |
349 | a bus (appearing under /sys/class/spi_master). | ||
341 | 350 | ||
342 | static int __devinit CHIP_probe(struct spi_device *spi) | 351 | static int __devinit CHIP_probe(struct spi_device *spi) |
343 | { | 352 | { |
@@ -442,7 +451,7 @@ An SPI controller will probably be registered on the platform_bus; write | |||
442 | a driver to bind to the device, whichever bus is involved. | 451 | a driver to bind to the device, whichever bus is involved. |
443 | 452 | ||
444 | The main task of this type of driver is to provide an "spi_master". | 453 | The main task of this type of driver is to provide an "spi_master". |
445 | Use spi_alloc_master() to allocate the master, and class_get_devdata() | 454 | Use spi_alloc_master() to allocate the master, and spi_master_get_devdata() |
446 | to get the driver-private data allocated for that device. | 455 | to get the driver-private data allocated for that device. |
447 | 456 | ||
448 | struct spi_master *master; | 457 | struct spi_master *master; |
@@ -452,7 +461,7 @@ to get the driver-private data allocated for that device. | |||
452 | if (!master) | 461 | if (!master) |
453 | return -ENODEV; | 462 | return -ENODEV; |
454 | 463 | ||
455 | c = class_get_devdata(&master->cdev); | 464 | c = spi_master_get_devdata(master); |
456 | 465 | ||
457 | The driver will initialize the fields of that spi_master, including the | 466 | The driver will initialize the fields of that spi_master, including the |
458 | bus number (maybe the same as the platform device ID) and three methods | 467 | bus number (maybe the same as the platform device ID) and three methods |