Commit d2799f08 authored by Stephen Street's avatar Stephen Street Committed by Linus Torvalds

[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: default avatarStephen Street <stephen@streetfiresound.com>
Signed-off-by: default avatarDavid Brownell <dbrownell@users.sourceforge.net>
Cc: Greg KH <greg@kroah.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent d86d4370
...@@ -90,7 +90,7 @@ static int spi_suspend(struct device *dev, pm_message_t message) ...@@ -90,7 +90,7 @@ static int spi_suspend(struct device *dev, pm_message_t message)
int value; int value;
struct spi_driver *drv = to_spi_driver(dev->driver); struct spi_driver *drv = to_spi_driver(dev->driver);
if (!drv->suspend) if (!drv || !drv->suspend)
return 0; return 0;
/* suspend will stop irqs and dma; no more i/o */ /* suspend will stop irqs and dma; no more i/o */
...@@ -105,7 +105,7 @@ static int spi_resume(struct device *dev) ...@@ -105,7 +105,7 @@ static int spi_resume(struct device *dev)
int value; int value;
struct spi_driver *drv = to_spi_driver(dev->driver); struct spi_driver *drv = to_spi_driver(dev->driver);
if (!drv->resume) if (!drv || !drv->resume)
return 0; return 0;
/* resume may restart the i/o queue */ /* resume may restart the i/o queue */
...@@ -449,7 +449,6 @@ void spi_unregister_master(struct spi_master *master) ...@@ -449,7 +449,6 @@ void spi_unregister_master(struct spi_master *master)
{ {
(void) device_for_each_child(master->cdev.dev, NULL, __unregister); (void) device_for_each_child(master->cdev.dev, NULL, __unregister);
class_device_unregister(&master->cdev); class_device_unregister(&master->cdev);
master->cdev.dev = NULL;
} }
EXPORT_SYMBOL_GPL(spi_unregister_master); EXPORT_SYMBOL_GPL(spi_unregister_master);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment