Commit e1e0a32e authored by Rob Herring's avatar Rob Herring Committed by Damien Le Moal

ata: Use of_property_present() for testing DT property presence

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. As
part of this, convert of_get_property/of_find_property calls to the
recently added of_property_present() helper when we just want to test
for presence of a property and nothing more.
Signed-off-by: default avatarRob Herring <robh@kernel.org>
Signed-off-by: default avatarDamien Le Moal <damien.lemoal@opensource.wdc.com>
parent 71424f05
...@@ -106,7 +106,7 @@ static int mtk_ahci_parse_property(struct ahci_host_priv *hpriv, ...@@ -106,7 +106,7 @@ static int mtk_ahci_parse_property(struct ahci_host_priv *hpriv,
struct device_node *np = dev->of_node; struct device_node *np = dev->of_node;
/* enable SATA function if needed */ /* enable SATA function if needed */
if (of_find_property(np, "mediatek,phy-mode", NULL)) { if (of_property_present(np, "mediatek,phy-mode")) {
plat->mode = syscon_regmap_lookup_by_phandle( plat->mode = syscon_regmap_lookup_by_phandle(
np, "mediatek,phy-mode"); np, "mediatek,phy-mode");
if (IS_ERR(plat->mode)) { if (IS_ERR(plat->mode)) {
......
...@@ -363,7 +363,7 @@ static int ahci_platform_get_phy(struct ahci_host_priv *hpriv, u32 port, ...@@ -363,7 +363,7 @@ static int ahci_platform_get_phy(struct ahci_host_priv *hpriv, u32 port,
switch (rc) { switch (rc) {
case -ENOSYS: case -ENOSYS:
/* No PHY support. Check if PHY is required. */ /* No PHY support. Check if PHY is required. */
if (of_find_property(node, "phys", NULL)) { if (of_property_present(node, "phys")) {
dev_err(dev, dev_err(dev,
"couldn't get PHY in node %pOFn: ENOSYS\n", "couldn't get PHY in node %pOFn: ENOSYS\n",
node); node);
......
...@@ -810,7 +810,7 @@ static int sata_dwc_dma_get_channel(struct sata_dwc_device_port *hsdevp) ...@@ -810,7 +810,7 @@ static int sata_dwc_dma_get_channel(struct sata_dwc_device_port *hsdevp)
struct device *dev = hsdev->dev; struct device *dev = hsdev->dev;
#ifdef CONFIG_SATA_DWC_OLD_DMA #ifdef CONFIG_SATA_DWC_OLD_DMA
if (!of_find_property(dev->of_node, "dmas", NULL)) if (!of_property_present(dev->of_node, "dmas"))
return sata_dwc_dma_get_channel_old(hsdevp); return sata_dwc_dma_get_channel_old(hsdevp);
#endif #endif
...@@ -1180,7 +1180,7 @@ static int sata_dwc_probe(struct platform_device *ofdev) ...@@ -1180,7 +1180,7 @@ static int sata_dwc_probe(struct platform_device *ofdev)
} }
#ifdef CONFIG_SATA_DWC_OLD_DMA #ifdef CONFIG_SATA_DWC_OLD_DMA
if (!of_find_property(np, "dmas", NULL)) { if (!of_property_present(np, "dmas")) {
err = sata_dwc_dma_init_old(ofdev, hsdev); err = sata_dwc_dma_init_old(ofdev, hsdev);
if (err) if (err)
return err; return err;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment