From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Lunn Subject: Re: [PATCH net-next 4/7] net: phy: add paged phy register accessors Date: Sun, 31 Dec 2017 09:10:39 +0100 Message-ID: <20171231081039.GA14485@lunn.ch> References: <20171229123024.GZ10595@n2100.armlinux.org.uk> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Florian Fainelli , netdev@vger.kernel.org To: Russell King Return-path: Received: from vps0.lunn.ch ([185.16.172.187]:49247 "EHLO vps0.lunn.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750724AbdLaIKn (ORCPT ); Sun, 31 Dec 2017 03:10:43 -0500 Content-Disposition: inline In-Reply-To: Sender: netdev-owner@vger.kernel.org List-ID: > +/** > + * phy_save_page() - take the bus lock and save the current page > + * @phydev: a pointer to a &struct phy_device > + * > + * Take the MDIO bus lock, and return the current page number. On error, > + * returns a negative errno. phy_restore_page() must be called after this > + * to release the lock even on failure. > + */ > +int phy_save_page(struct phy_device *phydev) > +{ > + mutex_lock(&phydev->mdio.bus->mdio_lock); > + return __phy_read_page(phydev); > +} > +EXPORT_SYMBOL_GPL(phy_save_page); > + > +/** > + * phy_select_page() - take the bus lock, save the current page, and set a page > + * @phydev: a pointer to a &struct phy_device > + * @page: desired page > + * > + * Take the MDIO bus lock to protect against concurrent access, save the > + * current PHY page, and set the current page. On error, returns a > + * negative errno, otherwise returns the previous page number. > + * phy_restore_page() must be called after this to restore the page > + * number (if this call was successful) and release the lock. Hi Russell This comment seems wrong. It looks like you need to call phy_restore_page() on error as well. I think the text in () should be removed, and add the "even on failure" which the previous function states. Andrew