Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp202791pxj; Tue, 1 Jun 2021 19:20:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy/lZtBHQSiDwDpXvQ3MR3VAJ11/mP8sGr1nDpPnY1DTTWZUwFhg2lXR0lXbznho+r+JsC9 X-Received: by 2002:a05:6638:248d:: with SMTP id x13mr13217556jat.2.1622600446175; Tue, 01 Jun 2021 19:20:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622600446; cv=none; d=google.com; s=arc-20160816; b=HoV/Gu6mcM0QAUV3CpM5l1TA5jLawsjKCqjl7tTT1ASlrabw5EmfjjLXMUVnr7KDBP tA6u7Hn56cBR4K99T9kxiHlxv6WKoj2pHfvwkVo6FN9EkPyC43O+nmBiHVY3UYvYfIL/ ssaAHEFVKNqfpZRx9Ue93NG5EzP6GEaRUqD07udVrxsXNUq2Cel9PmYjS20vEXHuBmA9 27nWlhDleT/0ECQLsxyOVCwuxJRDe398K2o24pxEl7KfyX6Z+eieTp9Sy/QP/h0iBXNQ cNDaC7hAvYQdTPHN/pgOhGJ1RWe54Tv5pcQxMJ3XOsNxuIsBr0ydIb7sIgGELc2NJr2Z Uvng== 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:dkim-signature; bh=K3KCqXEauU6aKWxkMMXwDfluv9Lna1lNjOr9IA8yR50=; b=WYmQ9nwgBC8P69u6Pm6kDizEMwhDN0L6844yfRW1Tx/y7hi5+rfhq7AAXH3lWVuRQk CodXBvfkcKa8SENI3o1TC1a3R5CZ0nSkp6uaggsrOJ5pz7Wqa5PR24Naq5aOT1TYED/N NeeuiezZP1gpMOx4f/ZayXKAfWSNEqx7BIDbM1GDexRpTCfLnBkzCZlrDXy34fFDw6mk MHdLksLxGufwLFMykT6/uG8jfnU2cz6pjFlZujlcqRX6MjYKpREOJw1DNS68yTn1/oT1 VaWPgNXa9EeBzoHn7Shylh6JZEQRziSrBf8E1x3rWBYO+aP9YIaM7i7BF8+xvsocDA+m pBsA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b="T/jkor7n"; 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 r133si11616863jac.80.2021.06.01.19.20.33; Tue, 01 Jun 2021 19:20:46 -0700 (PDT) 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; dkim=pass header.i=@lunn.ch header.s=20171124 header.b="T/jkor7n"; 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 S229913AbhFBCVc (ORCPT + 99 others); Tue, 1 Jun 2021 22:21:32 -0400 Received: from vps0.lunn.ch ([185.16.172.187]:40038 "EHLO vps0.lunn.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229702AbhFBCVb (ORCPT ); Tue, 1 Jun 2021 22:21:31 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lunn.ch; s=20171124; h=In-Reply-To:Content-Disposition:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:From:Sender:Reply-To:Subject: Date:Message-ID:To:Cc:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:Content-Disposition:In-Reply-To:References; bh=K3KCqXEauU6aKWxkMMXwDfluv9Lna1lNjOr9IA8yR50=; b=T/jkor7n0Ct6kXy2F4qShDNK2Z 87SmFZM6g/f0GwloGvvWi0Ja41Orn0I4sCRWYW3sZL8E+YtzrndGl/ZKLI6kDiM05Zucl9YZBc9OR Uk8z0lejdQmmPC7utewdJFvnbZ+Hj8PT5+Ea3pJVFEoBJ558+Cclz+XUmockU+hMOyFE=; Received: from andrew by vps0.lunn.ch with local (Exim 4.94.2) (envelope-from ) id 1loGTv-007Ngi-Ln; Wed, 02 Jun 2021 04:19:43 +0200 Date: Wed, 2 Jun 2021 04:19:43 +0200 From: Andrew Lunn To: Wong Vee Khee Cc: Heiner Kallweit , Russell King , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [RFC net-next 0/2] Introduce MDIO probe order C45 over C22 Message-ID: References: <20210525055803.22116-1-vee.khee.wong@linux.intel.com> <20210601104734.GA18984@linux.intel.com> <20210601154423.GA27463@linux.intel.com> <20210601230352.GA28209@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210601230352.GA28209@linux.intel.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > Yeah, you're right. Thanks for pointing that out. It should be: > > diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c > index 1539ea021ac0..73bfde770f2d 100644 > --- a/drivers/net/phy/phy_device.c > +++ b/drivers/net/phy/phy_device.c > @@ -862,11 +862,22 @@ struct phy_device *get_phy_device(struct mii_bus *bus, int addr, bool is_c45) > c45_ids.mmds_present = 0; > memset(c45_ids.device_ids, 0xff, sizeof(c45_ids.device_ids)); > > - if (is_c45) > + if (is_c45) { > r = get_phy_c45_ids(bus, addr, &c45_ids); > - else > + } else { > r = get_phy_c22_id(bus, addr, &phy_id); > > + if (phy_id == 0) { > + r = get_phy_c45_ids(bus, addr, &c45_ids); > + if (r == -ENOTSUPP || r == -ENODEV) > + return phy_device_create(bus, addr, phy_id, > + false, &c45_ids); > + else > + return phy_device_create(bus, addr, phy_id, > + true, &c45_ids); Still not correct. Think about when get_phy_c22_id() returns an error. Walk through all the different code paths and check they do the right thing. It is actually a lot more complex than what is shown here. Think about all the different types of PHYs and all the different types of MDIO bus drivers. Andrew