aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/spi/spi.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/spi/spi.c')
-rw-r--r--drivers/spi/spi.c36
1 files changed, 18 insertions, 18 deletions
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;