netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Lunn <andrew@lunn.ch>
To: Tobias Waldekranz <tobias@waldekranz.com>
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
Date: Fri, 15 Jan 2021 15:39:11 +0100	[thread overview]
Message-ID: <YAGpD33Gy9R/wheo@lunn.ch> (raw)
In-Reply-To: <20210115105834.559-3-tobias@waldekranz.com>

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

      parent reply	other threads:[~2021-01-15 14:39 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-15 10:58 [PATCH net-next 0/2] net: dsa: mv88e6xxx: LAG fixes Tobias Waldekranz
2021-01-15 10:58 ` [PATCH net-next 1/2] net: dsa: mv88e6xxx: Provide dummy implementations for trunk setters Tobias Waldekranz
2021-01-15 11:10   ` Vladimir Oltean
2021-01-15 14:30   ` Andrew Lunn
2021-01-15 14:36     ` Vladimir Oltean
2021-01-15 14:48       ` Andrew Lunn
2021-01-15 14:53         ` Vladimir Oltean
2021-01-15 20:12         ` Tobias Waldekranz
2021-01-18 17:54           ` Andrew Lunn
2021-01-15 10:58 ` [PATCH net-next 2/2] net: dsa: mv88e6xxx: Only allow LAG offload on supported hardware Tobias Waldekranz
2021-01-15 11:15   ` Vladimir Oltean
2021-01-15 11:29     ` Vladimir Oltean
2021-01-15 14:39   ` Andrew Lunn [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YAGpD33Gy9R/wheo@lunn.ch \
    --to=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=f.fainelli@gmail.com \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=olteanv@gmail.com \
    --cc=tobias@waldekranz.com \
    --cc=vivien.didelot@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).