Patchwork [V2,1/3] MTD: MIPS: lantiq: use module_platform_driver inside lantiq map driver

login
register
mail settings
Submitter John Crispin
Date Feb. 23, 2012, 4:03 p.m.
Message ID <1330013024-13622-1-git-send-email-blogic@openwrt.org>
Download mbox | patch
Permalink /patch/142662/
State New
Headers show

Comments

John Crispin - Feb. 23, 2012, 4:03 p.m.
Reduce boilerplate code by converting driver to module_platform_driver.

Signed-off-by: John Crispin <blogic@openwrt.org>
Cc: linux-mtd@lists.infradead.org
---
 drivers/mtd/maps/lantiq-flash.c |   22 +++-------------------
 1 files changed, 3 insertions(+), 19 deletions(-)
Artem Bityutskiy - March 9, 2012, 11:28 a.m.
On Thu, 2012-02-23 at 17:03 +0100, John Crispin wrote:
> Reduce boilerplate code by converting driver to module_platform_driver.
> 
> Signed-off-by: John Crispin <blogic@openwrt.org>
> Cc: linux-mtd@lists.infradead.org

This is not an independent patch - do you want to merge it via the mips
tree?
John Crispin - March 9, 2012, 11:29 a.m.
On 09/03/12 12:28, Artem Bityutskiy wrote:
> On Thu, 2012-02-23 at 17:03 +0100, John Crispin wrote:
>> Reduce boilerplate code by converting driver to module_platform_driver.
>>
>> Signed-off-by: John Crispin <blogic@openwrt.org>
>> Cc: linux-mtd@lists.infradead.org
> This is not an independent patch - do you want to merge it via the mips
> tree?
>
via MIPS, sorry for not putting the info in the commit text

Patch

diff --git a/drivers/mtd/maps/lantiq-flash.c b/drivers/mtd/maps/lantiq-flash.c
index 7b889de..395ebfe 100644
--- a/drivers/mtd/maps/lantiq-flash.c
+++ b/drivers/mtd/maps/lantiq-flash.c
@@ -107,7 +107,7 @@  ltq_copy_to(struct map_info *map, unsigned long to,
 	spin_unlock_irqrestore(&ebu_lock, flags);
 }
 
-static int __init
+static int __devinit
 ltq_mtd_probe(struct platform_device *pdev)
 {
 	struct physmap_flash_data *ltq_mtd_data = dev_get_platdata(&pdev->dev);
@@ -203,6 +203,7 @@  ltq_mtd_remove(struct platform_device *pdev)
 }
 
 static struct platform_driver ltq_mtd_driver = {
+	.probe = ltq_mtd_probe,
 	.remove = __devexit_p(ltq_mtd_remove),
 	.driver = {
 		.name = "ltq_nor",
@@ -210,24 +211,7 @@  static struct platform_driver ltq_mtd_driver = {
 	},
 };
 
-static int __init
-init_ltq_mtd(void)
-{
-	int ret = platform_driver_probe(&ltq_mtd_driver, ltq_mtd_probe);
-
-	if (ret)
-		pr_err("ltq_nor: error registering platform driver");
-	return ret;
-}
-
-static void __exit
-exit_ltq_mtd(void)
-{
-	platform_driver_unregister(&ltq_mtd_driver);
-}
-
-module_init(init_ltq_mtd);
-module_exit(exit_ltq_mtd);
+module_platform_driver(ltq_mtd_driver);
 
 MODULE_LICENSE("GPL");
 MODULE_AUTHOR("John Crispin <blogic@openwrt.org>");