diff options
author | Grant Likely <grant.likely@secretlab.ca> | 2011-10-05 13:29:49 -0400 |
---|---|---|
committer | Grant Likely <grant.likely@secretlab.ca> | 2011-10-24 18:35:47 -0400 |
commit | 940ab88962bc1aff3273a8356d64577a6e386736 (patch) | |
tree | 3d96d0cb30fd3c6e1b17b2a2d264f4d44258a3bb /drivers/spi/spi-davinci.c | |
parent | 38ada214fad79ff5ebbed58932c5f0c9969d9c91 (diff) |
drivercore: Add helper macro for platform_driver boilerplate
For simple modules that contain a single platform_driver without any
additional setup code then ends up being a block of duplicated
boilerplate. This patch adds a new macro, module_platform_driver(),
which replaces the module_init()/module_exit() registrations with
template functions.
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
Acked-by: Greg Kroah-Hartman <gregkh@suse.de>
Reviewed-by: Magnus Damm <magnus.damm@gmail.com>
Reviewed-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Reviewed-by: Stephen Boyd <sboyd@codeaurora.org>
Diffstat (limited to 'drivers/spi/spi-davinci.c')
-rw-r--r-- | drivers/spi/spi-davinci.c | 20 |
1 files changed, 5 insertions, 15 deletions
diff --git a/drivers/spi/spi-davinci.c b/drivers/spi/spi-davinci.c index 1f0ed8005c91..31bfba805cf4 100644 --- a/drivers/spi/spi-davinci.c +++ b/drivers/spi/spi-davinci.c | |||
@@ -799,7 +799,7 @@ rx_dma_failed: | |||
799 | * It will invoke spi_bitbang_start to create work queue so that client driver | 799 | * It will invoke spi_bitbang_start to create work queue so that client driver |
800 | * can register transfer method to work queue. | 800 | * can register transfer method to work queue. |
801 | */ | 801 | */ |
802 | static int davinci_spi_probe(struct platform_device *pdev) | 802 | static int __devinit davinci_spi_probe(struct platform_device *pdev) |
803 | { | 803 | { |
804 | struct spi_master *master; | 804 | struct spi_master *master; |
805 | struct davinci_spi *dspi; | 805 | struct davinci_spi *dspi; |
@@ -984,7 +984,7 @@ err: | |||
984 | * It will also call spi_bitbang_stop to destroy the work queue which was | 984 | * It will also call spi_bitbang_stop to destroy the work queue which was |
985 | * created by spi_bitbang_start. | 985 | * created by spi_bitbang_start. |
986 | */ | 986 | */ |
987 | static int __exit davinci_spi_remove(struct platform_device *pdev) | 987 | static int __devexit davinci_spi_remove(struct platform_device *pdev) |
988 | { | 988 | { |
989 | struct davinci_spi *dspi; | 989 | struct davinci_spi *dspi; |
990 | struct spi_master *master; | 990 | struct spi_master *master; |
@@ -1011,20 +1011,10 @@ static struct platform_driver davinci_spi_driver = { | |||
1011 | .name = "spi_davinci", | 1011 | .name = "spi_davinci", |
1012 | .owner = THIS_MODULE, | 1012 | .owner = THIS_MODULE, |
1013 | }, | 1013 | }, |
1014 | .remove = __exit_p(davinci_spi_remove), | 1014 | .probe = davinci_spi_probe, |
1015 | .remove = __devexit_p(davinci_spi_remove), | ||
1015 | }; | 1016 | }; |
1016 | 1017 | module_platform_driver(davinci_spi_driver); | |
1017 | static int __init davinci_spi_init(void) | ||
1018 | { | ||
1019 | return platform_driver_probe(&davinci_spi_driver, davinci_spi_probe); | ||
1020 | } | ||
1021 | module_init(davinci_spi_init); | ||
1022 | |||
1023 | static void __exit davinci_spi_exit(void) | ||
1024 | { | ||
1025 | platform_driver_unregister(&davinci_spi_driver); | ||
1026 | } | ||
1027 | module_exit(davinci_spi_exit); | ||
1028 | 1018 | ||
1029 | MODULE_DESCRIPTION("TI DaVinci SPI Master Controller Driver"); | 1019 | MODULE_DESCRIPTION("TI DaVinci SPI Master Controller Driver"); |
1030 | MODULE_LICENSE("GPL"); | 1020 | MODULE_LICENSE("GPL"); |