diff options
Diffstat (limited to 'patches/0479-sh_eth-get-Ether-port-only-when-needed.patch')
-rw-r--r-- | patches/0479-sh_eth-get-Ether-port-only-when-needed.patch | 78 |
1 files changed, 78 insertions, 0 deletions
diff --git a/patches/0479-sh_eth-get-Ether-port-only-when-needed.patch b/patches/0479-sh_eth-get-Ether-port-only-when-needed.patch new file mode 100644 index 00000000000000..2a41aec90a057d --- /dev/null +++ b/patches/0479-sh_eth-get-Ether-port-only-when-needed.patch @@ -0,0 +1,78 @@ +From b9465449b4bf3becd1713292c7908a9e642377e7 Mon Sep 17 00:00:00 2001 +From: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com> +Date: Sun, 14 Jan 2018 20:47:44 +0300 +Subject: [PATCH 0479/1795] sh_eth: get Ether port # only when needed + +The dual-port Ether configurations always have a shared TSU to e.g. pass +the packets between those ports. With the TSU init. code gathered under +the single *if*, we now can only get the port # from 'platform_device::id' +only when we actually need it (and not recalculate it each time)... + +Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com> +Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be> +Signed-off-by: David S. Miller <davem@davemloft.net> +(cherry picked from commit 9662ec19229c89825acac1d62a9d78fb89f8dda5) +Signed-off-by: Simon Horman <horms+renesas@verge.net.au> +Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> +--- + drivers/net/ethernet/renesas/sh_eth.c | 13 +++++-------- + 1 file changed, 5 insertions(+), 8 deletions(-) + +diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c +index 7a56c59476d6..f17cb74c03e9 100644 +--- a/drivers/net/ethernet/renesas/sh_eth.c ++++ b/drivers/net/ethernet/renesas/sh_eth.c +@@ -3102,7 +3102,7 @@ static int sh_eth_drv_probe(struct platform_device *pdev) + const struct platform_device_id *id = platform_get_device_id(pdev); + struct sh_eth_private *mdp; + struct net_device *ndev; +- int ret, devno; ++ int ret; + + /* get base addr */ + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); +@@ -3114,10 +3114,6 @@ static int sh_eth_drv_probe(struct platform_device *pdev) + pm_runtime_enable(&pdev->dev); + pm_runtime_get_sync(&pdev->dev); + +- devno = pdev->id; +- if (devno < 0) +- devno = 0; +- + ret = platform_get_irq(pdev, 0); + if (ret < 0) + goto out_release; +@@ -3200,6 +3196,7 @@ static int sh_eth_drv_probe(struct platform_device *pdev) + } + + if (mdp->cd->tsu) { ++ int port = pdev->id < 0 ? 0 : pdev->id % 2; + struct resource *rtsu; + + rtsu = platform_get_resource(pdev, IORESOURCE_MEM, 1); +@@ -3211,7 +3208,7 @@ static int sh_eth_drv_probe(struct platform_device *pdev) + /* We can only request the TSU region for the first port + * of the two sharing this TSU for the probe to succeed... + */ +- if (devno % 2 == 0 && ++ if (port == 0 && + !devm_request_mem_region(&pdev->dev, rtsu->start, + resource_size(rtsu), + dev_name(&pdev->dev))) { +@@ -3227,11 +3224,11 @@ static int sh_eth_drv_probe(struct platform_device *pdev) + ret = -ENOMEM; + goto out_release; + } +- mdp->port = devno % 2; ++ mdp->port = port; + ndev->features = NETIF_F_HW_VLAN_CTAG_FILTER; + + /* Need to init only the first port of the two sharing a TSU */ +- if (devno % 2 == 0) { ++ if (port == 0) { + if (mdp->cd->chip_reset) + mdp->cd->chip_reset(ndev); + +-- +2.19.0 + |