Commit ea22f6dd authored by Saurabh Sengar's avatar Saurabh Sengar Committed by Luis Henriques

drivers: net: xgene: optimizing the code

BugLink: https://launchpad.net/bugs/1632739

this patch does the following:
1 .  remove unnecessary if, else condition
2 .  reduce one variable
3 .  change the return type of 2 functions to void as there return values
turn out to be 0 always after above changes
Signed-off-by: default avatarSaurabh Sengar <saurabh.truth@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
(cherry picked from commit 724fe695 yakkety)
Signed-off-by: default avatarCraig Magina <craig.magina@canonical.com>
Acked-by: default avatarTim Gardner <tim.gardner@canonical.com>
Acked-by: default avatarSeth Forshee <seth.forshee@canonical.com>
Signed-off-by: default avatarSeth Forshee <seth.forshee@canonical.com>
parent 360a44d4
......@@ -1148,7 +1148,7 @@ static const struct net_device_ops xgene_ndev_ops = {
};
#ifdef CONFIG_ACPI
static int xgene_get_port_id_acpi(struct device *dev,
static void xgene_get_port_id_acpi(struct device *dev,
struct xgene_enet_pdata *pdata)
{
acpi_status status;
......@@ -1161,24 +1161,19 @@ static int xgene_get_port_id_acpi(struct device *dev,
pdata->port_id = temp;
}
return 0;
return;
}
#endif
static int xgene_get_port_id_dt(struct device *dev, struct xgene_enet_pdata *pdata)
static void xgene_get_port_id_dt(struct device *dev, struct xgene_enet_pdata *pdata)
{
u32 id = 0;
int ret;
ret = of_property_read_u32(dev->of_node, "port-id", &id);
if (ret) {
pdata->port_id = 0;
ret = 0;
} else {
of_property_read_u32(dev->of_node, "port-id", &id);
pdata->port_id = id & BIT(0);
}
return ret;
return;
}
static int xgene_get_tx_delay(struct xgene_enet_pdata *pdata)
......@@ -1299,13 +1294,11 @@ static int xgene_enet_get_resources(struct xgene_enet_pdata *pdata)
}
if (dev->of_node)
ret = xgene_get_port_id_dt(dev, pdata);
xgene_get_port_id_dt(dev, pdata);
#ifdef CONFIG_ACPI
else
ret = xgene_get_port_id_acpi(dev, pdata);
xgene_get_port_id_acpi(dev, pdata);
#endif
if (ret)
return ret;
if (!device_get_mac_address(dev, ndev->dev_addr, ETH_ALEN))
eth_hw_addr_random(ndev);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment