Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp2051241ybp; Sat, 5 Oct 2019 04:48:21 -0700 (PDT) X-Google-Smtp-Source: APXvYqwaTO6ml1JWAHwwcg0FzGFEOBwqorN4tpVEG1RB89nmghYmQzcCWfC0ZMcQ8v41u3HvUjG+ X-Received: by 2002:a50:baab:: with SMTP id x40mr20244787ede.60.1570276101399; Sat, 05 Oct 2019 04:48:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570276101; cv=none; d=google.com; s=arc-20160816; b=Hc00FDxEvTnJ1x1Qh203JFLvFLu+bnOdxkkJdixHcnMAfhwYVXiNpHIjCNN6tEZ6Pf 3qmmGe14QyJeLzv+woQZ1SD5LTlvbxbLyvMQbqGP3UavmsDyCy2MCkuSErSIZkQOY6uI SDFvm1qyaJT0xRYhobCmwPnc+44K+dhBxdwRl7Q32f3DNne89pkPDS9psdTewcaDbqA7 tE8b90GMRbT/vR1jRFA8gnseMq2DtTwPqx48wg7dn0dbJ0X6D87UvclLiQ2gseILjFRw 7jn0zrt3e84qxEWm0fq2rZfpwYioVRzJVjl7XVBhDgpnxRUwv5JwI/Tvu0UFkrS55PS3 gSuQ== 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=AEdSoNYmKA6ZB2+JncQ/e9svN52HgLTwWtDF/x7HQPk=; b=xAYSQJZoMr2Ty77espWsRQuO477yl3qtO3pWp+xsz8js8ryaRCmP4WrCCgVKJ6Lniu 4eHfuCVOU0EY0+N9BRd40jAbAOTiQv44wygnPlmMPLLqPYvuX+0wvL6xO2rCUUD8AFu2 zMiAsJ6J1l+YNQYetlIoAwGBsGwLJXHlgwncr2ceLjpHKwbHtIas6fBG/XGJzdSpifu4 6r7ByUA/jL7B28tf2TRQsMsnDuLMRFPrflFQxeEYmfbz8LTg87KOFF8jIkXhovahA/CN 5d418sR90S4+ADMtP4Tc5CkmsjXhjl1Egt3nZEAtbK1zB3fHC4V2bKo9rU3mYvxFAyaG /e6A== 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 pj21si4229046ejb.64.2019.10.05.04.47.56; Sat, 05 Oct 2019 04:48:21 -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 S1728348AbfJELqk (ORCPT + 99 others); Sat, 5 Oct 2019 07:46:40 -0400 Received: from kirsty.vergenet.net ([202.4.237.240]:41650 "EHLO kirsty.vergenet.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727990AbfJELqj (ORCPT ); Sat, 5 Oct 2019 07:46:39 -0400 Received: from penelope.horms.nl (ip4dab7138.direct-adsl.nl [77.171.113.56]) by kirsty.vergenet.net (Postfix) with ESMTPA id 8C01025B7B0; Sat, 5 Oct 2019 21:46:36 +1000 (AEST) Received: by penelope.horms.nl (Postfix, from userid 7100) id 85D9DE22CAB; Sat, 5 Oct 2019 13:46:34 +0200 (CEST) Date: Sat, 5 Oct 2019 13:46:34 +0200 From: Simon Horman To: Kai-Heng Feng Cc: davem@davemloft.net, 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: <20191005114634.wvv4yfdte7qchzxs@verge.net.au> References: <20191004125104.13202-1-kai.heng.feng@canonical.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191004125104.13202-1-kai.heng.feng@canonical.com> 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 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. > 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 >