aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/of
diff options
context:
space:
mode:
authorSergei Shtylyov <sergei.shtylyov@cogentembedded.com>2017-08-13 00:03:06 +0300
committerDavid S. Miller <davem@davemloft.net>2017-08-13 20:07:26 -0700
commit5a7a8346498c02bbb0d6512c561f1dbfab0fcf62 (patch)
tree2977b1d9dee10cc3cc0b570899f0147c3f89dafb /drivers/of
parentMerge branch 'vrf-Support-for-local-traffic-with-sockets-bound-to-enslaved-devices' (diff)
downloadlinux-dev-5a7a8346498c02bbb0d6512c561f1dbfab0fcf62.tar.xz
linux-dev-5a7a8346498c02bbb0d6512c561f1dbfab0fcf62.zip
of_mdio: merge branch tails in of_phy_register_fixed_link()
Looks like gcc isn't always able to figure out that 3 *if* branches in of_phy_register_fixed_link() calling fixed_phy_register() at their ends are similar enough and thus can be merged. The "manual" merge saves 40 bytes of the object code (AArch64 gcc 4.8.5), and still saves 12 bytes even if gcc was able to merge the branch tails (ARM gcc 4.8.5)... Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/of')
-rw-r--r--drivers/of/of_mdio.c23
1 files changed, 11 insertions, 12 deletions
diff --git a/drivers/of/of_mdio.c b/drivers/of/of_mdio.c
index 94ca3470e943..b14a00034fb1 100644
--- a/drivers/of/of_mdio.c
+++ b/drivers/of/of_mdio.c
@@ -422,16 +422,13 @@ int of_phy_register_fixed_link(struct device_node *np)
struct fixed_phy_status status = {};
struct device_node *fixed_link_node;
u32 fixed_link_prop[5];
- struct phy_device *phy;
const char *managed;
- int link_gpio;
+ int link_gpio = -1;
- if (of_property_read_string(np, "managed", &managed) == 0) {
- if (strcmp(managed, "in-band-status") == 0) {
- /* status is zeroed, namely its .link member */
- phy = fixed_phy_register(PHY_POLL, &status, -1, np);
- return PTR_ERR_OR_ZERO(phy);
- }
+ if (of_property_read_string(np, "managed", &managed) == 0 &&
+ strcmp(managed, "in-band-status") == 0) {
+ /* status is zeroed, namely its .link member */
+ goto register_phy;
}
/* New binding */
@@ -454,8 +451,7 @@ int of_phy_register_fixed_link(struct device_node *np)
if (link_gpio == -EPROBE_DEFER)
return -EPROBE_DEFER;
- phy = fixed_phy_register(PHY_POLL, &status, link_gpio, np);
- return PTR_ERR_OR_ZERO(phy);
+ goto register_phy;
}
/* Old binding */
@@ -466,11 +462,14 @@ int of_phy_register_fixed_link(struct device_node *np)
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);
+ goto register_phy;
}
return -ENODEV;
+
+register_phy:
+ return PTR_ERR_OR_ZERO(fixed_phy_register(PHY_POLL, &status, link_gpio,
+ np));
}
EXPORT_SYMBOL(of_phy_register_fixed_link);