Received: by 2002:ac0:b7d5:0:0:0:0:0 with SMTP id v21csp5902ime; Thu, 28 Jul 2022 14:53:46 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vg8zQzFHZHEUIBD5Cz73USHTZgNcc4JxPAfVCEZHzGpgyBdJQy4bY7d7w97YJ4ZuWy1XDa X-Received: by 2002:a05:6a00:1590:b0:52a:eb00:71dc with SMTP id u16-20020a056a00159000b0052aeb0071dcmr554959pfk.64.1659045226305; Thu, 28 Jul 2022 14:53:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659045226; cv=none; d=google.com; s=arc-20160816; b=VuviyolDXElM2izkh1R7InY5p3naoppjXwEvDvXvsCV87KiDy3lTgW2Woi5Kr97ROt phoBJtRS1YEFnbPg2BQlNI04gQ7BFxaE1+8h3KLnpimdVSMkIU05ZGnn/Y6dku+PKDtI jNx9rCodvJEx03hZ6V62H5oCWK/d2bYjzGrqjMhhcYRGbd5mCxVAAsCk1iD5HL3/+rF4 ICKPaF+DJJzqAJeXZfyEEdOUpHPrlpoZy5NYBbvqi4kKsT0li561tswDvUN2bpDGTGO2 vPXNFMMjbaUzxkkoi480mPIYSsf5K6WVKhAapVYdVe71bAOyphFEULtsWNKPWn/8jD8j r5tw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=sYzAr8lgaXAXDF+gl1uR3mk+XI3NGskm/8fxdmGspG4=; b=EpRnz96dgviVDJTVxukOtjGILkKCBmkhOYRwEvxadKM6aNiQYALLX0Z2tOjpNQgcZ1 hDSvussKWO3Aen31n5YsDxL3Fi/zLFRQHUvPdH6Hahq5oqwp5cDAzHAH7/3gDdfPgOAn t/gKGE3t428/V84mpgKn1Epe4h9suzA81gC9WFnshpkK31MZX/gvUVlGHzruRB2O1SXs CGcUZSOE/9WHNWBF5kj2jeCOwAmScVq2jYBw3EovAaED48FYyfyjeIkF7QMu44n8cUt8 BpgbA9ijlpINZJbDAPZY9/bh1GdjyH5kitH7IOoM6HW38tRpJCEqbiyP7XK59S3WFSLd ITgg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=QtKVbp9z; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d4-20020a170903230400b0016c00834dd5si2452308plh.18.2022.07.28.14.53.29; Thu, 28 Jul 2022 14:53:46 -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=@gmail.com header.s=20210112 header.b=QtKVbp9z; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229840AbiG1Voz (ORCPT + 99 others); Thu, 28 Jul 2022 17:44:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32874 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229436AbiG1Vox (ORCPT ); Thu, 28 Jul 2022 17:44:53 -0400 Received: from mail-pj1-x1035.google.com (mail-pj1-x1035.google.com [IPv6:2607:f8b0:4864:20::1035]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C3AD672EF3; Thu, 28 Jul 2022 14:44:52 -0700 (PDT) Received: by mail-pj1-x1035.google.com with SMTP id a7-20020a17090a008700b001f325db8b90so1999765pja.0; Thu, 28 Jul 2022 14:44:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc; bh=sYzAr8lgaXAXDF+gl1uR3mk+XI3NGskm/8fxdmGspG4=; b=QtKVbp9zPcljnP+k9V8pqj3I+4hQSA82o66hVspm7+Bh9poLT1VUph6O4hEwmrI6+C kziPfmMpyuRab+letNRaLthoKAN2/sAdnvyVoPs9QRnLB58ypGnOyv/4w3H2PlVfLYWH ezg7ODke7Naf2XBkLCQSUtNuXJns9dUO8ni/jdNRboQ63CgM4O18eoyhjb+TCH1MF2ZJ uKj2VD8IwOu6AASIZvwqazFKwBA4qjodbHbEkgrDqbgyhBI4FBTMmnJiBayLmwHll2dL fTDR2TIXOTBYB5saFdeDnKGavU4uUYrbN3OoQi7S1anfTE5E9pBX7mgpnq4eEbT5f+zt Vfxg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc; bh=sYzAr8lgaXAXDF+gl1uR3mk+XI3NGskm/8fxdmGspG4=; b=qp8cJ4FAjC83VdoNZJMPNc8fSd/yh8fyGqsIPfYAx78E07MF8cd9P8REJaEeyL+dj8 /RKxPmG8m6rh61qznT4dKTAPgasyZKgw8VJ4ptpwhc83bu2hxAUIePXnI9L9SvWGO/+c 8bQ0ykvg4Y+1fvllcSNITwm9WIVLSkRyWgXbZQN/5lB3C6+jhD/vf0tM6QbUXsXzQuPm /rez1rV/yNt2zQ4tXpGFt22ovwZRo1hCpNR8ySUTdhoKUskuCIlgQGJ5EYym018AY4HE Y4uIGCPWEMl7GIR6Hxc4BFRfrtnayNCFjYVuaRpADlNie0KlXufYPnOZcXmUHfP1MdT2 +3CQ== X-Gm-Message-State: ACgBeo0QAhqwd1NiBjWCavNSbAsATAjwGATiRBDRxifHqIcxpfP8kY5a xzAC3TT5aOSmWO9dsXdilQ0= X-Received: by 2002:a17:902:bb95:b0:169:4d7:fee with SMTP id m21-20020a170902bb9500b0016904d70feemr874904pls.80.1659044692157; Thu, 28 Jul 2022 14:44:52 -0700 (PDT) Received: from [10.67.48.245] ([192.19.223.252]) by smtp.googlemail.com with ESMTPSA id oa15-20020a17090b1bcf00b001ef89019352sm10089966pjb.3.2022.07.28.14.44.49 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 28 Jul 2022 14:44:51 -0700 (PDT) Message-ID: Date: Thu, 28 Jul 2022 14:44:47 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.11.0 Subject: Re: [PATCH net-next 3/4] net: phy: Add helper to derive the number of ports from a phy mode Content-Language: en-US To: Andrew Lunn , 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, Heiner Kallweit , Russell King , linux-arm-kernel@lists.infradead.org, Horatiu.Vultur@microchip.com, Allan.Nielsen@microchip.com, UNGLinuxDriver@microchip.com References: <20220728145252.439201-1-maxime.chevallier@bootlin.com> <20220728145252.439201-4-maxime.chevallier@bootlin.com> From: Florian Fainelli In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,NICE_REPLY_A, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS 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 On 7/28/22 14:32, Andrew Lunn wrote: >> +int phy_interface_num_ports(phy_interface_t interface) >> +{ >> + switch (interface) { >> + case PHY_INTERFACE_MODE_NA: >> + case PHY_INTERFACE_MODE_INTERNAL: >> + return 0; > > I've not yet looked at how this is used. Returning 0 could have > interesting effects i guess? INTERNAL clearly does have some sort of > path between the MAC and the PHY, so i think 1 would be a better > value. NA is less clear, it generally means Don't touch. But again, > there still needs to be a path between the MAC and PHY, otherwise > there would not be any to touch. > > Why did you pick 0? I would agree that returning 1 is a more sensible default to avoid breaking users of that function. However this makes me wonder, in what case will we break the following common meaning: - Q -> quad - P -> penta - O -> octal Is the helper really needed in the sense that the phy_interface_t enumeration is explicit enough thanks to or because of its name? -- Florian