aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/spi
diff options
context:
space:
mode:
authorTony Jones <tonyj@suse.de>2007-10-16 04:27:48 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-10-16 12:43:10 -0400
commit49dce689ad4ef0fd1f970ef762168e4bd46f69a3 (patch)
treee9e6d07c704118d82a638ae1f01a7ef5b59dd68b /drivers/spi
parentcd58310d775fc10cc820b27c10f619187b8c4133 (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 'drivers/spi')
-rw-r--r--drivers/spi/atmel_spi.c14
-rw-r--r--drivers/spi/mpc52xx_psc_spi.c2
-rw-r--r--drivers/spi/pxa2xx_spi.c2
-rw-r--r--drivers/spi/spi.c36
-rw-r--r--drivers/spi/spi_bfin5xx.c2
-rw-r--r--drivers/spi/spi_bitbang.c2
-rw-r--r--drivers/spi/spi_imx.c2
-rw-r--r--drivers/spi/spi_lm70llp.c2
-rw-r--r--drivers/spi/spi_txx9.c2
9 files changed, 32 insertions, 32 deletions
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
341static void spi_master_release(struct class_device *cdev) 341static 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
349static struct class spi_master_class = { 349static 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);
415int spi_register_master(struct spi_master *master) 415int 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}
484EXPORT_SYMBOL_GPL(spi_unregister_master); 484EXPORT_SYMBOL_GPL(spi_unregister_master);
485 485
@@ -495,13 +495,13 @@ EXPORT_SYMBOL_GPL(spi_unregister_master);
495 */ 495 */
496struct spi_master *spi_busnum_to_master(u16 bus_num) 496struct 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;