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
---
drivers/net/ethernet/sfc/ethtool_common.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
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
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".
Yes, that's why I suggested there was probably some black magic
involved. But I couldn't read it, though.
I suggest replacing it with a static_assert(__same_type()) thingy.
Cheers,
Alex
--
Alejandro Colomar
Linux man-pages comaintainer; http://www.kernel.org/doc/man-pages/http://www.alejandro-colomar.es/