diff options
Diffstat (limited to 'drivers/spi')
-rw-r--r-- | drivers/spi/spi.c | 25 | ||||
-rw-r--r-- | drivers/spi/spi_bitbang.c | 2 | ||||
-rw-r--r-- | drivers/spi/spi_butterfly.c | 2 |
3 files changed, 16 insertions, 13 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; |
diff --git a/drivers/spi/spi_bitbang.c b/drivers/spi/spi_bitbang.c index 08c1c57c6128..57289b61d0be 100644 --- a/drivers/spi/spi_bitbang.c +++ b/drivers/spi/spi_bitbang.c | |||
@@ -196,7 +196,7 @@ int spi_bitbang_setup(struct spi_device *spi) | |||
196 | return -EINVAL; | 196 | return -EINVAL; |
197 | 197 | ||
198 | if (!cs) { | 198 | if (!cs) { |
199 | cs = kzalloc(sizeof *cs, SLAB_KERNEL); | 199 | cs = kzalloc(sizeof *cs, GFP_KERNEL); |
200 | if (!cs) | 200 | if (!cs) |
201 | return -ENOMEM; | 201 | return -ENOMEM; |
202 | spi->controller_state = cs; | 202 | spi->controller_state = cs; |
diff --git a/drivers/spi/spi_butterfly.c b/drivers/spi/spi_butterfly.c index c2f601f8e4f2..312987a03210 100644 --- a/drivers/spi/spi_butterfly.c +++ b/drivers/spi/spi_butterfly.c | |||
@@ -251,6 +251,8 @@ static void butterfly_attach(struct parport *p) | |||
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 | */ |
253 | pdev = platform_device_register_simple("butterfly", -1, NULL, 0); | 253 | pdev = platform_device_register_simple("butterfly", -1, NULL, 0); |
254 | if (IS_ERR(pdev)) | ||
255 | return; | ||
254 | 256 | ||
255 | master = spi_alloc_master(&pdev->dev, sizeof *pp); | 257 | master = spi_alloc_master(&pdev->dev, sizeof *pp); |
256 | if (!master) { | 258 | if (!master) { |