the device was being freed from the exit and not the remove routine this caused a kernel oops when unloading the protocol driver module in the case where the controller driver was never loaded to begin with
Signed-off-by: Russ Gorby <russ.go...@intel.com> --- drivers/serial/ifx6x60.c | 36 +++++++++++++++++------------------- 1 files changed, 17 insertions(+), 19 deletions(-) diff --git a/drivers/serial/ifx6x60.c b/drivers/serial/ifx6x60.c index f37f2cd..db84fa8 100644 --- a/drivers/serial/ifx6x60.c +++ b/drivers/serial/ifx6x60.c @@ -1674,13 +1674,28 @@ error_ret: * ifx_spi_spi_remove - SPI device was removed * @spi: SPI device * - * FIXME: We should be shutting the device down here not in - * the module unload path. + * FIXME: Currently this assumes a single ifx device */ static int ifx_spi_spi_remove(struct spi_device *spi) { + struct ifx_spi_device *ifx_dev = saved_ifx_dev; + dev_dbg(&spi->dev, "%s called", __func__); + /* stop activity */ + tasklet_kill(&ifx_dev->io_work_tasklet); + /* free irq */ + free_irq(gpio_to_irq(ifx_dev->gpio.reset_out), (void *)ifx_dev); + free_irq(gpio_to_irq(ifx_dev->gpio.srdy), (void *)ifx_dev); + + gpio_free(ifx_dev->gpio.srdy); + gpio_free(ifx_dev->gpio.mrdy); + gpio_free(ifx_dev->gpio.reset); + gpio_free(ifx_dev->gpio.po); + gpio_free(ifx_dev->gpio.reset_out); + + /* free allocations */ + _ifx_spi_free_device(); return 0; } @@ -1759,25 +1774,8 @@ static const struct spi_driver ifx_spi_driver = { static void __exit ifx_spi_exit(void) { - struct ifx_spi_device *ifx_dev = saved_ifx_dev; - pr_debug("%s called", __func__); - /* stop activity */ - tasklet_kill(&ifx_dev->io_work_tasklet); - /* free irq */ - free_irq(gpio_to_irq(ifx_dev->gpio.reset_out), (void *)ifx_dev); - free_irq(gpio_to_irq(ifx_dev->gpio.srdy), (void *)ifx_dev); - - gpio_free(ifx_dev->gpio.srdy); - gpio_free(ifx_dev->gpio.mrdy); - gpio_free(ifx_dev->gpio.reset); - gpio_free(ifx_dev->gpio.po); - gpio_free(ifx_dev->gpio.reset_out); - - /* free allocations */ - _ifx_spi_free_device(); - /* unregister */ tty_unregister_driver(tty_drv); spi_unregister_driver((void *)&ifx_spi_driver); -- 1.6.0.6 _______________________________________________ MeeGo-kernel mailing list MeeGo-kernel@lists.meego.com http://lists.meego.com/listinfo/meego-kernel