Skip to content

Commit 1a87e64

Browse files
robherringdavem330
authored andcommitted
net: 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 of_property_read_bool(). Reviewed-by: Simon Horman <[email protected]> Acked-by: Marc Kleine-Budde <[email protected]> # for net/can Acked-by: Kalle Valo <[email protected]> Acked-by: Nicolas Ferre <[email protected]> Acked-by: Francois Romieu <[email protected]> Reviewed-by: Wei Fang <[email protected]> Signed-off-by: Rob Herring <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 65d63e8 commit 1a87e64

File tree

18 files changed

+36
-48
lines changed

18 files changed

+36
-48
lines changed

drivers/net/can/cc770/cc770_platform.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -93,20 +93,20 @@ static int cc770_get_of_node_data(struct platform_device *pdev,
9393
if (priv->can.clock.freq > 8000000)
9494
priv->cpu_interface |= CPUIF_DMC;
9595

96-
if (of_get_property(np, "bosch,divide-memory-clock", NULL))
96+
if (of_property_read_bool(np, "bosch,divide-memory-clock"))
9797
priv->cpu_interface |= CPUIF_DMC;
98-
if (of_get_property(np, "bosch,iso-low-speed-mux", NULL))
98+
if (of_property_read_bool(np, "bosch,iso-low-speed-mux"))
9999
priv->cpu_interface |= CPUIF_MUX;
100100

101101
if (!of_get_property(np, "bosch,no-comperator-bypass", NULL))
102102
priv->bus_config |= BUSCFG_CBY;
103-
if (of_get_property(np, "bosch,disconnect-rx0-input", NULL))
103+
if (of_property_read_bool(np, "bosch,disconnect-rx0-input"))
104104
priv->bus_config |= BUSCFG_DR0;
105-
if (of_get_property(np, "bosch,disconnect-rx1-input", NULL))
105+
if (of_property_read_bool(np, "bosch,disconnect-rx1-input"))
106106
priv->bus_config |= BUSCFG_DR1;
107-
if (of_get_property(np, "bosch,disconnect-tx1-output", NULL))
107+
if (of_property_read_bool(np, "bosch,disconnect-tx1-output"))
108108
priv->bus_config |= BUSCFG_DT1;
109-
if (of_get_property(np, "bosch,polarity-dominant", NULL))
109+
if (of_property_read_bool(np, "bosch,polarity-dominant"))
110110
priv->bus_config |= BUSCFG_POL;
111111

112112
prop = of_get_property(np, "bosch,clock-out-frequency", &prop_size);

drivers/net/ethernet/cadence/macb_main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4990,7 +4990,7 @@ static int macb_probe(struct platform_device *pdev)
49904990
bp->jumbo_max_len = macb_config->jumbo_max_len;
49914991

49924992
bp->wol = 0;
4993-
if (of_get_property(np, "magic-packet", NULL))
4993+
if (of_property_read_bool(np, "magic-packet"))
49944994
bp->wol |= MACB_WOL_HAS_MAGIC_PACKET;
49954995
device_set_wakeup_capable(&pdev->dev, bp->wol & MACB_WOL_HAS_MAGIC_PACKET);
49964996

drivers/net/ethernet/davicom/dm9000.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1393,9 +1393,9 @@ static struct dm9000_plat_data *dm9000_parse_dt(struct device *dev)
13931393
if (!pdata)
13941394
return ERR_PTR(-ENOMEM);
13951395

1396-
if (of_find_property(np, "davicom,ext-phy", NULL))
1396+
if (of_property_read_bool(np, "davicom,ext-phy"))
13971397
pdata->flags |= DM9000_PLATF_EXT_PHY;
1398-
if (of_find_property(np, "davicom,no-eeprom", NULL))
1398+
if (of_property_read_bool(np, "davicom,no-eeprom"))
13991399
pdata->flags |= DM9000_PLATF_NO_EEPROM;
14001400

14011401
ret = of_get_mac_address(np, pdata->dev_addr);

drivers/net/ethernet/freescale/fec_main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4251,7 +4251,7 @@ fec_probe(struct platform_device *pdev)
42514251
if (ret)
42524252
goto failed_ipc_init;
42534253

4254-
if (of_get_property(np, "fsl,magic-packet", NULL))
4254+
if (of_property_read_bool(np, "fsl,magic-packet"))
42554255
fep->wol_flag |= FEC_WOL_HAS_MAGIC_PACKET;
42564256

42574257
ret = fec_enet_init_stop_mode(fep, np);

drivers/net/ethernet/freescale/fec_mpc52xx.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -937,7 +937,7 @@ static int mpc52xx_fec_probe(struct platform_device *op)
937937
priv->phy_node = of_parse_phandle(np, "phy-handle", 0);
938938

939939
/* the 7-wire property means don't use MII mode */
940-
if (of_find_property(np, "fsl,7-wire-mode", NULL)) {
940+
if (of_property_read_bool(np, "fsl,7-wire-mode")) {
941941
priv->seven_wire_mode = 1;
942942
dev_info(&ndev->dev, "using 7-wire PHY mode\n");
943943
}

drivers/net/ethernet/freescale/gianfar.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -787,10 +787,10 @@ static int gfar_of_init(struct platform_device *ofdev, struct net_device **pdev)
787787
else
788788
priv->interface = gfar_get_interface(dev);
789789

790-
if (of_find_property(np, "fsl,magic-packet", NULL))
790+
if (of_property_read_bool(np, "fsl,magic-packet"))
791791
priv->device_flags |= FSL_GIANFAR_DEV_HAS_MAGIC_PACKET;
792792

793-
if (of_get_property(np, "fsl,wake-on-filer", NULL))
793+
if (of_property_read_bool(np, "fsl,wake-on-filer"))
794794
priv->device_flags |= FSL_GIANFAR_DEV_HAS_WAKE_ON_FILER;
795795

796796
priv->phy_node = of_parse_phandle(np, "phy-handle", 0);

drivers/net/ethernet/ibm/emac/core.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2939,9 +2939,9 @@ static int emac_init_config(struct emac_instance *dev)
29392939
}
29402940

29412941
/* Fixup some feature bits based on the device tree */
2942-
if (of_get_property(np, "has-inverted-stacr-oc", NULL))
2942+
if (of_property_read_bool(np, "has-inverted-stacr-oc"))
29432943
dev->features |= EMAC_FTR_STACR_OC_INVERT;
2944-
if (of_get_property(np, "has-new-stacr-staopc", NULL))
2944+
if (of_property_read_bool(np, "has-new-stacr-staopc"))
29452945
dev->features |= EMAC_FTR_HAS_NEW_STACR;
29462946

29472947
/* CAB lacks the appropriate properties */
@@ -3042,7 +3042,7 @@ static int emac_probe(struct platform_device *ofdev)
30423042
* property here for now, but new flat device trees should set a
30433043
* status property to "disabled" instead.
30443044
*/
3045-
if (of_get_property(np, "unused", NULL) || !of_device_is_available(np))
3045+
if (of_property_read_bool(np, "unused") || !of_device_is_available(np))
30463046
return -ENODEV;
30473047

30483048
/* Find ourselves in the bootlist if we are there */
@@ -3333,7 +3333,7 @@ static void __init emac_make_bootlist(void)
33333333

33343334
if (of_match_node(emac_match, np) == NULL)
33353335
continue;
3336-
if (of_get_property(np, "unused", NULL))
3336+
if (of_property_read_bool(np, "unused"))
33373337
continue;
33383338
idx = of_get_property(np, "cell-index", NULL);
33393339
if (idx == NULL)

drivers/net/ethernet/ibm/emac/rgmii.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ static int rgmii_probe(struct platform_device *ofdev)
242242
}
243243

244244
/* Check for RGMII flags */
245-
if (of_get_property(ofdev->dev.of_node, "has-mdio", NULL))
245+
if (of_property_read_bool(ofdev->dev.of_node, "has-mdio"))
246246
dev->flags |= EMAC_RGMII_FLAG_HAS_MDIO;
247247

248248
/* CAB lacks the right properties, fix this up */

drivers/net/ethernet/stmicro/stmmac/dwmac-imx.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -213,8 +213,7 @@ imx_dwmac_parse_dt(struct imx_priv_data *dwmac, struct device *dev)
213213
struct device_node *np = dev->of_node;
214214
int err = 0;
215215

216-
if (of_get_property(np, "snps,rmii_refclk_ext", NULL))
217-
dwmac->rmii_refclk_ext = true;
216+
dwmac->rmii_refclk_ext = of_property_read_bool(np, "snps,rmii_refclk_ext");
218217

219218
dwmac->clk_tx = devm_clk_get(dev, "tx");
220219
if (IS_ERR(dwmac->clk_tx)) {

drivers/net/ethernet/sun/niu.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9271,7 +9271,7 @@ static int niu_get_of_props(struct niu *np)
92719271
if (model)
92729272
strcpy(np->vpd.model, model);
92739273

9274-
if (of_find_property(dp, "hot-swappable-phy", NULL)) {
9274+
if (of_property_read_bool(dp, "hot-swappable-phy")) {
92759275
np->flags |= (NIU_FLAGS_10G | NIU_FLAGS_FIBER |
92769276
NIU_FLAGS_HOTPLUG_PHY);
92779277
}

0 commit comments

Comments
 (0)