Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

mtd: Use of_property_read_bool() for boolean properties

It is preferred to use typed property access functions (i.e.
of_property_read_<type> functions) rather than low-level
of_get_property/of_find_property functions for reading properties.
Convert reading boolean properties to to of_property_read_bool().

Signed-off-by: Rob Herring <robh@kernel.org>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Link: https://lore.kernel.org/linux-mtd/20230310144716.1543995-1-robh@kernel.org

authored by

Rob Herring and committed by
Miquel Raynal
57150c40 75f32f4b

+9 -10
+2 -2
drivers/mtd/devices/spear_smi.c
··· 820 820 pdata->board_flash_info->mem_base = be32_to_cpup(&addr[0]); 821 821 pdata->board_flash_info->size = be32_to_cpup(&addr[1]); 822 822 823 - if (of_get_property(pp, "st,smi-fast-mode", NULL)) 824 - pdata->board_flash_info->fast_mode = 1; 823 + pdata->board_flash_info->fast_mode = 824 + of_property_read_bool(pp, "st,smi-fast-mode"); 825 825 826 826 i++; 827 827 }
+1 -1
drivers/mtd/maps/sun_uflash.c
··· 112 112 /* Flashprom must have the "user" property in order to 113 113 * be used by this driver. 114 114 */ 115 - if (!of_find_property(dp, "user", NULL)) 115 + if (!of_property_read_bool(dp, "user")) 116 116 return -ENODEV; 117 117 118 118 return uflash_devinit(op, dp);
+1 -1
drivers/mtd/mtdcore.c
··· 738 738 739 739 mutex_unlock(&mtd_table_mutex); 740 740 741 - if (of_find_property(mtd_get_of_node(mtd), "linux,rootfs", NULL)) { 741 + if (of_property_read_bool(mtd_get_of_node(mtd), "linux,rootfs")) { 742 742 if (IS_BUILTIN(CONFIG_MTD)) { 743 743 pr_info("mtd: setting mtd%d (%s) as root device\n", mtd->index, mtd->name); 744 744 ROOT_DEV = MKDEV(MTD_BLOCK_MAJOR, mtd->index);
+1 -1
drivers/mtd/nand/raw/fsmc_nand.c
··· 880 880 } 881 881 } 882 882 883 - if (of_get_property(np, "nand-skip-bbtscan", NULL)) 883 + if (of_property_read_bool(np, "nand-skip-bbtscan")) 884 884 nand->options |= NAND_SKIP_BBTSCAN; 885 885 886 886 host->dev_timings = devm_kzalloc(&pdev->dev,
+2 -3
drivers/mtd/nand/raw/nand_macronix.c
··· 93 93 struct nand_parameters *p = &chip->parameters; 94 94 struct nand_onfi_vendor_macronix *mxic; 95 95 struct device_node *dn = nand_get_flash_node(chip); 96 - int rand_otp = 0; 96 + int rand_otp; 97 97 int ret; 98 98 99 99 if (!p->onfi) 100 100 return; 101 101 102 - if (of_find_property(dn, "mxic,enable-randomizer-otp", NULL)) 103 - rand_otp = 1; 102 + rand_otp = of_property_read_bool(dn, "mxic,enable-randomizer-otp"); 104 103 105 104 mxic = (struct nand_onfi_vendor_macronix *)p->onfi->vendor; 106 105 /* Subpage write is prohibited in randomizer operatoin */
+2 -2
drivers/mtd/spi-nor/controllers/nxp-spifi.c
··· 305 305 } 306 306 } 307 307 308 - if (of_find_property(np, "spi-cpha", NULL)) 308 + if (of_property_read_bool(np, "spi-cpha")) 309 309 mode |= SPI_CPHA; 310 310 311 - if (of_find_property(np, "spi-cpol", NULL)) 311 + if (of_property_read_bool(np, "spi-cpol")) 312 312 mode |= SPI_CPOL; 313 313 314 314 /* Setup control register defaults */