Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp6850922rdb; Fri, 15 Dec 2023 09:53:18 -0800 (PST) X-Google-Smtp-Source: AGHT+IFXYYGCKgL86yDtbHlSctWIaetAos2jbcIqOeglhx8LQYeSfMvl2iO+4j1bXwKWY9ymB5Eb X-Received: by 2002:a17:907:3d9f:b0:a1e:3a14:e84b with SMTP id he31-20020a1709073d9f00b00a1e3a14e84bmr13927594ejc.44.1702662797989; Fri, 15 Dec 2023 09:53:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702662797; cv=none; d=google.com; s=arc-20160816; b=qs7CSTr5hlsnuQUV9WH0P/9TOxlQkHg0ILFvnYCGjglrmJVWUmiMvAjtD9boez3pcl zO+STgMsOBlj+bq5kXgVI4nfK52YTGBaCteSwX9k4eBdZ1TU+kw0IQsv+qpxmfgN2TQu PvMBMrl8oUCoZXqbazanPCkYl0PnlArOlhKbgT4/tPjPu835CUqTSi1srjMVE806j1bh +/OV8g8wguMw6LTwEgCcVINCISmYCeyRAyJ13dj7pOeZ/NPY+1sLEOUcfYZoT8KeYJI9 z0LqU2M0WnMjORnB61iPKSOrOjcruR5m14GXEUNNbo5DyGnqA1wiFzkOKIkMxwYVRqjw Hw0w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=+iPdiJNdZVJJftJlmJirKXP1ftutRoMmfkmL/gnsteY=; fh=rjSvvY4RUWSZ22xc0CIt/DgkKn4XRMOaetF2PA9MBOI=; b=J1+NRVyiXMhBBHJQVWqKvzOKkE1upNunFoFrBMLM3661PUYC4/AZyvr5OLrS++jAX8 sutxa3U9r7/C8BwZVEC0vBCh7yW+VQcw9JCuzNL0k7XtArIgPcCWN7PIiF70ARfpXDYa yEQ29KZEn5Oxk8EWO0OfNDHdzAAtGYEmVZ88dU9mxLS7WJDcd0QcJSxfzhP0RrbrSLZh xuWdGReZq4rSQNIn6wyDxHRIiAK8V1Hf96wfJzSysMe48lrBVdFrjKlV+TDJXJko4GX6 h84ajh9PcPv2+bDcIlWsdjyzOJMFlU9tX8koD5fxWd5xTI90uouxvL2jSPX6QFjlPQSb rhMQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=jay9ougN; spf=pass (google.com: domain of linux-kernel+bounces-1473-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-1473-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id j23-20020a170906411700b00a1d6bd4de7asi7239344ejk.885.2023.12.15.09.53.17 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Dec 2023 09:53:17 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-1473-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=jay9ougN; spf=pass (google.com: domain of linux-kernel+bounces-1473-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-1473-linux.lists.archive=gmail.com@vger.kernel.org" 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 am.mirrors.kernel.org (Postfix) with ESMTPS id BBF861F241F9 for ; Fri, 15 Dec 2023 17:53:17 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 114963FB37; Fri, 15 Dec 2023 17:51:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="jay9ougN" X-Original-To: linux-kernel@vger.kernel.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D34CA45C16; Fri, 15 Dec 2023 17:51:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: Content-Type:In-Reply-To:From:References:To:Subject:MIME-Version:Date: Message-ID:Sender:Reply-To:Cc:Content-ID:Content-Description; bh=+iPdiJNdZVJJftJlmJirKXP1ftutRoMmfkmL/gnsteY=; b=jay9ougNBK8TghytFpUhx1y5b9 mytxfXrEWaqLun8HqrByCIQ1KJ0tS9xj2hr6FQv+cYgraTC2H9B7+sgUyeQyhIkW8k9xY3UK6Ru9e 4rvkSX87wxIV3VUZ9rwz/hyqc1dUXh5k2kUFk/CUKrZ3WAYsCk5QKrIAyKBc2NVcdEnZN++aoP+M6 OHzIUAu/iE/b3akYMpojMKjJhfZTdLsfQxaJ9WnqemAlQxehX5MSBrair0xLWki721i04sG2QIV1V mjLODjZXsvIMQ01s0//xlPLmgdoRhFsQqNY2kx/vE7ou5/j9GOik77l6hJpuiyuMHHiBkfpT7S7R9 chetLpkQ==; Received: from [50.53.46.231] (helo=[192.168.254.15]) by bombadil.infradead.org with esmtpsa (Exim 4.96 #2 (Red Hat Linux)) id 1rECLg-0049yM-39; Fri, 15 Dec 2023 17:51:45 +0000 Message-ID: <387c75f9-e2f3-499a-bfb3-17b18398866a@infradead.org> Date: Fri, 15 Dec 2023 09:51:44 -0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [net-next PATCH v3 1/3] net: phy: refactor and better document phy_speeds function Content-Language: en-US To: Christian Marangi , Andrew Lunn , Heiner Kallweit , Russell King , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , netdev@vger.kernel.org, linux-kernel@vger.kernel.org References: <20231215132921.16808-1-ansuelsmth@gmail.com> <20231215132921.16808-2-ansuelsmth@gmail.com> From: Randy Dunlap In-Reply-To: <20231215132921.16808-2-ansuelsmth@gmail.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Hi-- On 12/15/23 05:29, Christian Marangi wrote: > Refactor the phy_speeds function to be more readable and understandable > and add some documentation on it. > > While on it extend it to take NULL speeds values to make it return only > the count of speed modes in the passed mask. > > Signed-off-by: Christian Marangi > --- > drivers/net/phy/phy-core.c | 50 ++++++++++++++++++++++++++++++++++---- > 1 file changed, 45 insertions(+), 5 deletions(-) > > diff --git a/drivers/net/phy/phy-core.c b/drivers/net/phy/phy-core.c > index 966c93cbe616..9618d89458d1 100644 > --- a/drivers/net/phy/phy-core.c > +++ b/drivers/net/phy/phy-core.c > @@ -317,17 +317,57 @@ phy_lookup_setting(int speed, int duplex, const unsigned long *mask, bool exact) > } > EXPORT_SYMBOL_GPL(phy_lookup_setting); > > +/** > + * phy_speeds - return all speeds in mask > + * @speeds: pointer to array where to put the speed modes > + * @size: size of array where to put the speed modes > + * @mask: mask of speed modes to compare with > + * > + * Take mask, test bit in mask with the settings table and compose the > + * speeds array based on that as many as size permits. > + * > + * With speeds NULL, only the number of detected modes is returned and > + * no array is composed. (size value is ignored) > + * > + * Return the number of detected modes in mask. * Return: the number of detected modes in mask. > + */ -- #Randy https://people.kernel.org/tglx/notes-about-netiquette https://subspace.kernel.org/etiquette.html