Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp99335pxu; Tue, 5 Jan 2021 06:14:37 -0800 (PST) X-Google-Smtp-Source: ABdhPJyBEPVGtyV/mklEAwmjqhX0CzGFnnJnDrHa/Ip5Y3tt5I7cYabNcFJ2YBfokr6y2VGDAoC2 X-Received: by 2002:a17:906:c414:: with SMTP id u20mr69432687ejz.511.1609856077279; Tue, 05 Jan 2021 06:14:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609856077; cv=none; d=google.com; s=arc-20160816; b=tqGTW+ZouRs1l6dOTWyTyEjhT6uQpLA4H8PBHRXQDZC23vo4ocE3OMeauKEV7f1lZn 9glPAwiUZEB2hxPQXVQ1NtIG5xOhp59CVNEGUuremInyq8moRIPMc2gVxlQmT8mj4PFv QM6/1GCz5DK5f7Iix4V/iTqvmedPsycfDIuWPb3nyn2F9L+csXLz4WAmQglVWglT+jJf aC1m3EGXDxgOiJ4fMx6ug6N05ppBhl3b06lq6csu3Wb5SYT08Wx5VoF0QnNeCcVj/zDU rPY0Ncc7QErwSXIOXewQka0cydtMzTN3DItzy0JOOFEi4gpNBZTb8c27ovDOaX5RzsPe 5Lqg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=PWT2zoyvRxKR4U4a5qNj1r1Qpi8n8uhVgpe+irFIcgA=; b=mXqrx0h92yu4RxhA3h9ishvQ9BIrVdO6Fii6su1fdpER4CduE/bC+S+DosbZAa9WaH IE5pNX35OvRlLhYGyVl1XpMhEfavTGtOnl7LTUukxuCJvxzS4iEbwAmMtJoUkrO4bKFz Z5ozxZ/O1sFvC/OPyNwqpdg41LRaKiM7qPju0cABE77AI7MM4fPzLyUIot+UfqFMsUKq gRvSPj8tvzBXENW8HmGP37mjhdqDBYp7h8uS18Zf3GEc55o+qAR3FFufcH5Lxe4v7lNY yPDp2Pm6oJBHkB/Bw7e3sZOvT0Z/3jBUZ+9umPKHK58tl4U2RBrOtuOXRTjUa0HaRzWj y3ug== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ay25si34412986edb.8.2021.01.05.06.14.10; Tue, 05 Jan 2021 06:14:37 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728795AbhAEOLJ (ORCPT + 99 others); Tue, 5 Jan 2021 09:11:09 -0500 Received: from vps0.lunn.ch ([185.16.172.187]:50172 "EHLO vps0.lunn.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726961AbhAEOLI (ORCPT ); Tue, 5 Jan 2021 09:11:08 -0500 Received: from andrew by vps0.lunn.ch with local (Exim 4.94) (envelope-from ) id 1kwn2L-00GAxa-O1; Tue, 05 Jan 2021 15:10:13 +0100 Date: Tue, 5 Jan 2021 15:10:13 +0100 From: Andrew Lunn To: Geert Uytterhoeven Cc: Ioana Ciornei , Heiner Kallweit , "David S . Miller" , Jakub Kicinski , Russell King , Wolfram Sang , Sergei Shtylyov , "netdev@vger.kernel.org" , "linux-renesas-soc@vger.kernel.org" , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH] [RFC] net: phy: Fix reboot crash if CONFIG_IP_PNP is not set Message-ID: References: <20210104122415.1263541-1-geert+renesas@glider.be> <20210104145331.tlwjwbzey5i4vgvp@skbuf> <20210104170112.hn6t3kojhifyuaf6@skbuf> <20210104184341.szvnl24wnfnxg4k7@skbuf> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > I added a statically-linked ethtool binary to my initramfs, and can > confirm that retrieving the PHY statistics does not access the PHY > registers when the device is suspended: > > # ethtool --phy-statistics eth0 > no stats available > # ifconfig eth0 up > # ethtool --phy-statistics eth0 > PHY statistics: > phy_receive_errors: 0 > phy_idle_errors: 0 > # > > In the past, we've gone to great lengths to avoid accessing the PHY > registers when the device is suspended, usually in the statistics > handling (see e.g. [1][2]). I would argue that is the wrong approach. The PHY device is a device. It has its own lifetime. You would not suspend a PCI bus controller without first suspending all PCI devices on the bus etc. > +static int sh_mdiobb_read(struct mii_bus *bus, int phy, int reg) > +{ > + struct bb_info *bb = container_of(bus->priv, struct bb_info, ctrl); mii_bus->parent should give you dev, so there is no need to add it to bb_info. > + /* Wrap accessors with Runtime PM-aware ops */ > + bitbang->read = mdp->mii_bus->read; > + bitbang->write = mdp->mii_bus->write; > + mdp->mii_bus->read = sh_mdiobb_read; > + mdp->mii_bus->write = sh_mdiobb_write; I did wonder about just exporting the two functions so you can directly call them. Otherwise, this looks good. Andrew