Message ID | 20231214154906.29436-3-ansuelsmth@gmail.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-201-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:3b04:b0:fb:cd0c:d3e with SMTP id c4csp8897232dys; Thu, 14 Dec 2023 14:40:24 -0800 (PST) X-Google-Smtp-Source: AGHT+IFVY2WS83TO2g6SV3kUDrvgfSi3gMviUDMG/MpBn5c4vYeXgwd/OKBFNZGEpGKKMSMdO/PI X-Received: by 2002:ac8:5913:0:b0:425:4043:762e with SMTP id 19-20020ac85913000000b004254043762emr15152796qty.86.1702593624180; Thu, 14 Dec 2023 14:40:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702593624; cv=none; d=google.com; s=arc-20160816; b=z9hZOd9C5bCkshuOOR+eZ4y4QOVnnLMVS3wM9xalbL2QIavACXYoWLJ/obSBM56Cg1 WcolMSRjjybIV5ZET64Qe60lFxoHjW1UKgtdDfflLW7c6TmqRtNN2rRchyB3qFMxT5Qy PXcqvj8NSy1ZqIN4QdLEDe34D2PCUHda9o3LO5NNzNbQGapvfRUax0FDxgZwNLEKb0q4 0PdkVnDjedqHPWWsXft0b9r4NumLH5iBvwZbSgYGDO8bcfiKpqo0VLbYuLq1ZhdGV12P UbN6y5+qp7NV4zzsp28clU1Lzlfh2UKy0vUo9txa+4286D9rOVzr2XG0zZlKkqi6H4Te 4ZlQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=hAtxuDG+IL4Il9JbZckuESTLJk29St8uyddTrttAR4I=; fh=utmrxdkgikAlLxVfQI1kldUG+rNjhrLN+3fAlOYj01s=; b=KM6YT7j/TZ7LLNd/DPh9AQ1u+jY5umR0HHSMeAoD9ncsntWo6UbUoaawHDbm5/2GOr 01lRtOT18o5wkFuA2BArt7FCZHhAdNH4iSAb8p+uM8vudcF2QbyBhO/2+sPGbMUa/poe QNICBEql20HuGka/0rKm9QM4a8uvCI8sHpQp8vGxTSMKpsgR1L1y0pim9CFhFZXEgYuu nPp2TJYzHPtVQAo4ck/03BOWPCPdeJDsUu/5sMsPVqxbxiSrfcrdapVe22ZSd7YCehh6 tRk+rcuhtdV1O55oaGksnIr9Kqil4kE1lgjAHAOK0918BTOfDqy50b88tUDwYotRq6+Y UQBw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=Zw+DbNAB; spf=pass (google.com: domain of linux-kernel+bounces-201-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-201-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id v5-20020a05622a130500b00425fe9c723dsi2422855qtk.351.2023.12.14.14.40.24 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Dec 2023 14:40:24 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-201-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=Zw+DbNAB; spf=pass (google.com: domain of linux-kernel+bounces-201-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-201-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id EA56C1C21D86 for <ouuuleilei@gmail.com>; Thu, 14 Dec 2023 22:40:23 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0B6E56E591; Thu, 14 Dec 2023 22:38:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Zw+DbNAB" X-Original-To: linux-kernel@vger.kernel.org Received: from mail-wm1-f44.google.com (mail-wm1-f44.google.com [209.85.128.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DC2C36ABBE; Thu, 14 Dec 2023 22:38:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-wm1-f44.google.com with SMTP id 5b1f17b1804b1-40c4846847eso628875e9.1; Thu, 14 Dec 2023 14:38:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1702593515; x=1703198315; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=hAtxuDG+IL4Il9JbZckuESTLJk29St8uyddTrttAR4I=; b=Zw+DbNABx8tUDhlvJpomxoamS1mGVUIcJBj6vD0+Y96eMfFml5U8Zc/JMYInK9Am+Z uzTI+8RNEagCrGS8Hu75yRhyFgi5ykTHuDHpqob3FrVlKlvcaLaIhWZWLVm6ytdt0LkN pLceZxKRHp0Etjo5NKMbgcwmdttx1cqZkL6aDnE9e+Re29+2QAMa5ebdWDxAiQxKrAxZ HZJnUTRADL+9q63Wzt5ltxuwu5j+w2afy9KTc6qBDTcQM1MQOvkUAR8VGxoRcYq9OMDs d7n/mgZzRviiQYO7xbuTTxuQMnR0cwiPni9K2rR4wVG5clCgQeq8SBUpJOLsCnsKL0B8 lzWw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702593515; x=1703198315; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=hAtxuDG+IL4Il9JbZckuESTLJk29St8uyddTrttAR4I=; b=ut5SwidPbSzZV7a5xbN5uQKGZ1aLYn4+rAa5f8/IJS8l9MRGP537wmkCuxMf41xibp gHQ7AH2/4VcCwCDW3ZaMbXLQ5FrPGyGZUy4U0MHb+vve9O2uak68KlzaAjFa0GUDaFmx xrzXxjbh5euXnL10ePjTnoQQPbmPjEccV5rpxKdZWpuP5BdFQspkqpU4fbV+8qLSTiBf 9UWAFK/cby+7geT3NCAtDeUF/gC1VeUJPOpWkehEV22gjp2Z5UrKH/GkuENINKob+e7U 9PlDj6rRKepSMUSlpdwStAE3FBuxmrEuzAMf7V5Mh4xsiMRhdY7LBL9IRxiSOf4v9HdS PjaA== X-Gm-Message-State: AOJu0YxwCiWGTkuxVINA8hpiAW3/UOYmEfMsQwAf/NV/STM9qegfdzpo st9epVjbFuU9G3UgyEKqNDk= X-Received: by 2002:a05:600c:1705:b0:40c:315e:9ec3 with SMTP id c5-20020a05600c170500b0040c315e9ec3mr5030141wmn.65.1702593515012; Thu, 14 Dec 2023 14:38:35 -0800 (PST) Received: from localhost.localdomain (93-34-89-13.ip49.fastwebnet.it. [93.34.89.13]) by smtp.googlemail.com with ESMTPSA id n41-20020a05600c3ba900b0040c61ee0816sm54746wms.0.2023.12.14.14.38.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Dec 2023 14:38:34 -0800 (PST) From: Christian Marangi <ansuelsmth@gmail.com> To: Andrew Lunn <andrew@lunn.ch>, Heiner Kallweit <hkallweit1@gmail.com>, Russell King <linux@armlinux.org.uk>, "David S. Miller" <davem@davemloft.net>, Eric Dumazet <edumazet@google.com>, Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Christian Marangi <ansuelsmth@gmail.com> Subject: [net-next PATCH v2 2/3] net: phy: add simple helper to return count of supported speeds Date: Thu, 14 Dec 2023 16:49:05 +0100 Message-Id: <20231214154906.29436-3-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231214154906.29436-1-ansuelsmth@gmail.com> References: <20231214154906.29436-1-ansuelsmth@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1785298812182016528 X-GMAIL-MSGID: 1785298812182016528 |
Series |
net: add define to describe link speed modes
|
|
Commit Message
Christian Marangi
Dec. 14, 2023, 3:49 p.m. UTC
Add simple helper to return count of supported speeds for the passed PHY
device.
This can be useful to know the number of speed modes to dynamically
allocate a speed array for it.
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
---
drivers/net/phy/phy.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
Comments
Hi Christian, kernel test robot noticed the following build warnings: [auto build test WARNING on net-next/main] url: https://github.com/intel-lab-lkp/linux/commits/Christian-Marangi/net-phy-refactor-and-better-document-phy_speeds-function/20231215-064112 base: net-next/main patch link: https://lore.kernel.org/r/20231214154906.29436-3-ansuelsmth%40gmail.com patch subject: [net-next PATCH v2 2/3] net: phy: add simple helper to return count of supported speeds config: x86_64-defconfig (https://download.01.org/0day-ci/archive/20231215/202312152053.bbqS93v4-lkp@intel.com/config) compiler: gcc-11 (Debian 11.3.0-12) 11.3.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231215/202312152053.bbqS93v4-lkp@intel.com/reproduce) If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot <lkp@intel.com> | Closes: https://lore.kernel.org/oe-kbuild-all/202312152053.bbqS93v4-lkp@intel.com/ All warnings (new ones prefixed by >>): >> drivers/net/phy/phy.c:239:14: warning: no previous prototype for 'phy_supported_speeds_num' [-Wmissing-prototypes] 239 | unsigned int phy_supported_speeds_num(struct phy_device *phy) | ^~~~~~~~~~~~~~~~~~~~~~~~ vim +/phy_supported_speeds_num +239 drivers/net/phy/phy.c 231 232 /** 233 * phy_supported_speeds_num - return the number of all speeds currently 234 * supported by a phy device 235 * @phy: The phy device to return supported speeds of. 236 * 237 * Description: Returns the number of supported speeds. 238 */ > 239 unsigned int phy_supported_speeds_num(struct phy_device *phy) 240 { 241 return phy_speeds(NULL, 0, phy->supported); 242 } 243
diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c index a5fa077650e8..311560e72126 100644 --- a/drivers/net/phy/phy.c +++ b/drivers/net/phy/phy.c @@ -229,6 +229,18 @@ phy_find_valid(int speed, int duplex, unsigned long *supported) return phy_lookup_setting(speed, duplex, supported, false); } +/** + * phy_supported_speeds_num - return the number of all speeds currently + * supported by a phy device + * @phy: The phy device to return supported speeds of. + * + * Description: Returns the number of supported speeds. + */ +unsigned int phy_supported_speeds_num(struct phy_device *phy) +{ + return phy_speeds(NULL, 0, phy->supported); +} + /** * phy_supported_speeds - return all speeds currently supported by a phy device * @phy: The phy device to return supported speeds of.