diff options
author | Grant Likely <grant.likely@secretlab.ca> | 2011-10-05 21:29:49 +0400 |
---|---|---|
committer | Grant Likely <grant.likely@secretlab.ca> | 2011-10-25 02:35:47 +0400 |
commit | 940ab88962bc1aff3273a8356d64577a6e386736 (patch) | |
tree | 3d96d0cb30fd3c6e1b17b2a2d264f4d44258a3bb /drivers/spi/spi-tegra.c | |
parent | 38ada214fad79ff5ebbed58932c5f0c9969d9c91 (diff) | |
download | linux-940ab88962bc1aff3273a8356d64577a6e386736.tar.xz |
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-tegra.c')
-rw-r--r-- | drivers/spi/spi-tegra.c | 16 |
1 files changed, 3 insertions, 13 deletions
diff --git a/drivers/spi/spi-tegra.c b/drivers/spi/spi-tegra.c index e8cd58f63e22..ae6d78a3e912 100644 --- a/drivers/spi/spi-tegra.c +++ b/drivers/spi/spi-tegra.c @@ -465,7 +465,7 @@ static int spi_tegra_transfer(struct spi_device *spi, struct spi_message *m) return 0; } -static int __init spi_tegra_probe(struct platform_device *pdev) +static int __devinit spi_tegra_probe(struct platform_device *pdev) { struct spi_master *master; struct spi_tegra_data *tspi; @@ -613,19 +613,9 @@ static struct platform_driver spi_tegra_driver = { .owner = THIS_MODULE, .of_match_table = spi_tegra_of_match_table, }, + .probe = spi_tegra_probe, .remove = __devexit_p(spi_tegra_remove), }; - -static int __init spi_tegra_init(void) -{ - return platform_driver_probe(&spi_tegra_driver, spi_tegra_probe); -} -module_init(spi_tegra_init); - -static void __exit spi_tegra_exit(void) -{ - platform_driver_unregister(&spi_tegra_driver); -} -module_exit(spi_tegra_exit); +module_platform_driver(spi_tegra_driver); MODULE_LICENSE("GPL"); |