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 X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 202DEC433E0 for ; Fri, 15 Jan 2021 14:39:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E0B6E23359 for ; Fri, 15 Jan 2021 14:39:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731915AbhAOOj4 (ORCPT ); Fri, 15 Jan 2021 09:39:56 -0500 Received: from vps0.lunn.ch ([185.16.172.187]:42820 "EHLO vps0.lunn.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726849AbhAOOj4 (ORCPT ); Fri, 15 Jan 2021 09:39:56 -0500 Received: from andrew by vps0.lunn.ch with local (Exim 4.94) (envelope-from ) id 1l0QFr-000lIY-0u; Fri, 15 Jan 2021 15:39:11 +0100 Date: Fri, 15 Jan 2021 15:39:11 +0100 From: Andrew Lunn To: Tobias Waldekranz Cc: davem@davemloft.net, kuba@kernel.org, vivien.didelot@gmail.com, f.fainelli@gmail.com, olteanv@gmail.com, netdev@vger.kernel.org Subject: Re: [PATCH net-next 2/2] net: dsa: mv88e6xxx: Only allow LAG offload on supported hardware Message-ID: References: <20210115105834.559-1-tobias@waldekranz.com> <20210115105834.559-3-tobias@waldekranz.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210115105834.559-3-tobias@waldekranz.com> Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org > +static inline bool mv88e6xxx_has_lag(struct mv88e6xxx_chip *chip) > +{ > +#if (defined(CONFIG_NET_DSA_MV88E6XXX_GLOBAL2)) > + return chip->info->global2_addr != 0; > +#else > + return false; > +#endif Given Vladimirs comments, this is just FYI: You should not use #if like this. Use if (IS_ENABLED(CONFIG_NET_DSA_MV88E6XXX_GLOBAL2)) return chip->info->global2_addr != 0; return false; The advantage of this is it all gets compiled, so syntax errors in the mostly unused leg get found quickly. The generated code should still be optimal, since at build time it can evaluate the if and completely remove it. Andrew