From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4F23AC3E8AB for ; Sat, 5 Oct 2019 12:12:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 26E212084D for ; Sat, 5 Oct 2019 12:12:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728128AbfJEMM1 (ORCPT ); Sat, 5 Oct 2019 08:12:27 -0400 Received: from kirsty.vergenet.net ([202.4.237.240]:42346 "EHLO kirsty.vergenet.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727033AbfJEMM1 (ORCPT ); Sat, 5 Oct 2019 08:12:27 -0400 Received: from penelope.horms.nl (ip4dab7138.direct-adsl.nl [77.171.113.56]) by kirsty.vergenet.net (Postfix) with ESMTPA id D5A3125B7B0; Sat, 5 Oct 2019 22:12:24 +1000 (AEST) Received: by penelope.horms.nl (Postfix, from userid 7100) id AFB91E22CAB; Sat, 5 Oct 2019 14:12:22 +0200 (CEST) Date: Sat, 5 Oct 2019 14:12:22 +0200 From: Simon Horman To: Kai-Heng Feng Cc: David Miller , hayeswang@realtek.com, mario.limonciello@dell.com, linux-usb@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] r8152: Set macpassthru in reset_resume callback Message-ID: <20191005121222.6szwmuc4tjws4z23@verge.net.au> References: <20191004125104.13202-1-kai.heng.feng@canonical.com> <20191005114634.wvv4yfdte7qchzxs@verge.net.au> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Organisation: Horms Solutions BV User-Agent: NeoMutt/20170113 (1.7.2) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Oct 05, 2019 at 07:54:15PM +0800, Kai-Heng Feng wrote: > > > > On Oct 5, 2019, at 19:46, Simon Horman wrote: > > > > On Fri, Oct 04, 2019 at 08:51:04PM +0800, Kai-Heng Feng wrote: > >> r8152 may fail to establish network connection after resume from system > >> suspend. > >> > >> If the USB port connects to r8152 lost its power during system suspend, > >> the MAC address was written before is lost. The reason is that The MAC > >> address doesn't get written again in its reset_resume callback. > >> > >> So let's set MAC address again in reset_resume callback. Also remove > >> unnecessary lock as no other locking attempt will happen during > >> reset_resume. > > > > This is two separate seemingly unrelated, other than locality in the code, > > changes. One is a fix, the other seems to be a cleanup. Perhaps they would > > be better addressed in separate patches. > > rtl8152_set_mac_address() which gets called by set_ethernet_addr(), also holds the same mutex. > So this is more then a cleanup and I should mention it in commit log. Thanks, I agree that is a good idea. > Kai-Heng > > > > >> Signed-off-by: Kai-Heng Feng > >> --- > >> drivers/net/usb/r8152.c | 3 +-- > >> 1 file changed, 1 insertion(+), 2 deletions(-) > >> > >> diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c > >> index 08726090570e..cee9fef925cd 100644 > >> --- a/drivers/net/usb/r8152.c > >> +++ b/drivers/net/usb/r8152.c > >> @@ -4799,10 +4799,9 @@ 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); > >> + set_ethernet_addr(tp); > >> return rtl8152_resume(intf); > >> } > >> > >> -- > >> 2.17.1 > >> >