Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Heiner Kallweit and committed by
Mark Brown
3c5395b6 4178b6b1

+7 -35
-6
drivers/spi/spi-fsl-espi.c
··· 797 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 800 #ifdef CONFIG_PM_SLEEP 806 801 static int of_fsl_espi_suspend(struct device *dev) 807 802 { ··· 860 865 .pm = &espi_pm, 861 866 }, 862 867 .probe = of_fsl_espi_probe, 863 - .remove = of_fsl_espi_remove, 864 868 }; 865 869 module_platform_driver(fsl_espi_driver); 866 870
-15
drivers/spi/spi-fsl-lib.c
··· 114 114 } 115 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 117 int of_mpc8xxx_spi_probe(struct platform_device *ofdev) 133 118 { 134 119 struct device *dev = &ofdev->dev;
-3
drivers/spi/spi-fsl-lib.h
··· 54 54 void (*get_rx) (u32 rx_data, struct mpc8xxx_spi *); 55 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 57 unsigned int count; 61 58 unsigned int irq; 62 59
+7 -11
drivers/spi/spi-fsl-spi.c
··· 559 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 562 static void fsl_spi_grlib_cs_control(struct spi_device *spi, bool on) 568 563 { 569 564 struct mpc8xxx_spi *mpc8xxx_spi = spi_master_get_devdata(spi->master); ··· 625 630 master->transfer_one_message = fsl_spi_do_one_msg; 626 631 627 632 mpc8xxx_spi = spi_master_get_devdata(master); 628 - mpc8xxx_spi->spi_remove = fsl_spi_remove; 629 633 mpc8xxx_spi->max_bits_per_word = 32; 630 634 mpc8xxx_spi->type = fsl_spi_get_type(dev); 631 635 ··· 855 861 { 856 862 struct spi_master *master = platform_get_drvdata(ofdev); 857 863 struct mpc8xxx_spi *mpc8xxx_spi = spi_master_get_devdata(master); 858 - int ret; 859 864 860 - ret = mpc8xxx_spi_remove(&ofdev->dev); 861 - if (ret) 862 - return ret; 865 + fsl_spi_cpm_free(mpc8xxx_spi); 863 866 if (mpc8xxx_spi->type == TYPE_FSL) 864 867 of_fsl_spi_free_chipselects(&ofdev->dev); 865 868 return 0; ··· 902 911 903 912 static int plat_mpc8xxx_spi_remove(struct platform_device *pdev) 904 913 { 905 - return mpc8xxx_spi_remove(&pdev->dev); 914 + struct spi_master *master = platform_get_drvdata(pdev); 915 + struct mpc8xxx_spi *mpc8xxx_spi = spi_master_get_devdata(master); 916 + 917 + fsl_spi_cpm_free(mpc8xxx_spi); 918 + 919 + return 0; 906 920 } 907 921 908 922 MODULE_ALIAS("platform:mpc8xxx_spi");