aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSergei Shtylyov <sergei.shtylyov@cogentembedded.com>2017-08-27 15:55:09 -0400
committerTejun Heo <tj@kernel.org>2017-08-28 13:44:24 -0400
commitbe1dc3fb290beb394551b8cee45d03e6375b28e6 (patch)
tree164340b5f6d0385abadeb1b4070efce1ed75685a
parent591b6bb605785c12a21e8b07a08a277065b655a5 (diff)
pata_octeon_cf: use of_property_read_{bool|u32}()
The Octeon CF driver basically open-codes of_property_read_{bool|u32}() using of_{find|get}_property() calls in its probe() method. Using the modern DT APIs saves 2 LoCs and 16 bytes of object code (MIPS gcc 3.4.3). Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com> Signed-off-by: Tejun Heo <tj@kernel.org>
-rw-r--r--drivers/ata/pata_octeon_cf.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/drivers/ata/pata_octeon_cf.c b/drivers/ata/pata_octeon_cf.c
index 1ba03d6df951..d3d851b014a3 100644
--- a/drivers/ata/pata_octeon_cf.c
+++ b/drivers/ata/pata_octeon_cf.c
@@ -840,7 +840,6 @@ static int octeon_cf_probe(struct platform_device *pdev)
840 struct property *reg_prop; 840 struct property *reg_prop;
841 int n_addr, n_size, reg_len; 841 int n_addr, n_size, reg_len;
842 struct device_node *node; 842 struct device_node *node;
843 const void *prop;
844 void __iomem *cs0; 843 void __iomem *cs0;
845 void __iomem *cs1 = NULL; 844 void __iomem *cs1 = NULL;
846 struct ata_host *host; 845 struct ata_host *host;
@@ -850,7 +849,7 @@ static int octeon_cf_probe(struct platform_device *pdev)
850 void __iomem *base; 849 void __iomem *base;
851 struct octeon_cf_port *cf_port; 850 struct octeon_cf_port *cf_port;
852 int rv = -ENOMEM; 851 int rv = -ENOMEM;
853 852 u32 bus_width;
854 853
855 node = pdev->dev.of_node; 854 node = pdev->dev.of_node;
856 if (node == NULL) 855 if (node == NULL)
@@ -860,11 +859,10 @@ static int octeon_cf_probe(struct platform_device *pdev)
860 if (!cf_port) 859 if (!cf_port)
861 return -ENOMEM; 860 return -ENOMEM;
862 861
863 cf_port->is_true_ide = (of_find_property(node, "cavium,true-ide", NULL) != NULL); 862 cf_port->is_true_ide = of_property_read_bool(node, "cavium,true-ide");
864 863
865 prop = of_get_property(node, "cavium,bus-width", NULL); 864 if (of_property_read_u32(node, "cavium,bus-width", &bus_width) == 0)
866 if (prop) 865 is_16bit = (bus_width == 16);
867 is_16bit = (be32_to_cpup(prop) == 16);
868 else 866 else
869 is_16bit = false; 867 is_16bit = false;
870 868