diff options
author | Stephen Street <stephen@streetfiresound.com> | 2006-02-20 21:27:56 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-02-20 23:00:09 -0500 |
commit | d2799f083dcad0413ad1a396e9bc32d9afb70535 (patch) | |
tree | e3ff753888f2e03437b9ab951269d213fe522e20 /drivers/spi | |
parent | d86d43706a27bb87c2873de369f94a10f8758063 (diff) |
[PATCH] spi: Fix modular master driver remove and device suspend/remove
Fix two problems in the spi subsystem:
1) spi subsystem core dumps when modular spi master is unloaded.
2) spi subsystem core dumps when spi slave device is suspended/resumed and
module slave driver is not loaded.
Signed-off-by: Stephen Street <stephen@streetfiresound.com>
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Cc: Greg KH <greg@kroah.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/spi')
-rw-r--r-- | drivers/spi/spi.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index 791c4dc550ae..94f5e8ed83a7 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c | |||
@@ -90,7 +90,7 @@ static int spi_suspend(struct device *dev, pm_message_t message) | |||
90 | int value; | 90 | int value; |
91 | struct spi_driver *drv = to_spi_driver(dev->driver); | 91 | struct spi_driver *drv = to_spi_driver(dev->driver); |
92 | 92 | ||
93 | if (!drv->suspend) | 93 | if (!drv || !drv->suspend) |
94 | return 0; | 94 | return 0; |
95 | 95 | ||
96 | /* suspend will stop irqs and dma; no more i/o */ | 96 | /* suspend will stop irqs and dma; no more i/o */ |
@@ -105,7 +105,7 @@ static int spi_resume(struct device *dev) | |||
105 | int value; | 105 | int value; |
106 | struct spi_driver *drv = to_spi_driver(dev->driver); | 106 | struct spi_driver *drv = to_spi_driver(dev->driver); |
107 | 107 | ||
108 | if (!drv->resume) | 108 | if (!drv || !drv->resume) |
109 | return 0; | 109 | return 0; |
110 | 110 | ||
111 | /* resume may restart the i/o queue */ | 111 | /* resume may restart the i/o queue */ |
@@ -449,7 +449,6 @@ void spi_unregister_master(struct spi_master *master) | |||
449 | { | 449 | { |
450 | (void) device_for_each_child(master->cdev.dev, NULL, __unregister); | 450 | (void) device_for_each_child(master->cdev.dev, NULL, __unregister); |
451 | class_device_unregister(&master->cdev); | 451 | class_device_unregister(&master->cdev); |
452 | master->cdev.dev = NULL; | ||
453 | } | 452 | } |
454 | EXPORT_SYMBOL_GPL(spi_unregister_master); | 453 | EXPORT_SYMBOL_GPL(spi_unregister_master); |
455 | 454 | ||