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 | |
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>
-rw-r--r-- | Documentation/spi/spi-summary | 25 | ||||
-rw-r--r-- | drivers/mmc/host/mmc_spi.c | 4 | ||||
-rw-r--r-- | drivers/spi/atmel_spi.c | 14 | ||||
-rw-r--r-- | drivers/spi/mpc52xx_psc_spi.c | 2 | ||||
-rw-r--r-- | drivers/spi/pxa2xx_spi.c | 2 | ||||
-rw-r--r-- | drivers/spi/spi.c | 36 | ||||
-rw-r--r-- | drivers/spi/spi_bfin5xx.c | 2 | ||||
-rw-r--r-- | drivers/spi/spi_bitbang.c | 2 | ||||
-rw-r--r-- | drivers/spi/spi_imx.c | 2 | ||||
-rw-r--r-- | drivers/spi/spi_lm70llp.c | 2 | ||||
-rw-r--r-- | drivers/spi/spi_txx9.c | 2 | ||||
-rw-r--r-- | include/linux/spi/spi.h | 12 |
12 files changed, 57 insertions, 48 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 |
diff --git a/drivers/mmc/host/mmc_spi.c b/drivers/mmc/host/mmc_spi.c index 254b194e7625..71b986b38c55 100644 --- a/drivers/mmc/host/mmc_spi.c +++ b/drivers/mmc/host/mmc_spi.c | |||
@@ -1280,8 +1280,8 @@ static int mmc_spi_probe(struct spi_device *spi) | |||
1280 | if (!host->data) | 1280 | if (!host->data) |
1281 | goto fail_nobuf1; | 1281 | goto fail_nobuf1; |
1282 | 1282 | ||
1283 | if (spi->master->cdev.dev->dma_mask) { | 1283 | if (spi->master->dev.parent->dma_mask) { |
1284 | struct device *dev = spi->master->cdev.dev; | 1284 | struct device *dev = spi->master->dev.parent; |
1285 | 1285 | ||
1286 | host->dma_dev = dev; | 1286 | host->dma_dev = dev; |
1287 | host->ones_dma = dma_map_single(dev, ones, | 1287 | host->ones_dma = dma_map_single(dev, ones, |
diff --git a/drivers/spi/atmel_spi.c b/drivers/spi/atmel_spi.c index b0469749310a..0d342dcdd302 100644 --- a/drivers/spi/atmel_spi.c +++ b/drivers/spi/atmel_spi.c | |||
@@ -211,7 +211,7 @@ static void atmel_spi_next_message(struct spi_master *master) | |||
211 | msg = list_entry(as->queue.next, struct spi_message, queue); | 211 | msg = list_entry(as->queue.next, struct spi_message, queue); |
212 | spi = msg->spi; | 212 | spi = msg->spi; |
213 | 213 | ||
214 | dev_dbg(master->cdev.dev, "start message %p for %s\n", | 214 | dev_dbg(master->dev.parent, "start message %p for %s\n", |
215 | msg, spi->dev.bus_id); | 215 | msg, spi->dev.bus_id); |
216 | 216 | ||
217 | /* select chip if it's not still active */ | 217 | /* select chip if it's not still active */ |
@@ -266,10 +266,10 @@ static void atmel_spi_dma_unmap_xfer(struct spi_master *master, | |||
266 | struct spi_transfer *xfer) | 266 | struct spi_transfer *xfer) |
267 | { | 267 | { |
268 | if (xfer->tx_dma != INVALID_DMA_ADDRESS) | 268 | if (xfer->tx_dma != INVALID_DMA_ADDRESS) |
269 | dma_unmap_single(master->cdev.dev, xfer->tx_dma, | 269 | dma_unmap_single(master->dev.parent, xfer->tx_dma, |
270 | xfer->len, DMA_TO_DEVICE); | 270 | xfer->len, DMA_TO_DEVICE); |
271 | if (xfer->rx_dma != INVALID_DMA_ADDRESS) | 271 | if (xfer->rx_dma != INVALID_DMA_ADDRESS) |
272 | dma_unmap_single(master->cdev.dev, xfer->rx_dma, | 272 | dma_unmap_single(master->dev.parent, xfer->rx_dma, |
273 | xfer->len, DMA_FROM_DEVICE); | 273 | xfer->len, DMA_FROM_DEVICE); |
274 | } | 274 | } |
275 | 275 | ||
@@ -285,7 +285,7 @@ atmel_spi_msg_done(struct spi_master *master, struct atmel_spi *as, | |||
285 | list_del(&msg->queue); | 285 | list_del(&msg->queue); |
286 | msg->status = status; | 286 | msg->status = status; |
287 | 287 | ||
288 | dev_dbg(master->cdev.dev, | 288 | dev_dbg(master->dev.parent, |
289 | "xfer complete: %u bytes transferred\n", | 289 | "xfer complete: %u bytes transferred\n", |
290 | msg->actual_length); | 290 | msg->actual_length); |
291 | 291 | ||
@@ -348,7 +348,7 @@ atmel_spi_interrupt(int irq, void *dev_id) | |||
348 | if (xfer->delay_usecs) | 348 | if (xfer->delay_usecs) |
349 | udelay(xfer->delay_usecs); | 349 | udelay(xfer->delay_usecs); |
350 | 350 | ||
351 | dev_warn(master->cdev.dev, "fifo overrun (%u/%u remaining)\n", | 351 | dev_warn(master->dev.parent, "fifo overrun (%u/%u remaining)\n", |
352 | spi_readl(as, TCR), spi_readl(as, RCR)); | 352 | spi_readl(as, TCR), spi_readl(as, RCR)); |
353 | 353 | ||
354 | /* | 354 | /* |
@@ -363,7 +363,7 @@ atmel_spi_interrupt(int irq, void *dev_id) | |||
363 | if (spi_readl(as, SR) & SPI_BIT(TXEMPTY)) | 363 | if (spi_readl(as, SR) & SPI_BIT(TXEMPTY)) |
364 | break; | 364 | break; |
365 | if (!timeout) | 365 | if (!timeout) |
366 | dev_warn(master->cdev.dev, | 366 | dev_warn(master->dev.parent, |
367 | "timeout waiting for TXEMPTY"); | 367 | "timeout waiting for TXEMPTY"); |
368 | while (spi_readl(as, SR) & SPI_BIT(RDRF)) | 368 | while (spi_readl(as, SR) & SPI_BIT(RDRF)) |
369 | spi_readl(as, RDR); | 369 | spi_readl(as, RDR); |
@@ -526,7 +526,7 @@ static int atmel_spi_transfer(struct spi_device *spi, struct spi_message *msg) | |||
526 | struct atmel_spi *as; | 526 | struct atmel_spi *as; |
527 | struct spi_transfer *xfer; | 527 | struct spi_transfer *xfer; |
528 | unsigned long flags; | 528 | unsigned long flags; |
529 | struct device *controller = spi->master->cdev.dev; | 529 | struct device *controller = spi->master->dev.parent; |
530 | 530 | ||
531 | as = spi_master_get_devdata(spi->master); | 531 | as = spi_master_get_devdata(spi->master); |
532 | 532 | ||
diff --git a/drivers/spi/mpc52xx_psc_spi.c b/drivers/spi/mpc52xx_psc_spi.c index d2a4b2bdb07b..e9aba932f217 100644 --- a/drivers/spi/mpc52xx_psc_spi.c +++ b/drivers/spi/mpc52xx_psc_spi.c | |||
@@ -503,7 +503,7 @@ static int __init mpc52xx_psc_spi_do_probe(struct device *dev, u32 regaddr, | |||
503 | INIT_LIST_HEAD(&mps->queue); | 503 | INIT_LIST_HEAD(&mps->queue); |
504 | 504 | ||
505 | mps->workqueue = create_singlethread_workqueue( | 505 | mps->workqueue = create_singlethread_workqueue( |
506 | master->cdev.dev->bus_id); | 506 | master->dev.parent->bus_id); |
507 | if (mps->workqueue == NULL) { | 507 | if (mps->workqueue == NULL) { |
508 | ret = -EBUSY; | 508 | ret = -EBUSY; |
509 | goto free_irq; | 509 | goto free_irq; |
diff --git a/drivers/spi/pxa2xx_spi.c b/drivers/spi/pxa2xx_spi.c index e05918e79eae..5f3d808cbc29 100644 --- a/drivers/spi/pxa2xx_spi.c +++ b/drivers/spi/pxa2xx_spi.c | |||
@@ -1242,7 +1242,7 @@ static int __init init_queue(struct driver_data *drv_data) | |||
1242 | 1242 | ||
1243 | INIT_WORK(&drv_data->pump_messages, pump_messages); | 1243 | INIT_WORK(&drv_data->pump_messages, pump_messages); |
1244 | drv_data->workqueue = create_singlethread_workqueue( | 1244 | drv_data->workqueue = create_singlethread_workqueue( |
1245 | drv_data->master->cdev.dev->bus_id); | 1245 | drv_data->master->dev.parent->bus_id); |
1246 | if (drv_data->workqueue == NULL) | 1246 | if (drv_data->workqueue == NULL) |
1247 | return -EBUSY; | 1247 | return -EBUSY; |
1248 | 1248 | ||
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index bcb8dd5fb0b4..89769ce16f88 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c | |||
@@ -204,7 +204,7 @@ struct spi_device *spi_new_device(struct spi_master *master, | |||
204 | struct spi_board_info *chip) | 204 | struct spi_board_info *chip) |
205 | { | 205 | { |
206 | struct spi_device *proxy; | 206 | struct spi_device *proxy; |
207 | struct device *dev = master->cdev.dev; | 207 | struct device *dev = master->dev.parent; |
208 | int status; | 208 | int status; |
209 | 209 | ||
210 | /* NOTE: caller did any chip->bus_num checks necessary. | 210 | /* NOTE: caller did any chip->bus_num checks necessary. |
@@ -239,7 +239,7 @@ struct spi_device *spi_new_device(struct spi_master *master, | |||
239 | proxy->modalias = chip->modalias; | 239 | proxy->modalias = chip->modalias; |
240 | 240 | ||
241 | snprintf(proxy->dev.bus_id, sizeof proxy->dev.bus_id, | 241 | snprintf(proxy->dev.bus_id, sizeof proxy->dev.bus_id, |
242 | "%s.%u", master->cdev.class_id, | 242 | "%s.%u", master->dev.bus_id, |
243 | chip->chip_select); | 243 | chip->chip_select); |
244 | proxy->dev.parent = dev; | 244 | proxy->dev.parent = dev; |
245 | proxy->dev.bus = &spi_bus_type; | 245 | proxy->dev.bus = &spi_bus_type; |
@@ -338,18 +338,18 @@ static void scan_boardinfo(struct spi_master *master) | |||
338 | 338 | ||
339 | /*-------------------------------------------------------------------------*/ | 339 | /*-------------------------------------------------------------------------*/ |
340 | 340 | ||
341 | static void spi_master_release(struct class_device *cdev) | 341 | static void spi_master_release(struct device *dev) |
342 | { | 342 | { |
343 | struct spi_master *master; | 343 | struct spi_master *master; |
344 | 344 | ||
345 | master = container_of(cdev, struct spi_master, cdev); | 345 | master = container_of(dev, struct spi_master, dev); |
346 | kfree(master); | 346 | kfree(master); |
347 | } | 347 | } |
348 | 348 | ||
349 | static struct class spi_master_class = { | 349 | static struct class spi_master_class = { |
350 | .name = "spi_master", | 350 | .name = "spi_master", |
351 | .owner = THIS_MODULE, | 351 | .owner = THIS_MODULE, |
352 | .release = spi_master_release, | 352 | .dev_release = spi_master_release, |
353 | }; | 353 | }; |
354 | 354 | ||
355 | 355 | ||
@@ -357,7 +357,7 @@ static struct class spi_master_class = { | |||
357 | * spi_alloc_master - allocate SPI master controller | 357 | * spi_alloc_master - allocate SPI master controller |
358 | * @dev: the controller, possibly using the platform_bus | 358 | * @dev: the controller, possibly using the platform_bus |
359 | * @size: how much zeroed driver-private data to allocate; the pointer to this | 359 | * @size: how much zeroed driver-private data to allocate; the pointer to this |
360 | * memory is in the class_data field of the returned class_device, | 360 | * memory is in the driver_data field of the returned device, |
361 | * accessible with spi_master_get_devdata(). | 361 | * accessible with spi_master_get_devdata(). |
362 | * Context: can sleep | 362 | * Context: can sleep |
363 | * | 363 | * |
@@ -383,9 +383,9 @@ struct spi_master *spi_alloc_master(struct device *dev, unsigned size) | |||
383 | if (!master) | 383 | if (!master) |
384 | return NULL; | 384 | return NULL; |
385 | 385 | ||
386 | class_device_initialize(&master->cdev); | 386 | device_initialize(&master->dev); |
387 | master->cdev.class = &spi_master_class; | 387 | master->dev.class = &spi_master_class; |
388 | master->cdev.dev = get_device(dev); | 388 | master->dev.parent = get_device(dev); |
389 | spi_master_set_devdata(master, &master[1]); | 389 | spi_master_set_devdata(master, &master[1]); |
390 | 390 | ||
391 | return master; | 391 | return master; |
@@ -415,7 +415,7 @@ EXPORT_SYMBOL_GPL(spi_alloc_master); | |||
415 | int spi_register_master(struct spi_master *master) | 415 | int spi_register_master(struct spi_master *master) |
416 | { | 416 | { |
417 | static atomic_t dyn_bus_id = ATOMIC_INIT((1<<15) - 1); | 417 | static atomic_t dyn_bus_id = ATOMIC_INIT((1<<15) - 1); |
418 | struct device *dev = master->cdev.dev; | 418 | struct device *dev = master->dev.parent; |
419 | int status = -ENODEV; | 419 | int status = -ENODEV; |
420 | int dynamic = 0; | 420 | int dynamic = 0; |
421 | 421 | ||
@@ -440,12 +440,12 @@ int spi_register_master(struct spi_master *master) | |||
440 | /* register the device, then userspace will see it. | 440 | /* register the device, then userspace will see it. |
441 | * registration fails if the bus ID is in use. | 441 | * registration fails if the bus ID is in use. |
442 | */ | 442 | */ |
443 | snprintf(master->cdev.class_id, sizeof master->cdev.class_id, | 443 | snprintf(master->dev.bus_id, sizeof master->dev.bus_id, |
444 | "spi%u", master->bus_num); | 444 | "spi%u", master->bus_num); |
445 | status = class_device_add(&master->cdev); | 445 | status = device_add(&master->dev); |
446 | if (status < 0) | 446 | if (status < 0) |
447 | goto done; | 447 | goto done; |
448 | dev_dbg(dev, "registered master %s%s\n", master->cdev.class_id, | 448 | dev_dbg(dev, "registered master %s%s\n", master->dev.bus_id, |
449 | dynamic ? " (dynamic)" : ""); | 449 | dynamic ? " (dynamic)" : ""); |
450 | 450 | ||
451 | /* populate children from any spi device tables */ | 451 | /* populate children from any spi device tables */ |
@@ -478,8 +478,8 @@ void spi_unregister_master(struct spi_master *master) | |||
478 | { | 478 | { |
479 | int dummy; | 479 | int dummy; |
480 | 480 | ||
481 | dummy = device_for_each_child(master->cdev.dev, NULL, __unregister); | 481 | dummy = device_for_each_child(master->dev.parent, NULL, __unregister); |
482 | class_device_unregister(&master->cdev); | 482 | device_unregister(&master->dev); |
483 | } | 483 | } |
484 | EXPORT_SYMBOL_GPL(spi_unregister_master); | 484 | EXPORT_SYMBOL_GPL(spi_unregister_master); |
485 | 485 | ||
@@ -495,13 +495,13 @@ EXPORT_SYMBOL_GPL(spi_unregister_master); | |||
495 | */ | 495 | */ |
496 | struct spi_master *spi_busnum_to_master(u16 bus_num) | 496 | struct spi_master *spi_busnum_to_master(u16 bus_num) |
497 | { | 497 | { |
498 | struct class_device *cdev; | 498 | struct device *dev; |
499 | struct spi_master *master = NULL; | 499 | struct spi_master *master = NULL; |
500 | struct spi_master *m; | 500 | struct spi_master *m; |
501 | 501 | ||
502 | down(&spi_master_class.sem); | 502 | down(&spi_master_class.sem); |
503 | list_for_each_entry(cdev, &spi_master_class.children, node) { | 503 | list_for_each_entry(dev, &spi_master_class.children, node) { |
504 | m = container_of(cdev, struct spi_master, cdev); | 504 | m = container_of(dev, struct spi_master, dev); |
505 | if (m->bus_num == bus_num) { | 505 | if (m->bus_num == bus_num) { |
506 | master = spi_master_get(m); | 506 | master = spi_master_get(m); |
507 | break; | 507 | break; |
diff --git a/drivers/spi/spi_bfin5xx.c b/drivers/spi/spi_bfin5xx.c index 179f9b8dc715..6cb71d74738f 100644 --- a/drivers/spi/spi_bfin5xx.c +++ b/drivers/spi/spi_bfin5xx.c | |||
@@ -1106,7 +1106,7 @@ static inline int init_queue(struct driver_data *drv_data) | |||
1106 | /* init messages workqueue */ | 1106 | /* init messages workqueue */ |
1107 | INIT_WORK(&drv_data->pump_messages, pump_messages); | 1107 | INIT_WORK(&drv_data->pump_messages, pump_messages); |
1108 | drv_data->workqueue = | 1108 | drv_data->workqueue = |
1109 | create_singlethread_workqueue(drv_data->master->cdev.dev->bus_id); | 1109 | create_singlethread_workqueue(drv_data->master->dev.parent->bus_id); |
1110 | if (drv_data->workqueue == NULL) | 1110 | if (drv_data->workqueue == NULL) |
1111 | return -EBUSY; | 1111 | return -EBUSY; |
1112 | 1112 | ||
diff --git a/drivers/spi/spi_bitbang.c b/drivers/spi/spi_bitbang.c index 0c85c984ccb4..81639c6be1c7 100644 --- a/drivers/spi/spi_bitbang.c +++ b/drivers/spi/spi_bitbang.c | |||
@@ -472,7 +472,7 @@ int spi_bitbang_start(struct spi_bitbang *bitbang) | |||
472 | /* this task is the only thing to touch the SPI bits */ | 472 | /* this task is the only thing to touch the SPI bits */ |
473 | bitbang->busy = 0; | 473 | bitbang->busy = 0; |
474 | bitbang->workqueue = create_singlethread_workqueue( | 474 | bitbang->workqueue = create_singlethread_workqueue( |
475 | bitbang->master->cdev.dev->bus_id); | 475 | bitbang->master->dev.parent->bus_id); |
476 | if (bitbang->workqueue == NULL) { | 476 | if (bitbang->workqueue == NULL) { |
477 | status = -EBUSY; | 477 | status = -EBUSY; |
478 | goto err1; | 478 | goto err1; |
diff --git a/drivers/spi/spi_imx.c b/drivers/spi/spi_imx.c index 0f0c5c11c79f..3b4650ae6f1a 100644 --- a/drivers/spi/spi_imx.c +++ b/drivers/spi/spi_imx.c | |||
@@ -1374,7 +1374,7 @@ static int __init init_queue(struct driver_data *drv_data) | |||
1374 | 1374 | ||
1375 | INIT_WORK(&drv_data->work, pump_messages); | 1375 | INIT_WORK(&drv_data->work, pump_messages); |
1376 | drv_data->workqueue = create_singlethread_workqueue( | 1376 | drv_data->workqueue = create_singlethread_workqueue( |
1377 | drv_data->master->cdev.dev->bus_id); | 1377 | drv_data->master->dev.parent->bus_id); |
1378 | if (drv_data->workqueue == NULL) | 1378 | if (drv_data->workqueue == NULL) |
1379 | return -EBUSY; | 1379 | return -EBUSY; |
1380 | 1380 | ||
diff --git a/drivers/spi/spi_lm70llp.c b/drivers/spi/spi_lm70llp.c index 4ea68ac16115..39d8d8ad65c0 100644 --- a/drivers/spi/spi_lm70llp.c +++ b/drivers/spi/spi_lm70llp.c | |||
@@ -82,7 +82,7 @@ struct spi_lm70llp { | |||
82 | struct pardevice *pd; | 82 | struct pardevice *pd; |
83 | struct spi_device *spidev_lm70; | 83 | struct spi_device *spidev_lm70; |
84 | struct spi_board_info info; | 84 | struct spi_board_info info; |
85 | struct class_device *cdev; | 85 | //struct device *dev; |
86 | }; | 86 | }; |
87 | 87 | ||
88 | /* REVISIT : ugly global ; provides "exclusive open" facility */ | 88 | /* REVISIT : ugly global ; provides "exclusive open" facility */ |
diff --git a/drivers/spi/spi_txx9.c b/drivers/spi/spi_txx9.c index b7f4bb239eaf..cc5094f37dd3 100644 --- a/drivers/spi/spi_txx9.c +++ b/drivers/spi/spi_txx9.c | |||
@@ -400,7 +400,7 @@ static int __init txx9spi_probe(struct platform_device *dev) | |||
400 | goto exit; | 400 | goto exit; |
401 | } | 401 | } |
402 | 402 | ||
403 | c->workqueue = create_singlethread_workqueue(master->cdev.dev->bus_id); | 403 | c->workqueue = create_singlethread_workqueue(master->dev.parent->bus_id); |
404 | if (!c->workqueue) | 404 | if (!c->workqueue) |
405 | goto exit; | 405 | goto exit; |
406 | c->last_chipselect = -1; | 406 | c->last_chipselect = -1; |
diff --git a/include/linux/spi/spi.h b/include/linux/spi/spi.h index 002a3cddbdd5..387e428f1cdf 100644 --- a/include/linux/spi/spi.h +++ b/include/linux/spi/spi.h | |||
@@ -195,7 +195,7 @@ static inline void spi_unregister_driver(struct spi_driver *sdrv) | |||
195 | 195 | ||
196 | /** | 196 | /** |
197 | * struct spi_master - interface to SPI master controller | 197 | * struct spi_master - interface to SPI master controller |
198 | * @cdev: class interface to this driver | 198 | * @dev: device interface to this driver |
199 | * @bus_num: board-specific (and often SOC-specific) identifier for a | 199 | * @bus_num: board-specific (and often SOC-specific) identifier for a |
200 | * given SPI controller. | 200 | * given SPI controller. |
201 | * @num_chipselect: chipselects are used to distinguish individual | 201 | * @num_chipselect: chipselects are used to distinguish individual |
@@ -222,7 +222,7 @@ static inline void spi_unregister_driver(struct spi_driver *sdrv) | |||
222 | * message's completion function when the transaction completes. | 222 | * message's completion function when the transaction completes. |
223 | */ | 223 | */ |
224 | struct spi_master { | 224 | struct spi_master { |
225 | struct class_device cdev; | 225 | struct device dev; |
226 | 226 | ||
227 | /* other than negative (== assign one dynamically), bus_num is fully | 227 | /* other than negative (== assign one dynamically), bus_num is fully |
228 | * board-specific. usually that simplifies to being SOC-specific. | 228 | * board-specific. usually that simplifies to being SOC-specific. |
@@ -268,17 +268,17 @@ struct spi_master { | |||
268 | 268 | ||
269 | static inline void *spi_master_get_devdata(struct spi_master *master) | 269 | static inline void *spi_master_get_devdata(struct spi_master *master) |
270 | { | 270 | { |
271 | return class_get_devdata(&master->cdev); | 271 | return dev_get_drvdata(&master->dev); |
272 | } | 272 | } |
273 | 273 | ||
274 | static inline void spi_master_set_devdata(struct spi_master *master, void *data) | 274 | static inline void spi_master_set_devdata(struct spi_master *master, void *data) |
275 | { | 275 | { |
276 | class_set_devdata(&master->cdev, data); | 276 | dev_set_drvdata(&master->dev, data); |
277 | } | 277 | } |
278 | 278 | ||
279 | static inline struct spi_master *spi_master_get(struct spi_master *master) | 279 | static inline struct spi_master *spi_master_get(struct spi_master *master) |
280 | { | 280 | { |
281 | if (!master || !class_device_get(&master->cdev)) | 281 | if (!master || !get_device(&master->dev)) |
282 | return NULL; | 282 | return NULL; |
283 | return master; | 283 | return master; |
284 | } | 284 | } |
@@ -286,7 +286,7 @@ static inline struct spi_master *spi_master_get(struct spi_master *master) | |||
286 | static inline void spi_master_put(struct spi_master *master) | 286 | static inline void spi_master_put(struct spi_master *master) |
287 | { | 287 | { |
288 | if (master) | 288 | if (master) |
289 | class_device_put(&master->cdev); | 289 | put_device(&master->dev); |
290 | } | 290 | } |
291 | 291 | ||
292 | 292 | ||