aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArnd Bergmann <arnd@arndb.de>2018-08-13 17:43:05 -0400
committerDavid S. Miller <davem@davemloft.net>2018-08-13 23:45:49 -0400
commitc2ebc25674e5123d134e81758828084f1cc58cc3 (patch)
treebf2724e414a7035fb883e9e8f4b165fc2dbe9894
parent3d46eee5a5f2f22ca04e2139e8c9a16b81d16073 (diff)
l2tp: fix unused function warning
Removing one of the callers of pppol2tp_session_get_sock caused a harmless warning in some configurations: net/l2tp/l2tp_ppp.c:142:21: 'pppol2tp_session_get_sock' defined but not used [-Wunused-function] Rather than adding another #ifdef here, using a proper IS_ENABLED() check makes the code more readable and avoids those warnings while letting the compiler figure out for itself which code is needed. This adds one pointer for the unused show() callback in struct l2tp_session, but that seems harmless. Fixes: b0e29063dcb3 ("l2tp: remove pppol2tp_session_ioctl()") Signed-off-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--net/l2tp/l2tp_core.h2
-rw-r--r--net/l2tp/l2tp_eth.c7
-rw-r--r--net/l2tp/l2tp_ppp.c7
3 files changed, 4 insertions, 12 deletions
diff --git a/net/l2tp/l2tp_core.h b/net/l2tp/l2tp_core.h
index 8480a0af973e..9c9afe94d389 100644
--- a/net/l2tp/l2tp_core.h
+++ b/net/l2tp/l2tp_core.h
@@ -118,9 +118,7 @@ struct l2tp_session {
118 int (*build_header)(struct l2tp_session *session, void *buf); 118 int (*build_header)(struct l2tp_session *session, void *buf);
119 void (*recv_skb)(struct l2tp_session *session, struct sk_buff *skb, int data_len); 119 void (*recv_skb)(struct l2tp_session *session, struct sk_buff *skb, int data_len);
120 void (*session_close)(struct l2tp_session *session); 120 void (*session_close)(struct l2tp_session *session);
121#if IS_ENABLED(CONFIG_L2TP_DEBUGFS)
122 void (*show)(struct seq_file *m, void *priv); 121 void (*show)(struct seq_file *m, void *priv);
123#endif
124 uint8_t priv[0]; /* private data */ 122 uint8_t priv[0]; /* private data */
125}; 123};
126 124
diff --git a/net/l2tp/l2tp_eth.c b/net/l2tp/l2tp_eth.c
index 3728986ec885..8aadc4f3bb9e 100644
--- a/net/l2tp/l2tp_eth.c
+++ b/net/l2tp/l2tp_eth.c
@@ -199,7 +199,6 @@ static void l2tp_eth_delete(struct l2tp_session *session)
199 } 199 }
200} 200}
201 201
202#if IS_ENABLED(CONFIG_L2TP_DEBUGFS)
203static void l2tp_eth_show(struct seq_file *m, void *arg) 202static void l2tp_eth_show(struct seq_file *m, void *arg)
204{ 203{
205 struct l2tp_session *session = arg; 204 struct l2tp_session *session = arg;
@@ -219,7 +218,6 @@ static void l2tp_eth_show(struct seq_file *m, void *arg)
219 218
220 dev_put(dev); 219 dev_put(dev);
221} 220}
222#endif
223 221
224static void l2tp_eth_adjust_mtu(struct l2tp_tunnel *tunnel, 222static void l2tp_eth_adjust_mtu(struct l2tp_tunnel *tunnel,
225 struct l2tp_session *session, 223 struct l2tp_session *session,
@@ -305,9 +303,8 @@ static int l2tp_eth_create(struct net *net, struct l2tp_tunnel *tunnel,
305 303
306 session->recv_skb = l2tp_eth_dev_recv; 304 session->recv_skb = l2tp_eth_dev_recv;
307 session->session_close = l2tp_eth_delete; 305 session->session_close = l2tp_eth_delete;
308#if IS_ENABLED(CONFIG_L2TP_DEBUGFS) 306 if (IS_ENABLED(CONFIG_L2TP_DEBUGFS))
309 session->show = l2tp_eth_show; 307 session->show = l2tp_eth_show;
310#endif
311 308
312 spriv = l2tp_session_priv(session); 309 spriv = l2tp_session_priv(session);
313 310
diff --git a/net/l2tp/l2tp_ppp.c b/net/l2tp/l2tp_ppp.c
index 62f2d3f1e431..04d9946dcdba 100644
--- a/net/l2tp/l2tp_ppp.c
+++ b/net/l2tp/l2tp_ppp.c
@@ -533,7 +533,6 @@ out:
533 return error; 533 return error;
534} 534}
535 535
536#if IS_ENABLED(CONFIG_L2TP_DEBUGFS)
537static void pppol2tp_show(struct seq_file *m, void *arg) 536static void pppol2tp_show(struct seq_file *m, void *arg)
538{ 537{
539 struct l2tp_session *session = arg; 538 struct l2tp_session *session = arg;
@@ -547,16 +546,14 @@ static void pppol2tp_show(struct seq_file *m, void *arg)
547 sock_put(sk); 546 sock_put(sk);
548 } 547 }
549} 548}
550#endif
551 549
552static void pppol2tp_session_init(struct l2tp_session *session) 550static void pppol2tp_session_init(struct l2tp_session *session)
553{ 551{
554 struct pppol2tp_session *ps; 552 struct pppol2tp_session *ps;
555 553
556 session->recv_skb = pppol2tp_recv; 554 session->recv_skb = pppol2tp_recv;
557#if IS_ENABLED(CONFIG_L2TP_DEBUGFS) 555 if (IS_ENABLED(CONFIG_L2TP_DEBUGFS))
558 session->show = pppol2tp_show; 556 session->show = pppol2tp_show;
559#endif
560 557
561 ps = l2tp_session_priv(session); 558 ps = l2tp_session_priv(session);
562 mutex_init(&ps->sk_lock); 559 mutex_init(&ps->sk_lock);