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.3 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_PASS,USER_AGENT_MUTT 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 AB180C169C4 for ; Fri, 8 Feb 2019 14:02:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 65F0620857 for ; Fri, 8 Feb 2019 14:02:10 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=lunn.ch header.i=@lunn.ch header.b="PECBsbH7" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727714AbfBHOCJ (ORCPT ); Fri, 8 Feb 2019 09:02:09 -0500 Received: from vps0.lunn.ch ([185.16.172.187]:43936 "EHLO vps0.lunn.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727677AbfBHOCJ (ORCPT ); Fri, 8 Feb 2019 09:02:09 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lunn.ch; s=20171124; h=In-Reply-To:Content-Type:MIME-Version:References:Message-ID: Subject:Cc:To:From:Date:Sender:Reply-To:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=wkSlmaKpIno0LKqHXA295Pm2toFVlIMHvyS0dHYoR3w=; b=PECBsbH77ULpaddiApoFR+lt1T ihVbmfO02hr3FRBjYKhXu2jGP45tz26ipjJ/kPoHeMNQi+AN31QqK+30xUqBi/wdljG59+Ridg0IB l3V/k/FGxLZgEwREBpddXEcw9x3KGiIyi4FS4Z40iNK1WeUoFrcrlFBfIreA0ZnD3+EY=; Received: from andrew by vps0.lunn.ch with local (Exim 4.89) (envelope-from ) id 1gs6jG-0007O8-NJ; Fri, 08 Feb 2019 15:02:06 +0100 Date: Fri, 8 Feb 2019 15:02:06 +0100 From: Andrew Lunn To: Heiner Kallweit Cc: Florian Fainelli , David Miller , "netdev@vger.kernel.org" Subject: Re: [PATCH net-next] net: phy: disregard "Clause 22 registers present" bit in get_phy_c45_devs_in_pkg Message-ID: <20190208140206.GE26594@lunn.ch> References: <47ec59c0-27c0-32e3-c75e-7bdfa99551c9@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <47ec59c0-27c0-32e3-c75e-7bdfa99551c9@gmail.com> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On Fri, Feb 08, 2019 at 08:12:47AM +0100, Heiner Kallweit wrote: > Bit 0 in register 1.5 doesn't represent a device but is a flag that > Clause 22 registers are present. Therefore disregard this bit when > populating the device list. If code needs this information it > should read register 1.5 directly instead of accessing the device > list. Because this bit doesn't represent a device I didn't add a > MDIO_MMD_C22PRESENT constant or similar. > > Signed-off-by: Heiner Kallweit > --- > drivers/net/phy/phy_device.c | 3 ++- > include/uapi/linux/mdio.h | 1 + > 2 files changed, 3 insertions(+), 1 deletion(-) > > diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c > index 9369e1323..c2316a117 100644 > --- a/drivers/net/phy/phy_device.c > +++ b/drivers/net/phy/phy_device.c > @@ -682,7 +682,8 @@ static int get_phy_c45_devs_in_pkg(struct mii_bus *bus, int addr, int dev_addr, > phy_reg = mdiobus_read(bus, addr, reg_addr); > if (phy_reg < 0) > return -EIO; > - *devices_in_package |= (phy_reg & 0xffff); > + /* Bit 0 doesn't represent a device, it indicates c22 regs presence */ > + *devices_in_package |= (phy_reg & 0xfffe); Hi Heiner Just for readability, can we use BIT(0) in there somehow? > > return 0; > } > diff --git a/include/uapi/linux/mdio.h b/include/uapi/linux/mdio.h > index 2e6e309f0..0e012b168 100644 > --- a/include/uapi/linux/mdio.h > +++ b/include/uapi/linux/mdio.h > @@ -115,6 +115,7 @@ > > /* Device present registers. */ > #define MDIO_DEVS_PRESENT(devad) (1 << (devad)) > +#define MDIO_DEVS_C22PRESENT MDIO_DEVS_PRESENT(0) Err. The commit message says you did not add this... Andrew