diff options
author | Greg Kroah-Hartman <gregkh@suse.de> | 2007-02-08 00:34:08 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2007-02-08 00:34:08 -0500 |
commit | 07b2463046247ce580ff9b37e91394f2f6424768 (patch) | |
tree | 6f6e79f132a2580c455a533f864492f0b34e54e2 /drivers/spi/spi.c | |
parent | c4184f117af7441fb83bc413d2214d92920e0289 (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/spi.c')
-rw-r--r-- | drivers/spi/spi.c | 32 |
1 files changed, 16 insertions, 16 deletions
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 | |||
193 | spi_new_device(struct spi_master *master, struct spi_board_info *chip) | 193 | spi_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 | |||
290 | scan_boardinfo(struct spi_master *master) | 290 | scan_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 | ||
322 | static void spi_master_release(struct device *dev) | 322 | static 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 | ||
330 | static struct class spi_master_class = { | 330 | static 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 | |||
396 | spi_register_master(struct spi_master *master) | 396 | spi_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 | } |
455 | EXPORT_SYMBOL_GPL(spi_unregister_master); | 455 | EXPORT_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; |