[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YAGpD33Gy9R/wheo@lunn.ch>
Date: Fri, 15 Jan 2021 15:39:11 +0100
From: Andrew Lunn <andrew@...n.ch>
To: Tobias Waldekranz <tobias@...dekranz.com>
Cc: davem@...emloft.net, kuba@...nel.org, vivien.didelot@...il.com,
f.fainelli@...il.com, olteanv@...il.com, netdev@...r.kernel.org
Subject: Re: [PATCH net-next 2/2] net: dsa: mv88e6xxx: Only allow LAG offload
on supported hardware
> +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
Powered by blists - more mailing lists