diff options
author | Josh Wu <josh.wu@atmel.com> | 2013-09-17 23:31:19 -0400 |
---|---|---|
committer | Brian Norris <computersforpeace@gmail.com> | 2013-10-27 19:27:03 -0400 |
commit | e9d8da807d818ce8e8399f528fd8efaac3eef36b (patch) | |
tree | ed6595a58129b96afb02c4e9be8c00e02c3ae495 | |
parent | 86bc7bddc9bf7841372df5880805506228dbf4f4 (diff) |
mtd: atmel_nand: remove #if defined(CONFIG_OF) around OF-specific code
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>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
-rw-r--r-- | drivers/mtd/nand/atmel_nand.c | 17 |
1 files changed, 3 insertions, 14 deletions
diff --git a/drivers/mtd/nand/atmel_nand.c b/drivers/mtd/nand/atmel_nand.c index 060feeaf6b3e..72c26112df85 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) | |||
1449 | ecc_writel(host->ecc, CR, ATMEL_ECC_RST); | 1449 | ecc_writel(host->ecc, CR, ATMEL_ECC_RST); |
1450 | } | 1450 | } |
1451 | 1451 | ||
1452 | #if defined(CONFIG_OF) | ||
1453 | static int atmel_of_init_port(struct atmel_nand_host *host, | 1452 | static int atmel_of_init_port(struct atmel_nand_host *host, |
1454 | struct device_node *np) | 1453 | struct device_node *np) |
1455 | { | 1454 | { |
@@ -1457,7 +1456,7 @@ static int atmel_of_init_port(struct atmel_nand_host *host, | |||
1457 | u32 offset[2]; | 1456 | u32 offset[2]; |
1458 | int ecc_mode; | 1457 | int ecc_mode; |
1459 | struct atmel_nand_data *board = &host->board; | 1458 | struct atmel_nand_data *board = &host->board; |
1460 | enum of_gpio_flags flags; | 1459 | enum of_gpio_flags flags = 0; |
1461 | 1460 | ||
1462 | if (of_property_read_u32(np, "atmel,nand-addr-offset", &val) == 0) { | 1461 | if (of_property_read_u32(np, "atmel,nand-addr-offset", &val) == 0) { |
1463 | if (val >= 32) { | 1462 | if (val >= 32) { |
@@ -1540,13 +1539,6 @@ static int atmel_of_init_port(struct atmel_nand_host *host, | |||
1540 | 1539 | ||
1541 | return 0; | 1540 | return 0; |
1542 | } | 1541 | } |
1543 | #else | ||
1544 | static int atmel_of_init_port(struct atmel_nand_host *host, | ||
1545 | struct device_node *np) | ||
1546 | { | ||
1547 | return -EINVAL; | ||
1548 | } | ||
1549 | #endif | ||
1550 | 1542 | ||
1551 | static int __init atmel_hw_nand_init_params(struct platform_device *pdev, | 1543 | static int __init atmel_hw_nand_init_params(struct platform_device *pdev, |
1552 | struct atmel_nand_host *host) | 1544 | struct atmel_nand_host *host) |
@@ -2019,7 +2011,8 @@ static int __init atmel_nand_probe(struct platform_device *pdev) | |||
2019 | mtd = &host->mtd; | 2011 | mtd = &host->mtd; |
2020 | nand_chip = &host->nand_chip; | 2012 | nand_chip = &host->nand_chip; |
2021 | host->dev = &pdev->dev; | 2013 | host->dev = &pdev->dev; |
2022 | if (pdev->dev.of_node) { | 2014 | if (IS_ENABLED(CONFIG_OF) && pdev->dev.of_node) { |
2015 | /* Only when CONFIG_OF is enabled of_node can be parsed */ | ||
2023 | res = atmel_of_init_port(host, pdev->dev.of_node); | 2016 | res = atmel_of_init_port(host, pdev->dev.of_node); |
2024 | if (res) | 2017 | if (res) |
2025 | goto err_nand_ioremap; | 2018 | goto err_nand_ioremap; |
@@ -2207,14 +2200,12 @@ static int __exit atmel_nand_remove(struct platform_device *pdev) | |||
2207 | return 0; | 2200 | return 0; |
2208 | } | 2201 | } |
2209 | 2202 | ||
2210 | #if defined(CONFIG_OF) | ||
2211 | static const struct of_device_id atmel_nand_dt_ids[] = { | 2203 | static const struct of_device_id atmel_nand_dt_ids[] = { |
2212 | { .compatible = "atmel,at91rm9200-nand" }, | 2204 | { .compatible = "atmel,at91rm9200-nand" }, |
2213 | { /* sentinel */ } | 2205 | { /* sentinel */ } |
2214 | }; | 2206 | }; |
2215 | 2207 | ||
2216 | MODULE_DEVICE_TABLE(of, atmel_nand_dt_ids); | 2208 | MODULE_DEVICE_TABLE(of, atmel_nand_dt_ids); |
2217 | #endif | ||
2218 | 2209 | ||
2219 | static int atmel_nand_nfc_probe(struct platform_device *pdev) | 2210 | static int atmel_nand_nfc_probe(struct platform_device *pdev) |
2220 | { | 2211 | { |
@@ -2253,12 +2244,10 @@ static int atmel_nand_nfc_probe(struct platform_device *pdev) | |||
2253 | return 0; | 2244 | return 0; |
2254 | } | 2245 | } |
2255 | 2246 | ||
2256 | #if defined(CONFIG_OF) | ||
2257 | static struct of_device_id atmel_nand_nfc_match[] = { | 2247 | static struct of_device_id atmel_nand_nfc_match[] = { |
2258 | { .compatible = "atmel,sama5d3-nfc" }, | 2248 | { .compatible = "atmel,sama5d3-nfc" }, |
2259 | { /* sentinel */ } | 2249 | { /* sentinel */ } |
2260 | }; | 2250 | }; |
2261 | #endif | ||
2262 | 2251 | ||
2263 | static struct platform_driver atmel_nand_nfc_driver = { | 2252 | static struct platform_driver atmel_nand_nfc_driver = { |
2264 | .driver = { | 2253 | .driver = { |