Thread (13 messages) flat view 13 messages, 3 authors, 2021-01-18

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

From: Andrew Lunn <andrew@lunn.ch>
Date: 2021-01-15 14:39:57

+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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help