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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B5DC1C001DE for ; Wed, 2 Aug 2023 22:45:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231807AbjHBWpx (ORCPT ); Wed, 2 Aug 2023 18:45:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43960 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231665AbjHBWps (ORCPT ); Wed, 2 Aug 2023 18:45:48 -0400 Received: from vps0.lunn.ch (vps0.lunn.ch [156.67.10.101]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3809F2D4A; Wed, 2 Aug 2023 15:45:47 -0700 (PDT) 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=BcA9s6B7nnGqXxdJ4+z402opSI+GaEOGt+DG2Ys8Ivg=; b=sXK7Emzdgo59rQOKYkMfCYsPdk qIk6ZJBK9TgfNgCRv/tDTRVO7bED9TJaoIH0mQJ3+tDUWbrvIy3U5qnaTUH+b3g7XFIXCZpOIUuBc ClRySUCfPL3u5VbEOcQvW4zG8B9M5m9Wjsz0WW1s5jbv72ZWDYbL8w846gyhQCnBCm2w=; Received: from andrew by vps0.lunn.ch with local (Exim 4.94.2) (envelope-from ) id 1qRKDH-002vc6-DN; Thu, 03 Aug 2023 00:21:03 +0200 Date: Thu, 3 Aug 2023 00:21:03 +0200 From: Andrew Lunn To: "Russell King (Oracle)" Cc: Michael Walle , Heiner Kallweit , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Yisen Zhuang , Salil Mehta , Florian Fainelli , Broadcom internal kernel review list , Marek =?iso-8859-1?Q?Beh=FAn?= , Xu Liang , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Simon Horman Subject: Re: [PATCH net-next v3 02/11] net: phy: introduce phy_has_c45_registers() Message-ID: References: <20230620-feature-c45-over-c22-v3-2-9eb37edf7be0@kernel.org> <7be8b305-f287-4e99-bddd-55646285c427@lunn.ch> <867ae3cc05439599d63e4712bca79e27@kernel.org> <7c29bfa7-b4a6-49c9-9369-d98bae98f135@lunn.ch> 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 On Wed, Aug 02, 2023 at 06:10:27PM +0100, Russell King (Oracle) wrote: > On Wed, Aug 02, 2023 at 06:15:19PM +0200, Andrew Lunn wrote: > > > I'm confused now. Andrew suggested to split it into four different > > > functions: > > > > > > phy_has_c22_registers() > > > phy_has_c45_registers() > > > phy_has_c22_transfers() > > > phy_has_c45_transfers() > > > > > > Without a functional change. That is, either return phydev->is_c45 > > > or the inverse. > > > > Without a functional change at this step of introducing the four > > functions. Then later really implement them to do what the name > > implies. Doing it in steps helps with bisect when it breaks something. > > > > It could also be that not all four are needed, or not all four are > > possible. But the four express the full combinations of transfers and > > registers. > > I'm left wondering how you think that phy_has_c45_registers() can > be implemented in a useful way, because I'm at a total loss... get_phy_c22_id() looks at the ID registers, and see if its mostly Fs. If so, it says -ENODEV. So phy_has_c22_registers() could be get_phy_c22_id() != -ENODEV. And you can extend that with the logic you quoted from the standard. get_phy_c45_ids() also returns -ENODEV if there are no devices in the package. So phy_has_c45_registers() could be get_phy_c45_id() != -ENODEV. This is heuristics, not something explicitly from the standard, but the basic idea of looking for not mostly Fs has been used for a long time. Andrew