[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20211120201425.799946-1-alx.manpages@gmail.com>
Date: Sat, 20 Nov 2021 21:14:26 +0100
From: Alejandro Colomar <alx.manpages@...il.com>
To: netdev@...r.kernel.org
Cc: Alejandro Colomar <alx.manpages@...il.com>,
Edward Cree <ecree.xilinx@...il.com>,
Martin Habets <habetsm.xilinx@...il.com>
Subject: [PATCH] drivers/net/ethernet/sfc/: Simplify code
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 <alx.manpages@...il.com>
Cc: Edward Cree <ecree.xilinx@...il.com>
Cc: Martin Habets <habetsm.xilinx@...il.com>
Cc: netdev@...r.kernel.org
---
drivers/net/ethernet/sfc/ethtool_common.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/drivers/net/ethernet/sfc/ethtool_common.c b/drivers/net/ethernet/sfc/ethtool_common.c
index bd552c7dffcb..1b9e8b0afb3c 100644
--- a/drivers/net/ethernet/sfc/ethtool_common.c
+++ b/drivers/net/ethernet/sfc/ethtool_common.c
@@ -33,10 +33,7 @@ struct efx_sw_stat_desc {
get_stat_function) { \
.name = #stat_name, \
.source = EFX_ETHTOOL_STAT_SOURCE_##source_name, \
- .offset = ((((field_type *) 0) == \
- &((struct efx_##source_name *)0)->field) ? \
- offsetof(struct efx_##source_name, field) : \
- offsetof(struct efx_##source_name, field)), \
+ .offset = offsetof(struct efx_##source_name, field), \
.get_stat = get_stat_function, \
}
--
2.33.1
Powered by blists - more mailing lists