From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.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.lore.kernel.org (Postfix) with ESMTPS id 6614BC04A68 for ; Thu, 28 Jul 2022 21:46:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:From:References:Cc:To: Subject:MIME-Version:Date:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=R1LlAeiHNLxkyNS8HADQfWscZHl/rUeAtHciuOjVCEA=; b=cDOul8xThnlhwt 951wCOwmTXyevuT80015G4trwkrofPFK9cgl7nv1vKcaVa0fexlldYye5NSJy9SX4YcnpCr/6SFqY mhbeOjpGDlkiPLLc64BcDo/lbYdVkh4IXZ/rzxgN86qZPOBXzzIk7YNh/iKHAxEa4S9WuKdSJyIq2 4zBrtYe2hywRm8DWlAd3Cr7JF7eFvRVbr/4wAqBbd7cfwkJNlBbGJJ3midaQo8mmfK6QoxDDxV/B1 jL1r4Ro+n4JHj78QEje36OBMygvFilYtxn7EdeOIq9XIjCdDnFECkoycuR1TRQalJ0meCQA5IsJYH ylWM22AW2SDb4Zs5kwhw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oHBJS-00Eit6-1V; Thu, 28 Jul 2022 21:44:58 +0000 Received: from mail-pj1-x1033.google.com ([2607:f8b0:4864:20::1033]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oHBJO-00Eir0-4t for linux-arm-kernel@lists.infradead.org; Thu, 28 Jul 2022 21:44:55 +0000 Received: by mail-pj1-x1033.google.com with SMTP id y1so2980811pja.4 for ; 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=u75RVwoQGgYdHyWtDMmK3Z+mgfwrgFOnL+dio9JIyvrzFzvjLOe1LGBBhGmwSsZwx9 FO4oQWnMvtEHcqgoe3mwrikIIjCpfwOV9wVf4TanyGLQFR/0SfP6xGE9Cx2OlG+ldwJd /TMTghW/kGY7RQnLQczdyOfWjV77c1qlfU7R4++rkznDJL+Ipl9jaDWbmJBzrnjt0HHL A5u1Sx35HTpYHQRKENPgeCLiLi7LjyaUtthTqo4L4Jx5wNkevYP2+pThlVb4RLmOfq0f W/VwdqXnuxD+Nfm9WqJweo9lqy2yxTg61Gb/ERsl2DaOuh91JIeAuWS0bb8SW+yDKTlp bfEg== X-Gm-Message-State: ACgBeo0ofF3YI0/1t1LT8G8gO5Gw4szvdR/x+rVd0IpTX97cl7jHBSov d0LAXpFqe6I9PhCNlBLaHmE= X-Google-Smtp-Source: AA6agR6G0g0tepPldrnNWTsVrllTh0MrUkGBJuVD20hkGZDITGk2KSDTXVMtbDy1RIjdznCwz7i1lw== 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: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220728_144454_258557_8E90183E X-CRM114-Status: GOOD ( 16.54 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.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 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel