* [PATCH v2 1/2] mtd: atmel_nand: remove #if defined(CONFIG_OF) around OF-specific code
@ 2013-09-18 3:31 Josh Wu
2013-09-18 3:31 ` [PATCH v2 2/2] mtd: atmel_nand: add MODULE_DEVICE_TABLE for nfc driver Josh Wu
2013-09-18 21:45 ` [PATCH v2 1/2] mtd: atmel_nand: remove #if defined(CONFIG_OF) around OF-specific code Brian Norris
0 siblings, 2 replies; 3+ messages in thread
From: Josh Wu @ 2013-09-18 3:31 UTC (permalink / raw)
To: linux-arm-kernel
Since the of specific code are declared in <linux/of_mtd.h> regardless
of CONFIG_OF. Remove the #if defined(CONFIG_OF) guard and use an
IS_ENABLED(CONFIG_OF) instead.
Thanks to Ezequiel Garcia's for this protype.
Signed-off-by: Josh Wu <josh.wu@atmel.com>
Acked-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
---
v1 --> v2:
add an IS_ENABLED(CONFIG_OF) to guard the code for dt node parsing.
drivers/mtd/nand/atmel_nand.c | 17 +++--------------
1 file changed, 3 insertions(+), 14 deletions(-)
diff --git a/drivers/mtd/nand/atmel_nand.c b/drivers/mtd/nand/atmel_nand.c
index 060feea..72c2611 100644
--- a/drivers/mtd/nand/atmel_nand.c
+++ b/drivers/mtd/nand/atmel_nand.c
@@ -1449,7 +1449,6 @@ static void atmel_nand_hwctl(struct mtd_info *mtd, int mode)
ecc_writel(host->ecc, CR, ATMEL_ECC_RST);
}
-#if defined(CONFIG_OF)
static int atmel_of_init_port(struct atmel_nand_host *host,
struct device_node *np)
{
@@ -1457,7 +1456,7 @@ static int atmel_of_init_port(struct atmel_nand_host *host,
u32 offset[2];
int ecc_mode;
struct atmel_nand_data *board = &host->board;
- enum of_gpio_flags flags;
+ enum of_gpio_flags flags = 0;
if (of_property_read_u32(np, "atmel,nand-addr-offset", &val) == 0) {
if (val >= 32) {
@@ -1540,13 +1539,6 @@ static int atmel_of_init_port(struct atmel_nand_host *host,
return 0;
}
-#else
-static int atmel_of_init_port(struct atmel_nand_host *host,
- struct device_node *np)
-{
- return -EINVAL;
-}
-#endif
static int __init atmel_hw_nand_init_params(struct platform_device *pdev,
struct atmel_nand_host *host)
@@ -2019,7 +2011,8 @@ static int __init atmel_nand_probe(struct platform_device *pdev)
mtd = &host->mtd;
nand_chip = &host->nand_chip;
host->dev = &pdev->dev;
- if (pdev->dev.of_node) {
+ if (IS_ENABLED(CONFIG_OF) && pdev->dev.of_node) {
+ /* Only when CONFIG_OF is enabled of_node can be parsed */
res = atmel_of_init_port(host, pdev->dev.of_node);
if (res)
goto err_nand_ioremap;
@@ -2207,14 +2200,12 @@ static int __exit atmel_nand_remove(struct platform_device *pdev)
return 0;
}
-#if defined(CONFIG_OF)
static const struct of_device_id atmel_nand_dt_ids[] = {
{ .compatible = "atmel,at91rm9200-nand" },
{ /* sentinel */ }
};
MODULE_DEVICE_TABLE(of, atmel_nand_dt_ids);
-#endif
static int atmel_nand_nfc_probe(struct platform_device *pdev)
{
@@ -2253,12 +2244,10 @@ static int atmel_nand_nfc_probe(struct platform_device *pdev)
return 0;
}
-#if defined(CONFIG_OF)
static struct of_device_id atmel_nand_nfc_match[] = {
{ .compatible = "atmel,sama5d3-nfc" },
{ /* sentinel */ }
};
-#endif
static struct platform_driver atmel_nand_nfc_driver = {
.driver = {
--
1.7.9.5
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH v2 2/2] mtd: atmel_nand: add MODULE_DEVICE_TABLE for nfc driver
2013-09-18 3:31 [PATCH v2 1/2] mtd: atmel_nand: remove #if defined(CONFIG_OF) around OF-specific code Josh Wu
@ 2013-09-18 3:31 ` Josh Wu
2013-09-18 21:45 ` [PATCH v2 1/2] mtd: atmel_nand: remove #if defined(CONFIG_OF) around OF-specific code Brian Norris
1 sibling, 0 replies; 3+ messages in thread
From: Josh Wu @ 2013-09-18 3:31 UTC (permalink / raw)
To: linux-arm-kernel
This patch also add a const keyword for the of_device_id of nfc.
Signed-off-by: Josh Wu <josh.wu@atmel.com>
Acked-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
---
drivers/mtd/nand/atmel_nand.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/mtd/nand/atmel_nand.c b/drivers/mtd/nand/atmel_nand.c
index 72c2611..5a5d457 100644
--- a/drivers/mtd/nand/atmel_nand.c
+++ b/drivers/mtd/nand/atmel_nand.c
@@ -2244,10 +2244,11 @@ static int atmel_nand_nfc_probe(struct platform_device *pdev)
return 0;
}
-static struct of_device_id atmel_nand_nfc_match[] = {
+static const struct of_device_id atmel_nand_nfc_match[] = {
{ .compatible = "atmel,sama5d3-nfc" },
{ /* sentinel */ }
};
+MODULE_DEVICE_TABLE(of, atmel_nand_nfc_match);
static struct platform_driver atmel_nand_nfc_driver = {
.driver = {
--
1.7.9.5
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH v2 1/2] mtd: atmel_nand: remove #if defined(CONFIG_OF) around OF-specific code
2013-09-18 3:31 [PATCH v2 1/2] mtd: atmel_nand: remove #if defined(CONFIG_OF) around OF-specific code Josh Wu
2013-09-18 3:31 ` [PATCH v2 2/2] mtd: atmel_nand: add MODULE_DEVICE_TABLE for nfc driver Josh Wu
@ 2013-09-18 21:45 ` Brian Norris
1 sibling, 0 replies; 3+ messages in thread
From: Brian Norris @ 2013-09-18 21:45 UTC (permalink / raw)
To: linux-arm-kernel
On Wed, Sep 18, 2013 at 11:31:19AM +0800, Josh Wu wrote:
> Since the of specific code are declared in <linux/of_mtd.h> regardless
> of CONFIG_OF. Remove the #if defined(CONFIG_OF) guard and use an
> IS_ENABLED(CONFIG_OF) instead.
>
> Thanks to Ezequiel Garcia's for this protype.
>
> Signed-off-by: Josh Wu <josh.wu@atmel.com>
> Acked-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
Pushed both to l2-mtd.git. Thanks!
Brian
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-09-18 21:45 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-09-18 3:31 [PATCH v2 1/2] mtd: atmel_nand: remove #if defined(CONFIG_OF) around OF-specific code Josh Wu
2013-09-18 3:31 ` [PATCH v2 2/2] mtd: atmel_nand: add MODULE_DEVICE_TABLE for nfc driver Josh Wu
2013-09-18 21:45 ` [PATCH v2 1/2] mtd: atmel_nand: remove #if defined(CONFIG_OF) around OF-specific code Brian Norris
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).