spi: fsl-(e)spi: simplify cleanup code
authorHeiner Kallweit <hkallweit1@gmail.com>
Wed, 26 Aug 2015 19:21:53 +0000 (21:21 +0200)
committerMark Brown <broonie@kernel.org>
Fri, 28 Aug 2015 17:15:18 +0000 (18:15 +0100)
Now that most cleanup is done automatically the remove functions
can be significantly simplified.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/spi/spi-fsl-espi.c
drivers/spi/spi-fsl-lib.c
drivers/spi/spi-fsl-lib.h
drivers/spi/spi-fsl-spi.c

index f35eb2c46782666a761e89cf9c8412fb3474e445..fe54e5788245e1d955ff5a447f5b64960d6cb933 100644 (file)
@@ -797,11 +797,6 @@ err:
        return ret;
 }
 
-static int of_fsl_espi_remove(struct platform_device *dev)
-{
-       return mpc8xxx_spi_remove(&dev->dev);
-}
-
 #ifdef CONFIG_PM_SLEEP
 static int of_fsl_espi_suspend(struct device *dev)
 {
@@ -865,7 +860,6 @@ static struct platform_driver fsl_espi_driver = {
                .pm = &espi_pm,
        },
        .probe          = of_fsl_espi_probe,
-       .remove         = of_fsl_espi_remove,
 };
 module_platform_driver(fsl_espi_driver);
 
index e50fd066af06407d69a507271f83f0cdc1badfd9..1e43412cd9f88921519f4d981c7a3229afc4a248 100644 (file)
@@ -114,21 +114,6 @@ void mpc8xxx_spi_probe(struct device *dev, struct resource *mem,
 }
 EXPORT_SYMBOL_GPL(mpc8xxx_spi_probe);
 
-int mpc8xxx_spi_remove(struct device *dev)
-{
-       struct mpc8xxx_spi *mpc8xxx_spi;
-       struct spi_master *master;
-
-       master = dev_get_drvdata(dev);
-       mpc8xxx_spi = spi_master_get_devdata(master);
-
-       if (mpc8xxx_spi->spi_remove)
-               mpc8xxx_spi->spi_remove(mpc8xxx_spi);
-
-       return 0;
-}
-EXPORT_SYMBOL_GPL(mpc8xxx_spi_remove);
-
 int of_mpc8xxx_spi_probe(struct platform_device *ofdev)
 {
        struct device *dev = &ofdev->dev;
index 1326a392adcad162dd303617a03bf675d40a7a68..84f5dcb7a897d1388b0c08223c69ba661ca21017 100644 (file)
@@ -54,9 +54,6 @@ struct mpc8xxx_spi {
        void (*get_rx) (u32 rx_data, struct mpc8xxx_spi *);
        u32(*get_tx) (struct mpc8xxx_spi *);
 
-       /* hooks for different controller driver */
-       void (*spi_remove) (struct mpc8xxx_spi *mspi);
-
        unsigned int count;
        unsigned int irq;
 
index 8bfbe9e04bfd4adc661e9a3311d7d087fd9c3d7b..17a9a879dcce5480a642763e35d442e2ff8bfa65 100644 (file)
@@ -559,11 +559,6 @@ static irqreturn_t fsl_spi_irq(s32 irq, void *context_data)
        return ret;
 }
 
-static void fsl_spi_remove(struct mpc8xxx_spi *mspi)
-{
-       fsl_spi_cpm_free(mspi);
-}
-
 static void fsl_spi_grlib_cs_control(struct spi_device *spi, bool on)
 {
        struct mpc8xxx_spi *mpc8xxx_spi = spi_master_get_devdata(spi->master);
@@ -630,7 +625,6 @@ static struct spi_master * fsl_spi_probe(struct device *dev,
        master->transfer_one_message = fsl_spi_do_one_msg;
 
        mpc8xxx_spi = spi_master_get_devdata(master);
-       mpc8xxx_spi->spi_remove = fsl_spi_remove;
        mpc8xxx_spi->max_bits_per_word = 32;
        mpc8xxx_spi->type = fsl_spi_get_type(dev);
 
@@ -861,11 +855,8 @@ static int of_fsl_spi_remove(struct platform_device *ofdev)
 {
        struct spi_master *master = platform_get_drvdata(ofdev);
        struct mpc8xxx_spi *mpc8xxx_spi = spi_master_get_devdata(master);
-       int ret;
 
-       ret = mpc8xxx_spi_remove(&ofdev->dev);
-       if (ret)
-               return ret;
+       fsl_spi_cpm_free(mpc8xxx_spi);
        if (mpc8xxx_spi->type == TYPE_FSL)
                of_fsl_spi_free_chipselects(&ofdev->dev);
        return 0;
@@ -911,7 +902,12 @@ static int plat_mpc8xxx_spi_probe(struct platform_device *pdev)
 
 static int plat_mpc8xxx_spi_remove(struct platform_device *pdev)
 {
-       return mpc8xxx_spi_remove(&pdev->dev);
+       struct spi_master *master = platform_get_drvdata(pdev);
+       struct mpc8xxx_spi *mpc8xxx_spi = spi_master_get_devdata(master);
+
+       fsl_spi_cpm_free(mpc8xxx_spi);
+
+       return 0;
 }
 
 MODULE_ALIAS("platform:mpc8xxx_spi");