Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp2147874iob; Fri, 20 May 2022 03:11:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzBSJdMAc3lT4fNH5t76hfSZcJ/eHVppCweAxCzxmPANtDqGXQHu75bfrM7Pf5x+a/Y3Gog X-Received: by 2002:a05:6402:17db:b0:42a:cd7c:c486 with SMTP id s27-20020a05640217db00b0042acd7cc486mr10045337edy.267.1653041486222; Fri, 20 May 2022 03:11:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653041486; cv=none; d=google.com; s=arc-20160816; b=Nb7ioPKZfqd+57p/VKKjn2NMMDL9MFkBczGPRvcvstWE6Vv/od6dCxvwoemNQ1aNYF ltcuDKdG0MQ9zPRMCJ7EEAA1c6joYFIxWgJ0aUgJMSeH5ug6uTWE9mpaPzOj20K51KcG LdtPfZ08bYENnlHG3gVDZ9XnTo+55tjnnMyMO1J/1icGrjLr6iVOcKseFuEzteE9YB8R 87UlXHKbUTB7HPDkB9tEfCoyyYmIWj54v00M2q/xbQsPomaw7czKvbtB3Y6GxIffb6wf i2KALsNp+Vq9Rx44GLEBSS4mdpMlChCHWcURcRRbXel4L02hvnUHrhIV2FwfhaY1almP wCKw== 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=to/gE6L+q0zD4a47p6IDhLpRguUiZpp9mAgkla7qJ7w=; b=QkANEMR0nYrGCxJ4rcRx9ANK/ph9eS69F6Vv1x9Q1WcqCKvBsjisSjOhR8AUDoOVn7 k8BZJEhe0+5T0FQXDXfHCjD5kvphVZVjr9l/OMPC/0dMw3FFMOscAuCfERoNINQ6eSOF mRBgCdJ8f2S4RpWXFuQfsJ7OcsWC3MDz2IrAvMKeIhr9KeOOTjtcn0fTUkNNlR8cP8sI nUhTJokdurdVrSDnXPSbHZcnC5/qWeZ1SdL/AEQV2bJ4Vjevsv3YVjllGjx6K8bUQsUa d75Z9sGV5l3iSVtITdTje5CAx386RgJ4OGdqxUS8Oio9BYxWcGdpHW5FYNQwh2gdO06e MIqA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=fOisF9OL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t2-20020aa7d4c2000000b0042acba0b85bsi7340480edr.200.2022.05.20.03.10.59; Fri, 20 May 2022 03:11:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=fOisF9OL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239415AbiESOKX (ORCPT + 99 others); Thu, 19 May 2022 10:10:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52990 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239016AbiESOKW (ORCPT ); Thu, 19 May 2022 10:10:22 -0400 Received: from vps0.lunn.ch (vps0.lunn.ch [185.16.172.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D37FC6129E; Thu, 19 May 2022 07:10:20 -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=to/gE6L+q0zD4a47p6IDhLpRguUiZpp9mAgkla7qJ7w=; b=fOisF9OLkcQKp7mCPGiV7oQ0KG iIsn968OLmZfCCPxAoYGt1QY7qjDErfEHRSX/U8Qoc4u+s95/8HirfQZqAfvgSb3xCAHmmckLEdI6 zcbXwTbWcv9vTVOJfNqqYHvGy0M+6HQwM8QgCAS/FwgWiyRNob/BYq2ge+eElw6YqlwY=; Received: from andrew by vps0.lunn.ch with local (Exim 4.94.2) (envelope-from ) id 1nrgr1-003Ukg-2y; Thu, 19 May 2022 16:10:15 +0200 Date: Thu, 19 May 2022 16:10:15 +0200 From: Andrew Lunn To: Maxime Chevallier Cc: davem@davemloft.net, Rob Herring , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, thomas.petazzoni@bootlin.com, Florian Fainelli , Heiner Kallweit , Russell King , linux-arm-kernel@lists.infradead.org, Richard Cochran , Horatiu.Vultur@microchip.com, Allan.Nielsen@microchip.com, UNGLinuxDriver@microchip.com Subject: Re: [PATCH net-next 4/6] net: phy: Add support for inband extensions Message-ID: References: <20220519135647.465653-1-maxime.chevallier@bootlin.com> <20220519135647.465653-5-maxime.chevallier@bootlin.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220519135647.465653-5-maxime.chevallier@bootlin.com> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > +static int phy_set_inband_ext(struct phy_device *phydev, u32 mask, u32 ext) > +{ > + int ret; > + > + if (!phy_interface_has_inband_ext(phydev->interface)) > + return -EOPNOTSUPP; > + > + if (!phydev->drv->inband_ext_config) > + return -EOPNOTSUPP; > + > + ret = phydev->drv->inband_ext_config(phydev, mask, ext); > + if (ret) > + return ret; > + > + phydev->inband_ext.enabled &= ~mask; > + phydev->inband_ext.enabled |= (mask & ext); You appear to be missing locking in this patchset. > +int phy_inband_ext_enable(struct phy_device *phydev, u32 ext) > +{ > + return phy_set_inband_ext(phydev, ext, ext); There should be an -EOPNOTSUPP here is requested to enable an extension which is not available. > +} > +EXPORT_SYMBOL(phy_inband_ext_enable); > + > +int phy_inband_ext_disable(struct phy_device *phydev, u32 ext) > +{ > + return phy_set_inband_ext(phydev, ext, 0); And the same here. > +} > +EXPORT_SYMBOL(phy_inband_ext_disable); > + > +int phy_inband_ext_set_available(struct phy_device *phydev, u32 mask, u32 ext) > +{ > + if (!(mask & phydev->drv->inband_ext)) > + return -EOPNOTSUPP; > + > + phydev->inband_ext.available &= ~mask; > + phydev->inband_ext.available |= (mask & ext); > + > + return 0; > +} > +EXPORT_SYMBOL(phy_inband_ext_set_available); > + > diff --git a/include/linux/phy.h b/include/linux/phy.h > index 4a2731c78590..6b08f49bce5b 100644 > --- a/include/linux/phy.h > +++ b/include/linux/phy.h > @@ -190,6 +190,21 @@ static inline void phy_interface_set_rgmii(unsigned long *intf) > __set_bit(PHY_INTERFACE_MODE_RGMII_TXID, intf); > } > > +/* > + * TODO : Doc > + */ > +enum { > + __PHY_INBAND_EXT_PCH = 0, > +}; > + > +#define PHY_INBAND_EXT_PCH BIT(__PHY_INBAND_EXT_PCH) the documentation is important here, since it makes it clear if these are values directly taken from the specification, or if these are linux specific, and the driver needs to map from linux to whatever the spec calls them. Andrew