Skip to content

Commit 905050b

Browse files
Bartosz Golaszewskimiquelraynal
authored andcommitted
mtd: rawnand: davinci: use generic device property helpers
There's no reason for this driver to be using OF-specific property accessors. Switch to using generic device property interfaces and replace the of.h include with property.h. This allows us to no longer check the existence of the associated of_node. Signed-off-by: Bartosz Golaszewski <[email protected]> Signed-off-by: Miquel Raynal <[email protected]> Link: https://lore.kernel.org/linux-mtd/[email protected]
1 parent ded6211 commit 905050b

File tree

1 file changed

+21
-21
lines changed

1 file changed

+21
-21
lines changed

drivers/mtd/nand/raw/davinci_nand.c

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
#include <linux/module.h>
1717
#include <linux/mtd/partitions.h>
1818
#include <linux/mtd/rawnand.h>
19-
#include <linux/of.h>
2019
#include <linux/platform_device.h>
20+
#include <linux/property.h>
2121
#include <linux/slab.h>
2222

2323
#define NRCSR_OFFSET 0x00
@@ -490,7 +490,7 @@ MODULE_DEVICE_TABLE(of, davinci_nand_of_match);
490490
static struct davinci_nand_pdata *
491491
nand_davinci_get_pdata(struct platform_device *pdev)
492492
{
493-
if (!dev_get_platdata(&pdev->dev) && pdev->dev.of_node) {
493+
if (!dev_get_platdata(&pdev->dev)) {
494494
struct davinci_nand_pdata *pdata;
495495
const char *mode;
496496
u32 prop;
@@ -501,40 +501,42 @@ nand_davinci_get_pdata(struct platform_device *pdev)
501501
pdev->dev.platform_data = pdata;
502502
if (!pdata)
503503
return ERR_PTR(-ENOMEM);
504-
if (!of_property_read_u32(pdev->dev.of_node,
505-
"ti,davinci-chipselect", &prop))
504+
if (!device_property_read_u32(&pdev->dev,
505+
"ti,davinci-chipselect", &prop))
506506
pdata->core_chipsel = prop;
507507
else
508508
return ERR_PTR(-EINVAL);
509509

510-
if (!of_property_read_u32(pdev->dev.of_node,
511-
"ti,davinci-mask-ale", &prop))
510+
if (!device_property_read_u32(&pdev->dev,
511+
"ti,davinci-mask-ale", &prop))
512512
pdata->mask_ale = prop;
513-
if (!of_property_read_u32(pdev->dev.of_node,
514-
"ti,davinci-mask-cle", &prop))
513+
if (!device_property_read_u32(&pdev->dev,
514+
"ti,davinci-mask-cle", &prop))
515515
pdata->mask_cle = prop;
516-
if (!of_property_read_u32(pdev->dev.of_node,
517-
"ti,davinci-mask-chipsel", &prop))
516+
if (!device_property_read_u32(&pdev->dev,
517+
"ti,davinci-mask-chipsel", &prop))
518518
pdata->mask_chipsel = prop;
519-
if (!of_property_read_string(pdev->dev.of_node,
520-
"ti,davinci-ecc-mode", &mode)) {
519+
if (!device_property_read_string(&pdev->dev,
520+
"ti,davinci-ecc-mode",
521+
&mode)) {
521522
if (!strncmp("none", mode, 4))
522523
pdata->engine_type = NAND_ECC_ENGINE_TYPE_NONE;
523524
if (!strncmp("soft", mode, 4))
524525
pdata->engine_type = NAND_ECC_ENGINE_TYPE_SOFT;
525526
if (!strncmp("hw", mode, 2))
526527
pdata->engine_type = NAND_ECC_ENGINE_TYPE_ON_HOST;
527528
}
528-
if (!of_property_read_u32(pdev->dev.of_node,
529-
"ti,davinci-ecc-bits", &prop))
529+
if (!device_property_read_u32(&pdev->dev,
530+
"ti,davinci-ecc-bits", &prop))
530531
pdata->ecc_bits = prop;
531532

532-
if (!of_property_read_u32(pdev->dev.of_node,
533-
"ti,davinci-nand-buswidth", &prop) && prop == 16)
533+
if (!device_property_read_u32(&pdev->dev,
534+
"ti,davinci-nand-buswidth",
535+
&prop) && prop == 16)
534536
pdata->options |= NAND_BUSWIDTH_16;
535537

536-
if (of_property_read_bool(pdev->dev.of_node,
537-
"ti,davinci-nand-use-bbt"))
538+
if (device_property_read_bool(&pdev->dev,
539+
"ti,davinci-nand-use-bbt"))
538540
pdata->bbt_options = NAND_BBT_USE_FLASH;
539541

540542
/*
@@ -548,10 +550,8 @@ nand_davinci_get_pdata(struct platform_device *pdev)
548550
* then use "ti,davinci-nand" as the compatible in your
549551
* device-tree file.
550552
*/
551-
if (of_device_is_compatible(pdev->dev.of_node,
552-
"ti,keystone-nand")) {
553+
if (device_is_compatible(&pdev->dev, "ti,keystone-nand"))
553554
pdata->options |= NAND_NO_SUBPAGE_WRITE;
554-
}
555555
}
556556

557557
return dev_get_platdata(&pdev->dev);

0 commit comments

Comments
 (0)