Thread (3 messages) flat view 3 messages, 2 authors, 2021-11-22

Re: [PATCH] drivers/net/ethernet/sfc/: Simplify code

From: Edward Cree <ecree.xilinx@gmail.com>
Date: 2021-11-22 16:17:37

On 20/11/2021 20:14, Alejandro Colomar wrote:
That ternary operator has
the same exact code in both of the branches.

Unless there's some hidden magic in the condition,
there's no reason for it to be,
and it can be replaced
by the code in one of the branches.

That code has been untouched since it was added,
so there's no information in git about
why it was written that way.

Signed-off-by: Alejandro Colomar <redacted>
Cc: Edward Cree <ecree.xilinx@gmail.com>
Cc: Martin Habets <redacted>
Cc: netdev@vger.kernel.org
I guess it's there for type-checking — essentially as an assert that
 field_type == typeof(efx_##source_name.field).  Probably when it was
 added there was no standard way to do this; now we could probably
 use <linux/typecheck.h> or some such.
The comment just above the macro does mention "with type-checking".

-ed
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help