Subject: Re: [PATCH net-next 2/2] net: dsa: mv88e6xxx: Only allow LAG offload on supported hardware

From: Andrew Lunn <[email-masked]>
Date: Fri, 15 Jan 2021 15:39:11 +0100

> +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