diff options
Diffstat (limited to 'drivers/spi/spi.c')
-rw-r--r-- | drivers/spi/spi.c | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index c3c0626f550b..270e6211c2e3 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c | |||
@@ -360,12 +360,13 @@ spi_alloc_master(struct device *dev, unsigned size) | |||
360 | if (!dev) | 360 | if (!dev) |
361 | return NULL; | 361 | return NULL; |
362 | 362 | ||
363 | master = kzalloc(size + sizeof *master, SLAB_KERNEL); | 363 | master = kzalloc(size + sizeof *master, GFP_KERNEL); |
364 | if (!master) | 364 | if (!master) |
365 | return NULL; | 365 | return NULL; |
366 | 366 | ||
367 | class_device_initialize(&master->cdev); | 367 | class_device_initialize(&master->cdev); |
368 | master->cdev.class = &spi_master_class; | 368 | master->cdev.class = &spi_master_class; |
369 | kobj_set_kset_s(&master->cdev, spi_master_class.subsys); | ||
369 | master->cdev.dev = get_device(dev); | 370 | master->cdev.dev = get_device(dev); |
370 | spi_master_set_devdata(master, &master[1]); | 371 | spi_master_set_devdata(master, &master[1]); |
371 | 372 | ||
@@ -447,7 +448,9 @@ static int __unregister(struct device *dev, void *unused) | |||
447 | */ | 448 | */ |
448 | void spi_unregister_master(struct spi_master *master) | 449 | void spi_unregister_master(struct spi_master *master) |
449 | { | 450 | { |
450 | (void) device_for_each_child(master->cdev.dev, NULL, __unregister); | 451 | int dummy; |
452 | |||
453 | dummy = device_for_each_child(master->cdev.dev, NULL, __unregister); | ||
451 | class_device_unregister(&master->cdev); | 454 | class_device_unregister(&master->cdev); |
452 | } | 455 | } |
453 | EXPORT_SYMBOL_GPL(spi_unregister_master); | 456 | EXPORT_SYMBOL_GPL(spi_unregister_master); |
@@ -463,15 +466,13 @@ EXPORT_SYMBOL_GPL(spi_unregister_master); | |||
463 | */ | 466 | */ |
464 | struct spi_master *spi_busnum_to_master(u16 bus_num) | 467 | struct spi_master *spi_busnum_to_master(u16 bus_num) |
465 | { | 468 | { |
466 | if (bus_num) { | 469 | char name[9]; |
467 | char name[8]; | 470 | struct kobject *bus; |
468 | struct kobject *bus; | 471 | |
469 | 472 | snprintf(name, sizeof name, "spi%u", bus_num); | |
470 | snprintf(name, sizeof name, "spi%u", bus_num); | 473 | bus = kset_find_obj(&spi_master_class.subsys.kset, name); |
471 | bus = kset_find_obj(&spi_master_class.subsys.kset, name); | 474 | if (bus) |
472 | if (bus) | 475 | return container_of(bus, struct spi_master, cdev.kobj); |
473 | return container_of(bus, struct spi_master, cdev.kobj); | ||
474 | } | ||
475 | return NULL; | 476 | return NULL; |
476 | } | 477 | } |
477 | EXPORT_SYMBOL_GPL(spi_busnum_to_master); | 478 | EXPORT_SYMBOL_GPL(spi_busnum_to_master); |
@@ -607,7 +608,7 @@ static int __init spi_init(void) | |||
607 | { | 608 | { |
608 | int status; | 609 | int status; |
609 | 610 | ||
610 | buf = kmalloc(SPI_BUFSIZ, SLAB_KERNEL); | 611 | buf = kmalloc(SPI_BUFSIZ, GFP_KERNEL); |
611 | if (!buf) { | 612 | if (!buf) { |
612 | status = -ENOMEM; | 613 | status = -ENOMEM; |
613 | goto err0; | 614 | goto err0; |