* [PATCH net-next 1/3] r8152: remove rtl_phy_reset function
2016-07-07 7:09 [PATCH net-next 0/3] r8152: remove the redundant code Hayes Wang
@ 2016-07-07 7:09 ` Hayes Wang
2016-07-07 7:09 ` [PATCH net-next 2/3] r8152: remove a netif_carrier_off in rtl8152_open function Hayes Wang
` (2 subsequent siblings)
3 siblings, 0 replies; 6+ messages in thread
From: Hayes Wang @ 2016-07-07 7:09 UTC (permalink / raw)
To: netdev; +Cc: nic_swsd, linux-kernel, linux-usb, Hayes Wang
In rtl_hw_phy_work_func_t(), the flag of PHY_RESET is set in
rtl_ops.hw_phy_cfg() and cleared in rtl8152_set_speed(). Therefore,
the rtl_phy_reset() is never run and is unnecessary.
Signed-off-by: Hayes Wang <hayeswang@realtek.com>
---
drivers/net/usb/r8152.c | 24 ------------------------
1 file changed, 24 deletions(-)
diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c
index b225bc2..e005ee6 100644
--- a/drivers/net/usb/r8152.c
+++ b/drivers/net/usb/r8152.c
@@ -2450,27 +2450,6 @@ static void rtl8153_runtime_enable(struct r8152 *tp, bool enable)
}
}
-static void rtl_phy_reset(struct r8152 *tp)
-{
- u16 data;
- int i;
-
- data = r8152_mdio_read(tp, MII_BMCR);
-
- /* don't reset again before the previous one complete */
- if (data & BMCR_RESET)
- return;
-
- data |= BMCR_RESET;
- r8152_mdio_write(tp, MII_BMCR, data);
-
- for (i = 0; i < 50; i++) {
- msleep(20);
- if ((r8152_mdio_read(tp, MII_BMCR) & BMCR_RESET) == 0)
- break;
- }
-}
-
static void r8153_teredo_off(struct r8152 *tp)
{
u32 ocp_data;
@@ -3069,9 +3048,6 @@ static void rtl_work_func_t(struct work_struct *work)
netif_carrier_ok(tp->netdev))
napi_schedule(&tp->napi);
- if (test_and_clear_bit(PHY_RESET, &tp->flags))
- rtl_phy_reset(tp);
-
mutex_unlock(&tp->control);
out1:
--
2.7.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH net-next 2/3] r8152: remove a netif_carrier_off in rtl8152_open function
2016-07-07 7:09 [PATCH net-next 0/3] r8152: remove the redundant code Hayes Wang
2016-07-07 7:09 ` [PATCH net-next 1/3] r8152: remove rtl_phy_reset function Hayes Wang
@ 2016-07-07 7:09 ` Hayes Wang
2016-07-07 7:09 ` [PATCH net-next 3/3] r8152: remove cancel_delayed_work_sync in rtl8152_set_speed Hayes Wang
2016-07-09 21:48 ` David Miller
3 siblings, 0 replies; 6+ messages in thread
From: Hayes Wang @ 2016-07-07 7:09 UTC (permalink / raw)
To: netdev; +Cc: nic_swsd, linux-kernel, linux-usb, Hayes Wang
After commit 90186af404ad ("r8152: fix lockup when runtime PM is enabled"),
the autoresume wouldn't start the device before rtl8152_open() is finished.
Therefore, we don't have to reset the linking status before and after
autoresume. That is, one of netif_carrier_off() in rtl8152_open() could be
removed.
Signed-off-by: Hayes Wang <hayeswang@realtek.com>
---
drivers/net/usb/r8152.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c
index e005ee6..f1c5020 100644
--- a/drivers/net/usb/r8152.c
+++ b/drivers/net/usb/r8152.c
@@ -3111,8 +3111,6 @@ static int rtl8152_open(struct net_device *netdev)
if (res)
goto out;
- netif_carrier_off(netdev);
-
res = usb_autopm_get_interface(tp->intf);
if (res < 0) {
free_all_mem(tp);
--
2.7.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH net-next 3/3] r8152: remove cancel_delayed_work_sync in rtl8152_set_speed
2016-07-07 7:09 [PATCH net-next 0/3] r8152: remove the redundant code Hayes Wang
2016-07-07 7:09 ` [PATCH net-next 1/3] r8152: remove rtl_phy_reset function Hayes Wang
2016-07-07 7:09 ` [PATCH net-next 2/3] r8152: remove a netif_carrier_off in rtl8152_open function Hayes Wang
@ 2016-07-07 7:09 ` Hayes Wang
2016-07-09 21:48 ` David Miller
3 siblings, 0 replies; 6+ messages in thread
From: Hayes Wang @ 2016-07-07 7:09 UTC (permalink / raw)
To: netdev; +Cc: nic_swsd, linux-kernel, linux-usb, Hayes Wang
There is no conflict between the work_queue function and
rtl8152_set_speed(), so we don't have to cancel the delayed work in
rtl8152_set_speed().
Signed-off-by: Hayes Wang <hayeswang@realtek.com>
---
drivers/net/usb/r8152.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c
index f1c5020..168a8e2 100644
--- a/drivers/net/usb/r8152.c
+++ b/drivers/net/usb/r8152.c
@@ -2829,7 +2829,6 @@ static int rtl8152_set_speed(struct r8152 *tp, u8 autoneg, u16 speed, u8 duplex)
u16 bmcr, anar, gbcr;
int ret = 0;
- cancel_delayed_work_sync(&tp->schedule);
anar = r8152_mdio_read(tp, MII_ADVERTISE);
anar &= ~(ADVERTISE_10HALF | ADVERTISE_10FULL |
ADVERTISE_100HALF | ADVERTISE_100FULL);
--
2.7.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH net-next 0/3] r8152: remove the redundant code
@ 2016-07-09 21:48 ` David Miller
0 siblings, 0 replies; 6+ messages in thread
From: David Miller @ 2016-07-09 21:48 UTC (permalink / raw)
To: hayeswang; +Cc: netdev, nic_swsd, linux-kernel, linux-usb
From: Hayes Wang <hayeswang@realtek.com>
Date: Thu, 7 Jul 2016 15:09:17 +0800
> Remove the unnacessary code.
Series applied.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH net-next 0/3] r8152: remove the redundant code
@ 2016-07-09 21:48 ` David Miller
0 siblings, 0 replies; 6+ messages in thread
From: David Miller @ 2016-07-09 21:48 UTC (permalink / raw)
To: hayeswang-Rasf1IRRPZFBDgjK7y7TUQ
Cc: netdev-u79uwXL29TY76Z2rM5mHXA, nic_swsd-Rasf1IRRPZFBDgjK7y7TUQ,
linux-kernel-u79uwXL29TY76Z2rM5mHXA,
linux-usb-u79uwXL29TY76Z2rM5mHXA
From: Hayes Wang <hayeswang-Rasf1IRRPZFBDgjK7y7TUQ@public.gmane.org>
Date: Thu, 7 Jul 2016 15:09:17 +0800
> Remove the unnacessary code.
Series applied.
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 6+ messages in thread