From: Fabio Estevam <festevam@gmail.com>
To: artem.bityutskiy@linux.intel.com
Cc: marex@denx.de, b32955@freescale.com,
linux-mtd@lists.infradead.org,
Fabio Estevam <fabio.estevam@freescale.com>,
kernel@pengutronix.de
Subject: [PATCH 1/2] mtd: gpmi-nand: Convert to platform driver
Date: Wed, 5 Sep 2012 11:35:24 -0300 [thread overview]
Message-ID: <1346855725-31726-1-git-send-email-festevam@gmail.com> (raw)
From: Fabio Estevam <fabio.estevam@freescale.com>
Using module_platform_driver() makes the code smaller and cleaner.
Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
---
This patch depends on: "mtd: gpmi-nand: Improve logging style"
drivers/mtd/nand/gpmi-nand/gpmi-nand.c | 29 +++++++----------------------
1 file changed, 7 insertions(+), 22 deletions(-)
diff --git a/drivers/mtd/nand/gpmi-nand/gpmi-nand.c b/drivers/mtd/nand/gpmi-nand/gpmi-nand.c
index 9493507..5999b15 100644
--- a/drivers/mtd/nand/gpmi-nand/gpmi-nand.c
+++ b/drivers/mtd/nand/gpmi-nand/gpmi-nand.c
@@ -1651,6 +1651,8 @@ static int __devinit gpmi_nand_probe(struct platform_device *pdev)
if (ret)
goto exit_nfc_init;
+ dev_info(this->dev, "driver registered.\n");
+
return 0;
exit_nfc_init:
@@ -1658,10 +1660,12 @@ exit_nfc_init:
exit_acquire_resources:
platform_set_drvdata(pdev, NULL);
kfree(this);
+ dev_err(this->dev, "driver registration failed: %d\n", ret);
+
return ret;
}
-static int __exit gpmi_nand_remove(struct platform_device *pdev)
+static int __devexit gpmi_nand_remove(struct platform_device *pdev)
{
struct gpmi_nand_data *this = platform_get_drvdata(pdev);
@@ -1678,29 +1682,10 @@ static struct platform_driver gpmi_nand_driver = {
.of_match_table = gpmi_nand_id_table,
},
.probe = gpmi_nand_probe,
- .remove = __exit_p(gpmi_nand_remove),
+ .remove = __devexit_p(gpmi_nand_remove),
.id_table = gpmi_ids,
};
-
-static int __init gpmi_nand_init(void)
-{
- int err;
-
- err = platform_driver_register(&gpmi_nand_driver);
- if (err == 0)
- pr_info("driver registered.\n");
- else
- pr_err("driver registration failed.\n");
- return err;
-}
-
-static void __exit gpmi_nand_exit(void)
-{
- platform_driver_unregister(&gpmi_nand_driver);
-}
-
-module_init(gpmi_nand_init);
-module_exit(gpmi_nand_exit);
+module_platform_driver(gpmi_nand_driver);
MODULE_AUTHOR("Freescale Semiconductor, Inc.");
MODULE_DESCRIPTION("i.MX GPMI NAND Flash Controller Driver");
--
1.7.9.5
next reply other threads:[~2012-09-05 14:35 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-09-05 14:35 Fabio Estevam [this message]
2012-09-05 14:35 ` [PATCH 2/2] mtd: mxc_nand: Convert to platform driver Fabio Estevam
2012-09-15 13:33 ` Fabio Estevam
2012-09-05 18:55 ` [PATCH 1/2] mtd: gpmi-nand: " Marek Vasut
2012-09-05 19:00 ` Fabio Estevam
2012-09-05 19:23 ` Marek Vasut
2012-09-05 19:51 ` Fabio Estevam
2012-09-21 12:19 ` Fabio Estevam
2012-09-21 12:53 ` Marek Vasut
2012-09-22 14:59 ` Artem Bityutskiy
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1346855725-31726-1-git-send-email-festevam@gmail.com \
--to=festevam@gmail.com \
--cc=artem.bityutskiy@linux.intel.com \
--cc=b32955@freescale.com \
--cc=fabio.estevam@freescale.com \
--cc=kernel@pengutronix.de \
--cc=linux-mtd@lists.infradead.org \
--cc=marex@denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox