# \[PATCH v2 07/10\] cgroup: net\_cls: Simplify ifdef logic

- From: Daniel Wagner \<hidden\>
- Date: 2012-08-24 14:01:41 
- List: netdev
- Page: https://ratatoskr.run/netdev/2012/08/10902600

```text
From: Daniel Wagner <redacted>

Signed-off-by: Daniel Wagner <redacted>
Cc: "David S. Miller" <redacted>
Cc: Gao feng <redacted>
Cc: Jamal Hadi Salim <redacted>
Cc: John Fastabend <redacted>
Cc: Li Zefan <redacted>
Cc: Neil Horman <redacted>
Cc: Tejun Heo <redacted>
Cc: <redacted>
Cc: <redacted>
---
 include/net/cls_cgroup.h | 12 +++++-------
 net/core/sock.c          |  2 ++
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/include/net/cls_cgroup.h b/include/net/cls_cgroup.h
index 43fae13..5906a25 100644
--- a/include/net/cls_cgroup.h
+++ b/include/net/cls_cgroup.h
@@ -18,7 +18,7 @@
 #include <linux/rcupdate.h>
 #include <linux/jump_label.h>
 
-#ifdef CONFIG_CGROUPS
+#if IS_ENABLED(CONFIG_NET_CLS_CGROUP)
 struct cgroup_cls_state
 {
 	struct cgroup_subsys_state css;
@@ -64,21 +64,19 @@ static inline u32 task_cls_classid(struct task_struct *p)
 	return classid;
 }
 
-#else
+#endif
+
+#else /* !CONFIG_NET_CLS_CGROUP */
 
 static inline u32 task_cls_classid(struct task_struct *p)
 {
 	return 0;
 }
 
-#endif /* CONFIG_NET_CLS_CGROUP */
-
-#else /* !CONFIG_CGROUPS */
-
 static inline void sock_update_classid(struct sock *sk)
 {
 }
 
-#endif /* CONFIG_CGROURPS */
+#endif /* CONFIG_NET_CLS_CGROUP */
 
 #endif  /* _NET_CLS_CGROUP_H */
diff --git a/net/core/sock.c b/net/core/sock.c
index aa762d9..b1fadfd 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -1223,6 +1223,7 @@ static void sk_prot_free(struct proto *prot, struct sock *sk)
 }
 
 #ifdef CONFIG_CGROUPS
+#if IS_ENABLED(CONFIG_NET_CLS_CGROUP)
 void sock_update_classid(struct sock *sk)
 {
 	u32 classid;
@@ -1234,6 +1235,7 @@ void sock_update_classid(struct sock *sk)
 		sk->sk_classid = classid;
 }
 EXPORT_SYMBOL(sock_update_classid);
+#endif
 
 void sock_update_netprioidx(struct sock *sk, struct task_struct *task)
 {
-- 
1.7.12.rc1.16.g05a20c8
```
