diff options
Diffstat (limited to 'drivers/spi/spi.c')
-rw-r--r-- | drivers/spi/spi.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index 89769ce16f88..b31f4431849b 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c | |||
@@ -457,10 +457,11 @@ done: | |||
457 | EXPORT_SYMBOL_GPL(spi_register_master); | 457 | EXPORT_SYMBOL_GPL(spi_register_master); |
458 | 458 | ||
459 | 459 | ||
460 | static int __unregister(struct device *dev, void *unused) | 460 | static int __unregister(struct device *dev, void *master_dev) |
461 | { | 461 | { |
462 | /* note: before about 2.6.14-rc1 this would corrupt memory: */ | 462 | /* note: before about 2.6.14-rc1 this would corrupt memory: */ |
463 | spi_unregister_device(to_spi_device(dev)); | 463 | if (dev != master_dev) |
464 | spi_unregister_device(to_spi_device(dev)); | ||
464 | return 0; | 465 | return 0; |
465 | } | 466 | } |
466 | 467 | ||
@@ -478,7 +479,8 @@ void spi_unregister_master(struct spi_master *master) | |||
478 | { | 479 | { |
479 | int dummy; | 480 | int dummy; |
480 | 481 | ||
481 | dummy = device_for_each_child(master->dev.parent, NULL, __unregister); | 482 | dummy = device_for_each_child(master->dev.parent, &master->dev, |
483 | __unregister); | ||
482 | device_unregister(&master->dev); | 484 | device_unregister(&master->dev); |
483 | } | 485 | } |
484 | EXPORT_SYMBOL_GPL(spi_unregister_master); | 486 | EXPORT_SYMBOL_GPL(spi_unregister_master); |