Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751965AbdFIJMj (ORCPT ); Fri, 9 Jun 2017 05:12:39 -0400 Received: from rtits2.realtek.com ([211.75.126.72]:41070 "EHLO rtits2.realtek.com.tw" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751519AbdFIJMg (ORCPT ); Fri, 9 Jun 2017 05:12:36 -0400 Authenticated-By: X-SpamFilter-By: BOX Solutions SpamTrap 5.59 with qID v599CYQs015370, This message is accepted by code: ctloc85258 From: Hayes Wang To: CC: , , , Hayes Wang Subject: [PATCH net-next 08/11] r8152: move the initialization to reset_resume function Date: Fri, 9 Jun 2017 17:11:45 +0800 Message-ID: <1394712342-15778-268-Taiwan-albertk@realtek.com> X-Mailer: Microsoft Office Outlook 11 In-Reply-To: <1394712342-15778-260-Taiwan-albertk@realtek.com> References: <1394712342-15778-260-Taiwan-albertk@realtek.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [172.21.177.200] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1225 Lines: 38 Move tp->rtl_ops.init() from rtl8152_resume() to rtl8152_reset_resume(). The initialization is only necessary for reset_resume(). Signed-off-by: Hayes Wang --- drivers/net/usb/r8152.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c index f78111c..f43b7a8 100644 --- a/drivers/net/usb/r8152.c +++ b/drivers/net/usb/r8152.c @@ -3776,11 +3776,8 @@ static int rtl8152_resume(struct usb_interface *intf) mutex_lock(&tp->control); - if (!test_bit(SELECTIVE_SUSPEND, &tp->flags)) { - tp->rtl_ops.init(tp); - queue_delayed_work(system_long_wq, &tp->hw_phy_work, 0); + if (!test_bit(SELECTIVE_SUSPEND, &tp->flags)) netif_device_attach(netdev); - } if (netif_running(netdev) && netdev->flags & IFF_UP) { if (test_bit(SELECTIVE_SUSPEND, &tp->flags)) { @@ -3826,6 +3823,10 @@ static int rtl8152_reset_resume(struct usb_interface *intf) struct r8152 *tp = usb_get_intfdata(intf); clear_bit(SELECTIVE_SUSPEND, &tp->flags); + mutex_lock(&tp->control); + tp->rtl_ops.init(tp); + queue_delayed_work(system_long_wq, &tp->hw_phy_work, 0); + mutex_unlock(&tp->control); return rtl8152_resume(intf); } -- 2.7.4