diff mbox series

[net-next,2/2] bnxt_en: tc: only the function prototypes need to be wrapped in #ifdef

Message ID a58d04f653e79b12c86eaa67f768f4ff64b2a975.1507319311.git.jtoppins@redhat.com
State Rejected, archived
Delegated to: David Miller
Headers show
Series [net-next,1/2] bnxt_en: don't consider building bnxt_tc.o if option not enabled | expand

Commit Message

Jonathan Toppins Oct. 6, 2017, 7:48 p.m. UTC
There is no reason to wrap the data structures inside the ifdef.

Signed-off-by: Jonathan Toppins <jtoppins@redhat.com>
---
 drivers/net/ethernet/broadcom/bnxt/bnxt_tc.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Michael Chan Oct. 7, 2017, 1:27 a.m. UTC | #1
On Fri, Oct 6, 2017 at 12:48 PM, Jonathan Toppins <jtoppins@redhat.com> wrote:
> There is no reason to wrap the data structures inside the ifdef.

What's so bad about wrapping unused data structures inside #ifdef?
These structures are only used if CONFIG_BNXT_FLOWER_OFFLOAD is
defined.
David Miller Oct. 7, 2017, 2:01 a.m. UTC | #2
From: Michael Chan <michael.chan@broadcom.com>
Date: Fri, 6 Oct 2017 18:27:31 -0700

> On Fri, Oct 6, 2017 at 12:48 PM, Jonathan Toppins <jtoppins@redhat.com> wrote:
>> There is no reason to wrap the data structures inside the ifdef.
> 
> What's so bad about wrapping unused data structures inside #ifdef?
> These structures are only used if CONFIG_BNXT_FLOWER_OFFLOAD is
> defined.

Yeah I agree, this ifdef is actually a good way to trap unintentional
usage of those datastructures so it's doubly best to keep the ifdef.
diff mbox series

Patch

diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_tc.h b/drivers/net/ethernet/broadcom/bnxt/bnxt_tc.h
index 6c4c1ed279ef..6e771e9eed51 100644
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt_tc.h
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_tc.h
@@ -10,8 +10,6 @@ 
 #ifndef BNXT_TC_H
 #define BNXT_TC_H
 
-#ifdef CONFIG_BNXT_FLOWER_OFFLOAD
-
 /* Structs used for storing the filter/actions of the TC cmd.
  */
 struct bnxt_tc_l2_key {
@@ -133,6 +131,8 @@  struct bnxt_tc_flow_node {
 	struct rcu_head			rcu;
 };
 
+#if IS_ENABLED(CONFIG_BNXT_FLOWER_OFFLOAD)
+
 int bnxt_tc_setup_flower(struct bnxt *bp, u16 src_fid,
 			 struct tc_cls_flower_offload *cls_flower);
 int bnxt_init_tc(struct bnxt *bp);