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

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>

authored by

Sergei Shtylyov and committed by
Tejun Heo
be1dc3fb 591b6bb6

+4 -6
+4 -6
drivers/ata/pata_octeon_cf.c
··· 840 840 struct property *reg_prop; 841 841 int n_addr, n_size, reg_len; 842 842 struct device_node *node; 843 - const void *prop; 844 843 void __iomem *cs0; 845 844 void __iomem *cs1 = NULL; 846 845 struct ata_host *host; ··· 849 850 void __iomem *base; 850 851 struct octeon_cf_port *cf_port; 851 852 int rv = -ENOMEM; 852 - 853 + u32 bus_width; 853 854 854 855 node = pdev->dev.of_node; 855 856 if (node == NULL) ··· 859 860 if (!cf_port) 860 861 return -ENOMEM; 861 862 862 - cf_port->is_true_ide = (of_find_property(node, "cavium,true-ide", NULL) != NULL); 863 + cf_port->is_true_ide = of_property_read_bool(node, "cavium,true-ide"); 863 864 864 - prop = of_get_property(node, "cavium,bus-width", NULL); 865 - if (prop) 866 - is_16bit = (be32_to_cpup(prop) == 16); 865 + if (of_property_read_u32(node, "cavium,bus-width", &bus_width) == 0) 866 + is_16bit = (bus_width == 16); 867 867 else 868 868 is_16bit = false; 869 869