Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp2078098ybp; Sat, 5 Oct 2019 05:18:01 -0700 (PDT) X-Google-Smtp-Source: APXvYqzAXl9u4Zyw4oLw/mkUgcLlzP2k02PAZnHPyDjXhmWyUrgC5+X1A99p7kvFzlUfAldN7HAc X-Received: by 2002:a50:9a05:: with SMTP id o5mr20363742edb.44.1570277881570; Sat, 05 Oct 2019 05:18:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570277881; cv=none; d=google.com; s=arc-20160816; b=qqsbNhNelToywhYUVesdENDv3Q1Lp/BAmGEPKMorC0Z+ncDJKCqiRlsG/y2NE0lcls V8Bg7ZjQvJVfWdrgMkP1dkpG1oCRfnu2bE0asL/692XlAmufSRPSUVwEw+iXYgr7492/ xWwLDn2nUrvea9nnBS3cqoH56pAIV2l8h9po8Mf5LIoViIQH0FFHXIFWVVQOeef7foMZ 2QSLQHADhjw3EfGlmQ99DD9j12pFr810RGPVDiRJMhOMAePkoSL1+Hkhzkp1G2eUG7IN jXwYk0V1FMA7vd/3eeEBQAZRXrirsb3BeYYVAYrGUQbh2Z8OYmQimZjS5hWjq8wYkQGy jNTA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:organisation:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=+iJEuWm6nc8sL86pS8p3ponR2RaNBoSixBCk2d+Uth4=; b=mIhjamZn5kvJRe++8tQSNOv41/46M90cxduANShXrt3kSkYfBTXYlX7eYa56waCaVS j/v6BtmiBZJnUTDp4BNv3FjrSSdZy/xNEC7lF+AlsYxK6qFEMlf2YbHZETDUp3Do+EBp kNe/hFHKy77O8mAxMNDVvCYCQqtJFsYTOha0ik203azXaTBsK3Ryacs2XYFF8f6Q+2Zw NDcCM3rzfoiEoCsAZX7Z+Q29mKzJ3Ssl7V8fwAmtekIZj4A93Or33NtJfpmARVAPf1Lm 9XX5Q9/ctLesRcYC9uVFIk8BSrZQvFcgDaY5J4puPOp33tarS2g1qv/4XF4whg/qDjf8 Wdew== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j35si6095062eda.144.2019.10.05.05.17.32; Sat, 05 Oct 2019 05:18:01 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728086AbfJEMM1 (ORCPT + 99 others); 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 > >> >