aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/spi/spi.c
diff options
context:
space:
mode:
authorStephen Street <[email protected]>2006-02-21 02:27:56 +0000
committerLinus Torvalds <[email protected]>2006-02-21 04:00:09 +0000
commitd2799f083dcad0413ad1a396e9bc32d9afb70535 (patch)
treee3ff753888f2e03437b9ab951269d213fe522e20 /drivers/spi/spi.c
parent[PATCH] cfi_cmdset_0001: fix range for cache invalidation (diff)
downloadkernel-d2799f083dcad0413ad1a396e9bc32d9afb70535.tar.gz
kernel-d2799f083dcad0413ad1a396e9bc32d9afb70535.zip
[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 <[email protected]> Signed-off-by: David Brownell <[email protected]> Cc: Greg KH <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
Diffstat (limited to 'drivers/spi/spi.c')
-rw-r--r--drivers/spi/spi.c5
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)
int value;
struct spi_driver *drv = to_spi_driver(dev->driver);
- if (!drv->suspend)
+ if (!drv || !drv->suspend)
return 0;
/* suspend will stop irqs and dma; no more i/o */
@@ -105,7 +105,7 @@ static int spi_resume(struct device *dev)
int value;
struct spi_driver *drv = to_spi_driver(dev->driver);
- if (!drv->resume)
+ if (!drv || !drv->resume)
return 0;
/* resume may restart the i/o queue */
@@ -449,7 +449,6 @@ void spi_unregister_master(struct spi_master *master)
{
(void) device_for_each_child(master->cdev.dev, NULL, __unregister);
class_device_unregister(&master->cdev);
- master->cdev.dev = NULL;
}
EXPORT_SYMBOL_GPL(spi_unregister_master);