aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/spi
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@suse.de>2007-02-08 00:34:08 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2007-02-08 00:34:08 -0500
commit07b2463046247ce580ff9b37e91394f2f6424768 (patch)
tree6f6e79f132a2580c455a533f864492f0b34e54e2 /drivers/spi
parentc4184f117af7441fb83bc413d2214d92920e0289 (diff)
Revert "Driver core: convert SPI code to use struct device"
This reverts commit 2943ecf2ed32632473c06f1975db47a7aa98c10f. This should go through the SPI maintainer, it was my fault that it did not. Especially as it conflicts with other patches he has pending. Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/spi')
-rw-r--r--drivers/spi/pxa2xx_spi.c2
-rw-r--r--drivers/spi/spi.c32
-rw-r--r--drivers/spi/spi_bitbang.c6
-rw-r--r--drivers/spi/spi_butterfly.c4
4 files changed, 22 insertions, 22 deletions
diff --git a/drivers/spi/pxa2xx_spi.c b/drivers/spi/pxa2xx_spi.c
index dccdc50b0296..8b41f9cc2560 100644
--- a/drivers/spi/pxa2xx_spi.c
+++ b/drivers/spi/pxa2xx_spi.c
@@ -1234,7 +1234,7 @@ static int init_queue(struct driver_data *drv_data)
1234 1234
1235 INIT_WORK(&drv_data->pump_messages, pump_messages); 1235 INIT_WORK(&drv_data->pump_messages, pump_messages);
1236 drv_data->workqueue = create_singlethread_workqueue( 1236 drv_data->workqueue = create_singlethread_workqueue(
1237 drv_data->master->dev.parent->bus_id); 1237 drv_data->master->cdev.dev->bus_id);
1238 if (drv_data->workqueue == NULL) 1238 if (drv_data->workqueue == NULL)
1239 return -EBUSY; 1239 return -EBUSY;
1240 1240
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index 35d8c01b42ac..6307428d2c94 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -193,7 +193,7 @@ struct spi_device *__init_or_module
193spi_new_device(struct spi_master *master, struct spi_board_info *chip) 193spi_new_device(struct spi_master *master, struct spi_board_info *chip)
194{ 194{
195 struct spi_device *proxy; 195 struct spi_device *proxy;
196 struct device *dev = &master->dev; 196 struct device *dev = master->cdev.dev;
197 int status; 197 int status;
198 198
199 /* NOTE: caller did any chip->bus_num checks necessary */ 199 /* NOTE: caller did any chip->bus_num checks necessary */
@@ -215,7 +215,7 @@ spi_new_device(struct spi_master *master, struct spi_board_info *chip)
215 proxy->modalias = chip->modalias; 215 proxy->modalias = chip->modalias;
216 216
217 snprintf(proxy->dev.bus_id, sizeof proxy->dev.bus_id, 217 snprintf(proxy->dev.bus_id, sizeof proxy->dev.bus_id,
218 "%s.%u", master->dev.bus_id, 218 "%s.%u", master->cdev.class_id,
219 chip->chip_select); 219 chip->chip_select);
220 proxy->dev.parent = dev; 220 proxy->dev.parent = dev;
221 proxy->dev.bus = &spi_bus_type; 221 proxy->dev.bus = &spi_bus_type;
@@ -290,7 +290,7 @@ static void __init_or_module
290scan_boardinfo(struct spi_master *master) 290scan_boardinfo(struct spi_master *master)
291{ 291{
292 struct boardinfo *bi; 292 struct boardinfo *bi;
293 struct device *dev = master->dev.parent; 293 struct device *dev = master->cdev.dev;
294 294
295 down(&board_lock); 295 down(&board_lock);
296 list_for_each_entry(bi, &board_list, list) { 296 list_for_each_entry(bi, &board_list, list) {
@@ -319,18 +319,18 @@ scan_boardinfo(struct spi_master *master)
319 319
320/*-------------------------------------------------------------------------*/ 320/*-------------------------------------------------------------------------*/
321 321
322static void spi_master_release(struct device *dev) 322static void spi_master_release(struct class_device *cdev)
323{ 323{
324 struct spi_master *master; 324 struct spi_master *master;
325 325
326 master = container_of(dev, struct spi_master, dev); 326 master = container_of(cdev, struct spi_master, cdev);
327 kfree(master); 327 kfree(master);
328} 328}
329 329
330static struct class spi_master_class = { 330static struct class spi_master_class = {
331 .name = "spi_master", 331 .name = "spi_master",
332 .owner = THIS_MODULE, 332 .owner = THIS_MODULE,
333 .dev_release = spi_master_release, 333 .release = spi_master_release,
334}; 334};
335 335
336 336
@@ -364,9 +364,9 @@ spi_alloc_master(struct device *dev, unsigned size)
364 if (!master) 364 if (!master)
365 return NULL; 365 return NULL;
366 366
367 device_initialize(&master->dev); 367 class_device_initialize(&master->cdev);
368 master->dev.class = &spi_master_class; 368 master->cdev.class = &spi_master_class;
369 master->dev.parent = get_device(dev); 369 master->cdev.dev = get_device(dev);
370 spi_master_set_devdata(master, &master[1]); 370 spi_master_set_devdata(master, &master[1]);
371 371
372 return master; 372 return master;
@@ -396,7 +396,7 @@ int __init_or_module
396spi_register_master(struct spi_master *master) 396spi_register_master(struct spi_master *master)
397{ 397{
398 static atomic_t dyn_bus_id = ATOMIC_INIT((1<<16) - 1); 398 static atomic_t dyn_bus_id = ATOMIC_INIT((1<<16) - 1);
399 struct device *dev = master->dev.parent; 399 struct device *dev = master->cdev.dev;
400 int status = -ENODEV; 400 int status = -ENODEV;
401 int dynamic = 0; 401 int dynamic = 0;
402 402
@@ -412,12 +412,12 @@ spi_register_master(struct spi_master *master)
412 /* register the device, then userspace will see it. 412 /* register the device, then userspace will see it.
413 * registration fails if the bus ID is in use. 413 * registration fails if the bus ID is in use.
414 */ 414 */
415 snprintf(master->dev.bus_id, sizeof master->dev.bus_id, 415 snprintf(master->cdev.class_id, sizeof master->cdev.class_id,
416 "spi%u", master->bus_num); 416 "spi%u", master->bus_num);
417 status = device_add(&master->dev); 417 status = class_device_add(&master->cdev);
418 if (status < 0) 418 if (status < 0)
419 goto done; 419 goto done;
420 dev_dbg(dev, "registered master %s%s\n", master->dev.bus_id, 420 dev_dbg(dev, "registered master %s%s\n", master->cdev.class_id,
421 dynamic ? " (dynamic)" : ""); 421 dynamic ? " (dynamic)" : "");
422 422
423 /* populate children from any spi device tables */ 423 /* populate children from any spi device tables */
@@ -449,8 +449,8 @@ void spi_unregister_master(struct spi_master *master)
449{ 449{
450 int dummy; 450 int dummy;
451 451
452 dummy = device_for_each_child(&master->dev, NULL, __unregister); 452 dummy = device_for_each_child(master->cdev.dev, NULL, __unregister);
453 device_unregister(&master->dev); 453 class_device_unregister(&master->cdev);
454} 454}
455EXPORT_SYMBOL_GPL(spi_unregister_master); 455EXPORT_SYMBOL_GPL(spi_unregister_master);
456 456
@@ -471,7 +471,7 @@ struct spi_master *spi_busnum_to_master(u16 bus_num)
471 471
472 down(&spi_master_class.sem); 472 down(&spi_master_class.sem);
473 list_for_each_entry(cdev, &spi_master_class.children, node) { 473 list_for_each_entry(cdev, &spi_master_class.children, node) {
474 m = container_of(cdev, struct spi_master, dev.kobj); 474 m = container_of(cdev, struct spi_master, cdev);
475 if (m->bus_num == bus_num) { 475 if (m->bus_num == bus_num) {
476 master = spi_master_get(m); 476 master = spi_master_get(m);
477 break; 477 break;
diff --git a/drivers/spi/spi_bitbang.c b/drivers/spi/spi_bitbang.c
index 4638e6c83715..57289b61d0be 100644
--- a/drivers/spi/spi_bitbang.c
+++ b/drivers/spi/spi_bitbang.c
@@ -479,7 +479,7 @@ int spi_bitbang_start(struct spi_bitbang *bitbang)
479 /* this task is the only thing to touch the SPI bits */ 479 /* this task is the only thing to touch the SPI bits */
480 bitbang->busy = 0; 480 bitbang->busy = 0;
481 bitbang->workqueue = create_singlethread_workqueue( 481 bitbang->workqueue = create_singlethread_workqueue(
482 bitbang->master->dev.parent->bus_id); 482 bitbang->master->cdev.dev->bus_id);
483 if (bitbang->workqueue == NULL) { 483 if (bitbang->workqueue == NULL) {
484 status = -EBUSY; 484 status = -EBUSY;
485 goto err1; 485 goto err1;
@@ -513,14 +513,14 @@ int spi_bitbang_stop(struct spi_bitbang *bitbang)
513 while (!list_empty(&bitbang->queue) && limit--) { 513 while (!list_empty(&bitbang->queue) && limit--) {
514 spin_unlock_irq(&bitbang->lock); 514 spin_unlock_irq(&bitbang->lock);
515 515
516 dev_dbg(&bitbang->master->dev, "wait for queue\n"); 516 dev_dbg(bitbang->master->cdev.dev, "wait for queue\n");
517 msleep(10); 517 msleep(10);
518 518
519 spin_lock_irq(&bitbang->lock); 519 spin_lock_irq(&bitbang->lock);
520 } 520 }
521 spin_unlock_irq(&bitbang->lock); 521 spin_unlock_irq(&bitbang->lock);
522 if (!list_empty(&bitbang->queue)) { 522 if (!list_empty(&bitbang->queue)) {
523 dev_err(&bitbang->master->dev, "queue didn't empty\n"); 523 dev_err(bitbang->master->cdev.dev, "queue didn't empty\n");
524 return -EBUSY; 524 return -EBUSY;
525 } 525 }
526 526
diff --git a/drivers/spi/spi_butterfly.c b/drivers/spi/spi_butterfly.c
index 31b7970ae463..312987a03210 100644
--- a/drivers/spi/spi_butterfly.c
+++ b/drivers/spi/spi_butterfly.c
@@ -246,7 +246,7 @@ static void butterfly_attach(struct parport *p)
246 * and no way to be selective about what it binds to. 246 * and no way to be selective about what it binds to.
247 */ 247 */
248 248
249 /* FIXME where should master->dev.parent come from? 249 /* FIXME where should master->cdev.dev come from?
250 * e.g. /sys/bus/pnp0/00:0b, some PCI thing, etc 250 * e.g. /sys/bus/pnp0/00:0b, some PCI thing, etc
251 * setting up a platform device like this is an ugly kluge... 251 * setting up a platform device like this is an ugly kluge...
252 */ 252 */
@@ -386,7 +386,7 @@ static void butterfly_detach(struct parport *p)
386 butterfly = NULL; 386 butterfly = NULL;
387 387
388 /* stop() unregisters child devices too */ 388 /* stop() unregisters child devices too */
389 pdev = to_platform_device(pp->bitbang.master->dev.parent); 389 pdev = to_platform_device(pp->bitbang.master->cdev.dev);
390 status = spi_bitbang_stop(&pp->bitbang); 390 status = spi_bitbang_stop(&pp->bitbang);
391 391
392 /* turn off VCC */ 392 /* turn off VCC */