Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp5231189rwl; Tue, 28 Mar 2023 18:58:53 -0700 (PDT) X-Google-Smtp-Source: AKy350aycayP8GX3PhvdWKFU4qOoi9dTPVVIELsa0+ZpaWJc23AHu7Hv9FltTgnqanMeugGeHn3M X-Received: by 2002:a05:6402:125a:b0:4fe:9689:96bb with SMTP id l26-20020a056402125a00b004fe968996bbmr18228942edw.35.1680055133577; Tue, 28 Mar 2023 18:58:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680055133; cv=none; d=google.com; s=arc-20160816; b=ExZkGE1rgdxPAdU5QDa2nwO3EFOlWIA8i+9AboOQspGW6u8t02r/sXLnJKjdWqqppB 3lR0jsD8dUfxArUhvrG+5XX3RMFZBUTW0SXjHwunEAONmKBxiEBa/zMoOeFuZQdT2blQ X7ZWFLaC/7hBhFVD+WiWvZlJ6SFMYCnPFsdpKg/AzLrlm8r8ezo+lQmbGh/19EdbMpNd k/+CVjSHsIQqdurNU/RsHpjy4TMpnvg4zwGKiNPASBUjFVgVk1vO5D71mXKHfD87ZfUb 6UNyy4GGFvtBmQF/pMp7xhUmCEtEVSQkJFDKLejOOMg+M0kDuON+mWXjqLS1cagML4hg 4DPw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=4xE+zSw3YxqXMaeyvEoXSV8aBNd0SIN/zsKKvB38Fz8=; b=t+dTd/nzURxXeZndBYa4qmXQhSLfnDoH+BliTRNjApQbCAU9St5FB0jQcLLOsqMNSs ERMByobttqFoswCvrX7kboOolmtFKGrbfn7AbHL0Vfe1SzmEiBuFQgcDC5oFTL+tFOw/ VYzQeE4L6zhu24kCtMY/CBj7pILhRquJckOAQ6Ct99Gx5Gv+cZm275iDKi1KZozaVnqL dXKQweRrq7FvIQvjTA5LEzZ2VAxTzQ56MtDh6RJghcslvwITgeN8DWJq8Dlob1NgS6Ba o2ePUHK6XJdJlMFOdt72r+ijZaJn6Hqanem6Okxu0y+yo7mH0xpzeTKLPjNEOL7ARsm8 NEDQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=dTjfxYX8; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g6-20020aa7c586000000b004ac746e3f9asi32247235edq.441.2023.03.28.18.58.27; Tue, 28 Mar 2023 18:58:53 -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=@kernel.org header.s=k20201202 header.b=dTjfxYX8; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229626AbjC2B5Y (ORCPT + 99 others); Tue, 28 Mar 2023 21:57:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51204 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229484AbjC2B5X (ORCPT ); Tue, 28 Mar 2023 21:57:23 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C4064BE; Tue, 28 Mar 2023 18:57:22 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 63F0D61A09; Wed, 29 Mar 2023 01:57:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 08E95C433EF; Wed, 29 Mar 2023 01:57:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1680055041; bh=Ht1onyfcmzOw2qKX1pJ8D5vEoEK4zHwhkFnjwVJVLG0=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=dTjfxYX88Y0GCwguIOU1z+LJD7YjITgEt48phbqGQKQ0v7xyRPUlWTGG8ljYZGMPx 0/x+CHkbC2HY8yFmHVsbqndOTDL9ByGVqxLl5kIcAIJ07W8qkrfxenDnG02z9jXb+u wV2AVnB88zfjoRmbnN5IAOwoihywT6e3CPTesZchHWA/NGIKggHkutdwnfwqI7HSgN JjCcMNvpZTTGEdKJGCSu8gvk3QFYEeiQ78wiStgkfqmlgF1jolj31mAn7D0CJHwZ3k IxIrVltQ/5gkNK2cmhSvvF/EiHa8lg5j29FiLgRu3cDDK86Hm39L/zdsGXriOLWaRF OBtsV1EKoVnsQ== Date: Tue, 28 Mar 2023 18:57:20 -0700 From: Jakub Kicinski To: linux@armlinux.org.uk Cc: Michael Sit Wei Hong , Giuseppe Cavallaro , Alexandre Torgue , Jose Abreu , "David S . Miller" , Eric Dumazet , Paolo Abeni , Maxime Coquelin , Ong Boon Leong , netdev@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Looi Hong Aun , Voon Weifeng , Lai Peter Jun Ann Subject: Re: [PATCH net v3 1/3] net: phylink: add phylink_expects_phy() method Message-ID: <20230328185720.6239e4a7@kernel.org> In-Reply-To: <20230324081656.2969663-2-michael.wei.hong.sit@intel.com> References: <20230324081656.2969663-1-michael.wei.hong.sit@intel.com> <20230324081656.2969663-2-michael.wei.hong.sit@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-5.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI,SPF_HELO_NONE, SPF_PASS autolearn=unavailable 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 On Fri, 24 Mar 2023 16:16:54 +0800 Michael Sit Wei Hong wrote: > Provide phylink_expects_phy() to allow MAC drivers to check if it > is expecting a PHY to attach to. Since fixed-linked setups do not > need to attach to a PHY. > > Provides a boolean value as to if the MAC should expect a PHY. > returns true if a PHY is expected. > > Signed-off-by: Michael Sit Wei Hong Russell, looks good? > diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c > index 1a2f074685fa..5c2bd1370993 100644 > --- a/drivers/net/phy/phylink.c > +++ b/drivers/net/phy/phylink.c > @@ -1586,6 +1586,19 @@ void phylink_destroy(struct phylink *pl) > } > EXPORT_SYMBOL_GPL(phylink_destroy); > > +/** > + * phylink_expects_phy() - Determine if phylink expects a phy to be attached > + * @pl: a pointer to a &struct phylink returned from phylink_create() > + * > + * Fixed-link mode does not need a PHY, returns a boolean value to check if > + * phylink will be expecting a PHY to attach. > + */ > +bool phylink_expects_phy(struct phylink *pl) > +{ > + return pl->cfg_link_an_mode != MLO_AN_FIXED; > +} > +EXPORT_SYMBOL_GPL(phylink_expects_phy); > + > static void phylink_phy_change(struct phy_device *phydev, bool up) > { > struct phylink *pl = phydev->phylink; > diff --git a/include/linux/phylink.h b/include/linux/phylink.h > index c492c26202b5..637698ed5cb6 100644 > --- a/include/linux/phylink.h > +++ b/include/linux/phylink.h > @@ -574,6 +574,7 @@ struct phylink *phylink_create(struct phylink_config *, struct fwnode_handle *, > phy_interface_t iface, > const struct phylink_mac_ops *mac_ops); > void phylink_destroy(struct phylink *); > +bool phylink_expects_phy(struct phylink *pl); > > int phylink_connect_phy(struct phylink *, struct phy_device *); > int phylink_of_phy_connect(struct phylink *, struct device_node *, u32 flags);