Received: by 2002:ac0:e350:0:0:0:0:0 with SMTP id g16csp678792imn; Fri, 29 Jul 2022 21:26:09 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vshziOqLCandKh1wMgTQ0sHAdrQm/zi3nieeBMSC71GCZkrUyavmlUGtRyVWRd3ARXkUYI X-Received: by 2002:a05:6a00:22c7:b0:52b:af2:903f with SMTP id f7-20020a056a0022c700b0052b0af2903fmr6434784pfj.3.1659155168821; Fri, 29 Jul 2022 21:26:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659155168; cv=none; d=google.com; s=arc-20160816; b=FN73RSlYTSehJuxMnCgPow0TbTeOnCah+GWfkKc2DuWdNGV9OeghF13PQkrgXajxJf g3KnoE8geVjxsPQ27VNb3gI7PomueGkwO8afaFqSZIeh5YD6kVrEdGSHqje/A5uDPPfJ 0FX5LSfntni6HNQlnQxL8chqSASKp14OEM6sgiZhcCIYgMlw/3XRT2pTlZnG1kmucdJk LmRlbED4cW5OLV4VKy5a7+6Frlxo8zNwcOqpUh7WwiQdozPYJMTPbu1m2OH7YTtVMwEf o9Cp7WKVKWyIw2sRpn+R+RVjyDbdblifdSjDWbK7CYZ9tpLy3dcbtAY3dr1HrV3O+kD+ /XKQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=7YiLpMaw2/hxuRrEztHHabGbkHQasdt3WXqJtG/B6gw=; b=wld0M9mh7X2t1gK5dpZxAIqiZUp/3qRwRCvPK18ZXqoM7E3057S+9hRh0aGrzWD1NA Nr2oE+NXJzZUk57a013DSAvndC73JWJy6QHjrSEACbzWt8eOsMLoErPKhkeFK8OSjDAl KojRWYe8daVRuHZlg2yuyXj/xvp5LOfcbOCKH4cCFeWttJ0U+Az1Jl44sr4JboLdV/1l Po2g04dAkaGPH+84G5SmsA83cld5Cj7C6wtfcVcoT7hOxvXDaqb/HdVBBsN8hMPr1Yc3 2dkb3qfxyQ6f68R2n9h9Yj4k4wBDZRsoQpYh80eIBuobQ/wXr6WkgPE+YmiLuqQyPUKg qEjA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=h6XBNvyF; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id nu14-20020a17090b1b0e00b001f1ddb827a4si7303691pjb.35.2022.07.29.21.25.29; Fri, 29 Jul 2022 21:26:08 -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=@lunn.ch header.s=20171124 header.b=h6XBNvyF; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239775AbiG3Dyc (ORCPT + 99 others); Fri, 29 Jul 2022 23:54:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46002 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230251AbiG3Dyb (ORCPT ); Fri, 29 Jul 2022 23:54:31 -0400 Received: from vps0.lunn.ch (vps0.lunn.ch [185.16.172.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B36DD743E0; Fri, 29 Jul 2022 20:54:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lunn.ch; s=20171124; h=In-Reply-To:Content-Disposition:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:From:Sender:Reply-To:Subject: Date:Message-ID:To:Cc:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:Content-Disposition:In-Reply-To:References; bh=7YiLpMaw2/hxuRrEztHHabGbkHQasdt3WXqJtG/B6gw=; b=h6XBNvyFKzvxULfonXBLLWfWS1 u9687BHCigWyaGq0EikFteQpmPwoy8uAPviM+sB/X0ZJwLLz9hwfpz16IHQIHlzwof6+0WTpJaYXZ Nxbblkknonx6RC6kIZs9z72+xkZScI3Qloyrs+nV+Uo6u/RCpyrRCUdCiwh21Zhtc8kk=; Received: from andrew by vps0.lunn.ch with local (Exim 4.94.2) (envelope-from ) id 1oHdYR-00BzQN-P6; Sat, 30 Jul 2022 05:54:19 +0200 Date: Sat, 30 Jul 2022 05:54:19 +0200 From: Andrew Lunn To: Florian Fainelli Cc: Maxime Chevallier , 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, Richard Cochran , Horatiu.Vultur@microchip.com, Allan.Nielsen@microchip.com, UNGLinuxDriver@microchip.com Subject: Re: [PATCH net-next v3 3/4] net: phy: Add helper to derive the number of ports from a phy mode Message-ID: References: <20220729153356.581444-1-maxime.chevallier@bootlin.com> <20220729153356.581444-4-maxime.chevallier@bootlin.com> <056164ec-3525-479b-3b71-834af48d323c@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <056164ec-3525-479b-3b71-834af48d323c@gmail.com> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,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 > > +int phy_interface_num_ports(phy_interface_t interface) > > +{ > > + switch (interface) { > > + case PHY_INTERFACE_MODE_NA: > > + return 0; > > + case PHY_INTERFACE_MODE_INTERNAL: > > Maybe this was covered in the previous iteration, but cannot the > default case return 1, and all of the cases that need an explicit > non-1 return value are handled? Enumeration all of those that do > need to return 1 does not really scale. It is a trade off. In the current form, when somebody adds a new enum value, gcc will give a warning if they forget to add it here. If we default to 1, new values are probably going to be missed here, and could end up with the incorrect return value. I think the compiler warning actually does make it scale. And the generated code probably very similar either way. Andrew