diff options
author | Heiner Kallweit <hkallweit1@gmail.com> | 2015-08-26 15:21:53 -0400 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2015-08-28 13:15:18 -0400 |
commit | 3c5395b66ff69d8d568d0b9ff8b1077e044def5b (patch) | |
tree | 14e021e4a2c75fb3cd5a105b206b8b1e2aafff7d /drivers/spi | |
parent | 4178b6b1b595003cd6e04711b449797a582e44f5 (diff) |
spi: fsl-(e)spi: simplify cleanup code
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>
Diffstat (limited to 'drivers/spi')
-rw-r--r-- | drivers/spi/spi-fsl-espi.c | 6 | ||||
-rw-r--r-- | drivers/spi/spi-fsl-lib.c | 15 | ||||
-rw-r--r-- | drivers/spi/spi-fsl-lib.h | 3 | ||||
-rw-r--r-- | drivers/spi/spi-fsl-spi.c | 18 |
4 files changed, 7 insertions, 35 deletions
diff --git a/drivers/spi/spi-fsl-espi.c b/drivers/spi/spi-fsl-espi.c index f35eb2c46782..fe54e5788245 100644 --- a/drivers/spi/spi-fsl-espi.c +++ b/drivers/spi/spi-fsl-espi.c | |||
@@ -797,11 +797,6 @@ err: | |||
797 | return ret; | 797 | return ret; |
798 | } | 798 | } |
799 | 799 | ||
800 | static int of_fsl_espi_remove(struct platform_device *dev) | ||
801 | { | ||
802 | return mpc8xxx_spi_remove(&dev->dev); | ||
803 | } | ||
804 | |||
805 | #ifdef CONFIG_PM_SLEEP | 800 | #ifdef CONFIG_PM_SLEEP |
806 | static int of_fsl_espi_suspend(struct device *dev) | 801 | static int of_fsl_espi_suspend(struct device *dev) |
807 | { | 802 | { |
@@ -865,7 +860,6 @@ static struct platform_driver fsl_espi_driver = { | |||
865 | .pm = &espi_pm, | 860 | .pm = &espi_pm, |
866 | }, | 861 | }, |
867 | .probe = of_fsl_espi_probe, | 862 | .probe = of_fsl_espi_probe, |
868 | .remove = of_fsl_espi_remove, | ||
869 | }; | 863 | }; |
870 | module_platform_driver(fsl_espi_driver); | 864 | module_platform_driver(fsl_espi_driver); |
871 | 865 | ||
diff --git a/drivers/spi/spi-fsl-lib.c b/drivers/spi/spi-fsl-lib.c index e50fd066af06..1e43412cd9f8 100644 --- a/drivers/spi/spi-fsl-lib.c +++ b/drivers/spi/spi-fsl-lib.c | |||
@@ -114,21 +114,6 @@ void mpc8xxx_spi_probe(struct device *dev, struct resource *mem, | |||
114 | } | 114 | } |
115 | EXPORT_SYMBOL_GPL(mpc8xxx_spi_probe); | 115 | EXPORT_SYMBOL_GPL(mpc8xxx_spi_probe); |
116 | 116 | ||
117 | int mpc8xxx_spi_remove(struct device *dev) | ||
118 | { | ||
119 | struct mpc8xxx_spi *mpc8xxx_spi; | ||
120 | struct spi_master *master; | ||
121 | |||
122 | master = dev_get_drvdata(dev); | ||
123 | mpc8xxx_spi = spi_master_get_devdata(master); | ||
124 | |||
125 | if (mpc8xxx_spi->spi_remove) | ||
126 | mpc8xxx_spi->spi_remove(mpc8xxx_spi); | ||
127 | |||
128 | return 0; | ||
129 | } | ||
130 | EXPORT_SYMBOL_GPL(mpc8xxx_spi_remove); | ||
131 | |||
132 | int of_mpc8xxx_spi_probe(struct platform_device *ofdev) | 117 | int of_mpc8xxx_spi_probe(struct platform_device *ofdev) |
133 | { | 118 | { |
134 | struct device *dev = &ofdev->dev; | 119 | struct device *dev = &ofdev->dev; |
diff --git a/drivers/spi/spi-fsl-lib.h b/drivers/spi/spi-fsl-lib.h index 1326a392adca..84f5dcb7a897 100644 --- a/drivers/spi/spi-fsl-lib.h +++ b/drivers/spi/spi-fsl-lib.h | |||
@@ -54,9 +54,6 @@ struct mpc8xxx_spi { | |||
54 | void (*get_rx) (u32 rx_data, struct mpc8xxx_spi *); | 54 | void (*get_rx) (u32 rx_data, struct mpc8xxx_spi *); |
55 | u32(*get_tx) (struct mpc8xxx_spi *); | 55 | u32(*get_tx) (struct mpc8xxx_spi *); |
56 | 56 | ||
57 | /* hooks for different controller driver */ | ||
58 | void (*spi_remove) (struct mpc8xxx_spi *mspi); | ||
59 | |||
60 | unsigned int count; | 57 | unsigned int count; |
61 | unsigned int irq; | 58 | unsigned int irq; |
62 | 59 | ||
diff --git a/drivers/spi/spi-fsl-spi.c b/drivers/spi/spi-fsl-spi.c index 8bfbe9e04bfd..17a9a879dcce 100644 --- a/drivers/spi/spi-fsl-spi.c +++ b/drivers/spi/spi-fsl-spi.c | |||
@@ -559,11 +559,6 @@ static irqreturn_t fsl_spi_irq(s32 irq, void *context_data) | |||
559 | return ret; | 559 | return ret; |
560 | } | 560 | } |
561 | 561 | ||
562 | static void fsl_spi_remove(struct mpc8xxx_spi *mspi) | ||
563 | { | ||
564 | fsl_spi_cpm_free(mspi); | ||
565 | } | ||
566 | |||
567 | static void fsl_spi_grlib_cs_control(struct spi_device *spi, bool on) | 562 | static void fsl_spi_grlib_cs_control(struct spi_device *spi, bool on) |
568 | { | 563 | { |
569 | struct mpc8xxx_spi *mpc8xxx_spi = spi_master_get_devdata(spi->master); | 564 | 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, | |||
630 | master->transfer_one_message = fsl_spi_do_one_msg; | 625 | master->transfer_one_message = fsl_spi_do_one_msg; |
631 | 626 | ||
632 | mpc8xxx_spi = spi_master_get_devdata(master); | 627 | mpc8xxx_spi = spi_master_get_devdata(master); |
633 | mpc8xxx_spi->spi_remove = fsl_spi_remove; | ||
634 | mpc8xxx_spi->max_bits_per_word = 32; | 628 | mpc8xxx_spi->max_bits_per_word = 32; |
635 | mpc8xxx_spi->type = fsl_spi_get_type(dev); | 629 | mpc8xxx_spi->type = fsl_spi_get_type(dev); |
636 | 630 | ||
@@ -861,11 +855,8 @@ static int of_fsl_spi_remove(struct platform_device *ofdev) | |||
861 | { | 855 | { |
862 | struct spi_master *master = platform_get_drvdata(ofdev); | 856 | struct spi_master *master = platform_get_drvdata(ofdev); |
863 | struct mpc8xxx_spi *mpc8xxx_spi = spi_master_get_devdata(master); | 857 | struct mpc8xxx_spi *mpc8xxx_spi = spi_master_get_devdata(master); |
864 | int ret; | ||
865 | 858 | ||
866 | ret = mpc8xxx_spi_remove(&ofdev->dev); | 859 | fsl_spi_cpm_free(mpc8xxx_spi); |
867 | if (ret) | ||
868 | return ret; | ||
869 | if (mpc8xxx_spi->type == TYPE_FSL) | 860 | if (mpc8xxx_spi->type == TYPE_FSL) |
870 | of_fsl_spi_free_chipselects(&ofdev->dev); | 861 | of_fsl_spi_free_chipselects(&ofdev->dev); |
871 | return 0; | 862 | return 0; |
@@ -911,7 +902,12 @@ static int plat_mpc8xxx_spi_probe(struct platform_device *pdev) | |||
911 | 902 | ||
912 | static int plat_mpc8xxx_spi_remove(struct platform_device *pdev) | 903 | static int plat_mpc8xxx_spi_remove(struct platform_device *pdev) |
913 | { | 904 | { |
914 | return mpc8xxx_spi_remove(&pdev->dev); | 905 | struct spi_master *master = platform_get_drvdata(pdev); |
906 | struct mpc8xxx_spi *mpc8xxx_spi = spi_master_get_devdata(master); | ||
907 | |||
908 | fsl_spi_cpm_free(mpc8xxx_spi); | ||
909 | |||
910 | return 0; | ||
915 | } | 911 | } |
916 | 912 | ||
917 | MODULE_ALIAS("platform:mpc8xxx_spi"); | 913 | MODULE_ALIAS("platform:mpc8xxx_spi"); |