Commit 43187902 authored by Linus Torvalds's avatar Linus Torvalds

Merge master.kernel.org:/pub/scm/linux/kernel/git/gregkh/driver-2.6

* master.kernel.org:/pub/scm/linux/kernel/git/gregkh/driver-2.6:
  Revert "Driver core: convert SPI code to use struct device"
parents 21eb4fa1 07b24630
...@@ -1234,7 +1234,7 @@ static int init_queue(struct driver_data *drv_data) ...@@ -1234,7 +1234,7 @@ static int init_queue(struct driver_data *drv_data)
INIT_WORK(&drv_data->pump_messages, pump_messages); INIT_WORK(&drv_data->pump_messages, pump_messages);
drv_data->workqueue = create_singlethread_workqueue( drv_data->workqueue = create_singlethread_workqueue(
drv_data->master->dev.parent->bus_id); drv_data->master->cdev.dev->bus_id);
if (drv_data->workqueue == NULL) if (drv_data->workqueue == NULL)
return -EBUSY; return -EBUSY;
......
...@@ -193,7 +193,7 @@ struct spi_device *__init_or_module ...@@ -193,7 +193,7 @@ struct spi_device *__init_or_module
spi_new_device(struct spi_master *master, struct spi_board_info *chip) spi_new_device(struct spi_master *master, struct spi_board_info *chip)
{ {
struct spi_device *proxy; struct spi_device *proxy;
struct device *dev = &master->dev; struct device *dev = master->cdev.dev;
int status; int status;
/* NOTE: caller did any chip->bus_num checks necessary */ /* 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,7 +215,7 @@ spi_new_device(struct spi_master *master, struct spi_board_info *chip)
proxy->modalias = chip->modalias; proxy->modalias = chip->modalias;
snprintf(proxy->dev.bus_id, sizeof proxy->dev.bus_id, snprintf(proxy->dev.bus_id, sizeof proxy->dev.bus_id,
"%s.%u", master->dev.bus_id, "%s.%u", master->cdev.class_id,
chip->chip_select); chip->chip_select);
proxy->dev.parent = dev; proxy->dev.parent = dev;
proxy->dev.bus = &spi_bus_type; proxy->dev.bus = &spi_bus_type;
...@@ -290,7 +290,7 @@ static void __init_or_module ...@@ -290,7 +290,7 @@ static void __init_or_module
scan_boardinfo(struct spi_master *master) scan_boardinfo(struct spi_master *master)
{ {
struct boardinfo *bi; struct boardinfo *bi;
struct device *dev = master->dev.parent; struct device *dev = master->cdev.dev;
down(&board_lock); down(&board_lock);
list_for_each_entry(bi, &board_list, list) { list_for_each_entry(bi, &board_list, list) {
...@@ -319,18 +319,18 @@ scan_boardinfo(struct spi_master *master) ...@@ -319,18 +319,18 @@ scan_boardinfo(struct spi_master *master)
/*-------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------*/
static void spi_master_release(struct device *dev) static void spi_master_release(struct class_device *cdev)
{ {
struct spi_master *master; struct spi_master *master;
master = container_of(dev, struct spi_master, dev); master = container_of(cdev, struct spi_master, cdev);
kfree(master); kfree(master);
} }
static struct class spi_master_class = { static struct class spi_master_class = {
.name = "spi_master", .name = "spi_master",
.owner = THIS_MODULE, .owner = THIS_MODULE,
.dev_release = spi_master_release, .release = spi_master_release,
}; };
...@@ -364,9 +364,9 @@ spi_alloc_master(struct device *dev, unsigned size) ...@@ -364,9 +364,9 @@ spi_alloc_master(struct device *dev, unsigned size)
if (!master) if (!master)
return NULL; return NULL;
device_initialize(&master->dev); class_device_initialize(&master->cdev);
master->dev.class = &spi_master_class; master->cdev.class = &spi_master_class;
master->dev.parent = get_device(dev); master->cdev.dev = get_device(dev);
spi_master_set_devdata(master, &master[1]); spi_master_set_devdata(master, &master[1]);
return master; return master;
...@@ -396,7 +396,7 @@ int __init_or_module ...@@ -396,7 +396,7 @@ int __init_or_module
spi_register_master(struct spi_master *master) spi_register_master(struct spi_master *master)
{ {
static atomic_t dyn_bus_id = ATOMIC_INIT((1<<16) - 1); static atomic_t dyn_bus_id = ATOMIC_INIT((1<<16) - 1);
struct device *dev = master->dev.parent; struct device *dev = master->cdev.dev;
int status = -ENODEV; int status = -ENODEV;
int dynamic = 0; int dynamic = 0;
...@@ -412,12 +412,12 @@ spi_register_master(struct spi_master *master) ...@@ -412,12 +412,12 @@ spi_register_master(struct spi_master *master)
/* register the device, then userspace will see it. /* register the device, then userspace will see it.
* registration fails if the bus ID is in use. * registration fails if the bus ID is in use.
*/ */
snprintf(master->dev.bus_id, sizeof master->dev.bus_id, snprintf(master->cdev.class_id, sizeof master->cdev.class_id,
"spi%u", master->bus_num); "spi%u", master->bus_num);
status = device_add(&master->dev); status = class_device_add(&master->cdev);
if (status < 0) if (status < 0)
goto done; goto done;
dev_dbg(dev, "registered master %s%s\n", master->dev.bus_id, dev_dbg(dev, "registered master %s%s\n", master->cdev.class_id,
dynamic ? " (dynamic)" : ""); dynamic ? " (dynamic)" : "");
/* populate children from any spi device tables */ /* populate children from any spi device tables */
...@@ -449,8 +449,8 @@ void spi_unregister_master(struct spi_master *master) ...@@ -449,8 +449,8 @@ void spi_unregister_master(struct spi_master *master)
{ {
int dummy; int dummy;
dummy = device_for_each_child(&master->dev, NULL, __unregister); dummy = device_for_each_child(master->cdev.dev, NULL, __unregister);
device_unregister(&master->dev); class_device_unregister(&master->cdev);
} }
EXPORT_SYMBOL_GPL(spi_unregister_master); EXPORT_SYMBOL_GPL(spi_unregister_master);
...@@ -471,7 +471,7 @@ struct spi_master *spi_busnum_to_master(u16 bus_num) ...@@ -471,7 +471,7 @@ struct spi_master *spi_busnum_to_master(u16 bus_num)
down(&spi_master_class.sem); down(&spi_master_class.sem);
list_for_each_entry(cdev, &spi_master_class.children, node) { list_for_each_entry(cdev, &spi_master_class.children, node) {
m = container_of(cdev, struct spi_master, dev.kobj); m = container_of(cdev, struct spi_master, cdev);
if (m->bus_num == bus_num) { if (m->bus_num == bus_num) {
master = spi_master_get(m); master = spi_master_get(m);
break; break;
......
...@@ -479,7 +479,7 @@ int spi_bitbang_start(struct spi_bitbang *bitbang) ...@@ -479,7 +479,7 @@ int spi_bitbang_start(struct spi_bitbang *bitbang)
/* this task is the only thing to touch the SPI bits */ /* this task is the only thing to touch the SPI bits */
bitbang->busy = 0; bitbang->busy = 0;
bitbang->workqueue = create_singlethread_workqueue( bitbang->workqueue = create_singlethread_workqueue(
bitbang->master->dev.parent->bus_id); bitbang->master->cdev.dev->bus_id);
if (bitbang->workqueue == NULL) { if (bitbang->workqueue == NULL) {
status = -EBUSY; status = -EBUSY;
goto err1; goto err1;
...@@ -513,14 +513,14 @@ int spi_bitbang_stop(struct spi_bitbang *bitbang) ...@@ -513,14 +513,14 @@ int spi_bitbang_stop(struct spi_bitbang *bitbang)
while (!list_empty(&bitbang->queue) && limit--) { while (!list_empty(&bitbang->queue) && limit--) {
spin_unlock_irq(&bitbang->lock); spin_unlock_irq(&bitbang->lock);
dev_dbg(&bitbang->master->dev, "wait for queue\n"); dev_dbg(bitbang->master->cdev.dev, "wait for queue\n");
msleep(10); msleep(10);
spin_lock_irq(&bitbang->lock); spin_lock_irq(&bitbang->lock);
} }
spin_unlock_irq(&bitbang->lock); spin_unlock_irq(&bitbang->lock);
if (!list_empty(&bitbang->queue)) { if (!list_empty(&bitbang->queue)) {
dev_err(&bitbang->master->dev, "queue didn't empty\n"); dev_err(bitbang->master->cdev.dev, "queue didn't empty\n");
return -EBUSY; return -EBUSY;
} }
......
...@@ -246,7 +246,7 @@ static void butterfly_attach(struct parport *p) ...@@ -246,7 +246,7 @@ static void butterfly_attach(struct parport *p)
* and no way to be selective about what it binds to. * and no way to be selective about what it binds to.
*/ */
/* FIXME where should master->dev.parent come from? /* FIXME where should master->cdev.dev come from?
* e.g. /sys/bus/pnp0/00:0b, some PCI thing, etc * e.g. /sys/bus/pnp0/00:0b, some PCI thing, etc
* setting up a platform device like this is an ugly kluge... * setting up a platform device like this is an ugly kluge...
*/ */
...@@ -386,7 +386,7 @@ static void butterfly_detach(struct parport *p) ...@@ -386,7 +386,7 @@ static void butterfly_detach(struct parport *p)
butterfly = NULL; butterfly = NULL;
/* stop() unregisters child devices too */ /* stop() unregisters child devices too */
pdev = to_platform_device(pp->bitbang.master->dev.parent); pdev = to_platform_device(pp->bitbang.master->cdev.dev);
status = spi_bitbang_stop(&pp->bitbang); status = spi_bitbang_stop(&pp->bitbang);
/* turn off VCC */ /* turn off VCC */
......
...@@ -170,7 +170,7 @@ static inline void spi_unregister_driver(struct spi_driver *sdrv) ...@@ -170,7 +170,7 @@ static inline void spi_unregister_driver(struct spi_driver *sdrv)
* message's completion function when the transaction completes. * message's completion function when the transaction completes.
*/ */
struct spi_master { struct spi_master {
struct device dev; struct class_device cdev;
/* other than negative (== assign one dynamically), bus_num is fully /* other than negative (== assign one dynamically), bus_num is fully
* board-specific. usually that simplifies to being SOC-specific. * board-specific. usually that simplifies to being SOC-specific.
...@@ -216,17 +216,17 @@ struct spi_master { ...@@ -216,17 +216,17 @@ struct spi_master {
static inline void *spi_master_get_devdata(struct spi_master *master) static inline void *spi_master_get_devdata(struct spi_master *master)
{ {
return dev_get_drvdata(&master->dev); return class_get_devdata(&master->cdev);
} }
static inline void spi_master_set_devdata(struct spi_master *master, void *data) static inline void spi_master_set_devdata(struct spi_master *master, void *data)
{ {
dev_set_drvdata(&master->dev, data); class_set_devdata(&master->cdev, data);
} }
static inline struct spi_master *spi_master_get(struct spi_master *master) static inline struct spi_master *spi_master_get(struct spi_master *master)
{ {
if (!master || !get_device(&master->dev)) if (!master || !class_device_get(&master->cdev))
return NULL; return NULL;
return master; return master;
} }
...@@ -234,7 +234,7 @@ static inline struct spi_master *spi_master_get(struct spi_master *master) ...@@ -234,7 +234,7 @@ static inline struct spi_master *spi_master_get(struct spi_master *master)
static inline void spi_master_put(struct spi_master *master) static inline void spi_master_put(struct spi_master *master)
{ {
if (master) if (master)
put_device(&master->dev); class_device_put(&master->cdev);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment