diff options
author | Sergei Shtylyov <sergei.shtylyov@cogentembedded.com> | 2017-08-05 00:43:43 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-08-07 14:07:32 -0700 |
commit | d226a2b84d0528da7e35e7e19e052293889cdd21 (patch) | |
tree | 374898a27400270e2174eafaec9b98ac5238b9f8 | |
parent | e1cea2e7396820730ca98d53e986bd5241ef14cc (diff) | |
download | talos-obmc-linux-d226a2b84d0528da7e35e7e19e052293889cdd21.tar.gz talos-obmc-linux-d226a2b84d0528da7e35e7e19e052293889cdd21.zip |
of_mdio: use of_property_read_u32_array()
The "fixed-link" prop support predated of_property_read_u32_array(), so
basically had to open-code it. Using the modern API saves 24 bytes of the
object code (ARM gcc 4.8.5); the only behavior change would be that the
prop length check is now less strict (however the strict pre-check done
in of_phy_is_fixed_link() is left intact anyway)...
Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/of/of_mdio.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/drivers/of/of_mdio.c b/drivers/of/of_mdio.c index a0d27c04e22f..94ca3470e943 100644 --- a/drivers/of/of_mdio.c +++ b/drivers/of/of_mdio.c @@ -421,10 +421,10 @@ int of_phy_register_fixed_link(struct device_node *np) { struct fixed_phy_status status = {}; struct device_node *fixed_link_node; - const __be32 *fixed_link_prop; + u32 fixed_link_prop[5]; struct phy_device *phy; const char *managed; - int link_gpio, len; + int link_gpio; if (of_property_read_string(np, "managed", &managed) == 0) { if (strcmp(managed, "in-band-status") == 0) { @@ -459,13 +459,13 @@ int of_phy_register_fixed_link(struct device_node *np) } /* Old binding */ - fixed_link_prop = of_get_property(np, "fixed-link", &len); - if (fixed_link_prop && len == (5 * sizeof(__be32))) { + if (of_property_read_u32_array(np, "fixed-link", fixed_link_prop, + ARRAY_SIZE(fixed_link_prop)) == 0) { status.link = 1; - status.duplex = be32_to_cpu(fixed_link_prop[1]); - status.speed = be32_to_cpu(fixed_link_prop[2]); - status.pause = be32_to_cpu(fixed_link_prop[3]); - status.asym_pause = be32_to_cpu(fixed_link_prop[4]); + status.duplex = fixed_link_prop[1]; + status.speed = fixed_link_prop[2]; + status.pause = fixed_link_prop[3]; + status.asym_pause = fixed_link_prop[4]; phy = fixed_phy_register(PHY_POLL, &status, -1, np); return PTR_ERR_OR_ZERO(phy); } |