提交 5a7a8346 编写于 作者: S Sergei Shtylyov 提交者: David S. Miller

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: NSergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 19a2afbe
...@@ -422,16 +422,13 @@ int of_phy_register_fixed_link(struct device_node *np) ...@@ -422,16 +422,13 @@ int of_phy_register_fixed_link(struct device_node *np)
struct fixed_phy_status status = {}; struct fixed_phy_status status = {};
struct device_node *fixed_link_node; struct device_node *fixed_link_node;
u32 fixed_link_prop[5]; u32 fixed_link_prop[5];
struct phy_device *phy;
const char *managed; const char *managed;
int link_gpio; int link_gpio = -1;
if (of_property_read_string(np, "managed", &managed) == 0) { if (of_property_read_string(np, "managed", &managed) == 0 &&
if (strcmp(managed, "in-band-status") == 0) { strcmp(managed, "in-band-status") == 0) {
/* status is zeroed, namely its .link member */ /* status is zeroed, namely its .link member */
phy = fixed_phy_register(PHY_POLL, &status, -1, np); goto register_phy;
return PTR_ERR_OR_ZERO(phy);
}
} }
/* New binding */ /* New binding */
...@@ -454,8 +451,7 @@ int of_phy_register_fixed_link(struct device_node *np) ...@@ -454,8 +451,7 @@ int of_phy_register_fixed_link(struct device_node *np)
if (link_gpio == -EPROBE_DEFER) if (link_gpio == -EPROBE_DEFER)
return -EPROBE_DEFER; return -EPROBE_DEFER;
phy = fixed_phy_register(PHY_POLL, &status, link_gpio, np); goto register_phy;
return PTR_ERR_OR_ZERO(phy);
} }
/* Old binding */ /* Old binding */
...@@ -466,11 +462,14 @@ int of_phy_register_fixed_link(struct device_node *np) ...@@ -466,11 +462,14 @@ int of_phy_register_fixed_link(struct device_node *np)
status.speed = fixed_link_prop[2]; status.speed = fixed_link_prop[2];
status.pause = fixed_link_prop[3]; status.pause = fixed_link_prop[3];
status.asym_pause = fixed_link_prop[4]; status.asym_pause = fixed_link_prop[4];
phy = fixed_phy_register(PHY_POLL, &status, -1, np); goto register_phy;
return PTR_ERR_OR_ZERO(phy);
} }
return -ENODEV; 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); EXPORT_SYMBOL(of_phy_register_fixed_link);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册