Skip to content

Commit 48b4e51

Browse files
committed
Merge branch 'net-is_enabled'
Javier Martinez Canillas says: ==================== net: use IS_ENABLED() instead of checking for built-in or module This trivial series replace the open coding to check for a Kconfig symbol being built-in or module, with IS_ENABLED() macro that does exactly that. Using the macro makes the code more readable by helping abstract away some of the Kconfig built-in and module enable details. ==================== Signed-off-by: David S. Miller <[email protected]>
2 parents 34c1b08 + 65b323e commit 48b4e51

File tree

10 files changed

+19
-20
lines changed

10 files changed

+19
-20
lines changed

net/appletalk/ddp.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1278,7 +1278,7 @@ static int atalk_getname(struct socket *sock, struct sockaddr *uaddr,
12781278
return err;
12791279
}
12801280

1281-
#if defined(CONFIG_IPDDP) || defined(CONFIG_IPDDP_MODULE)
1281+
#if IS_ENABLED(CONFIG_IPDDP)
12821282
static __inline__ int is_ip_over_ddp(struct sk_buff *skb)
12831283
{
12841284
return skb->data[12] == 22;

net/atm/lec.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
#include <linux/atmlec.h>
3232

3333
/* Proxy LEC knows about bridging */
34-
#if defined(CONFIG_BRIDGE) || defined(CONFIG_BRIDGE_MODULE)
34+
#if IS_ENABLED(CONFIG_BRIDGE)
3535
#include "../bridge/br_private.h"
3636

3737
static unsigned char bridge_ula_lec[] = { 0x01, 0x80, 0xc2, 0x00, 0x00 };
@@ -121,7 +121,7 @@ static unsigned char bus_mac[ETH_ALEN] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
121121
/* Device structures */
122122
static struct net_device *dev_lec[MAX_LEC_ITF];
123123

124-
#if defined(CONFIG_BRIDGE) || defined(CONFIG_BRIDGE_MODULE)
124+
#if IS_ENABLED(CONFIG_BRIDGE)
125125
static void lec_handle_bridge(struct sk_buff *skb, struct net_device *dev)
126126
{
127127
char *buff;
@@ -155,7 +155,7 @@ static void lec_handle_bridge(struct sk_buff *skb, struct net_device *dev)
155155
sk->sk_data_ready(sk);
156156
}
157157
}
158-
#endif /* defined(CONFIG_BRIDGE) || defined(CONFIG_BRIDGE_MODULE) */
158+
#endif /* IS_ENABLED(CONFIG_BRIDGE) */
159159

160160
/*
161161
* Open/initialize the netdevice. This is called (in the current kernel)
@@ -222,7 +222,7 @@ static netdev_tx_t lec_start_xmit(struct sk_buff *skb,
222222
pr_debug("skbuff head:%lx data:%lx tail:%lx end:%lx\n",
223223
(long)skb->head, (long)skb->data, (long)skb_tail_pointer(skb),
224224
(long)skb_end_pointer(skb));
225-
#if defined(CONFIG_BRIDGE) || defined(CONFIG_BRIDGE_MODULE)
225+
#if IS_ENABLED(CONFIG_BRIDGE)
226226
if (memcmp(skb->data, bridge_ula_lec, sizeof(bridge_ula_lec)) == 0)
227227
lec_handle_bridge(skb, dev);
228228
#endif
@@ -426,7 +426,7 @@ static int lec_atm_send(struct atm_vcc *vcc, struct sk_buff *skb)
426426
(unsigned short)(0xffff & mesg->content.normal.flag);
427427
break;
428428
case l_should_bridge:
429-
#if defined(CONFIG_BRIDGE) || defined(CONFIG_BRIDGE_MODULE)
429+
#if IS_ENABLED(CONFIG_BRIDGE)
430430
{
431431
pr_debug("%s: bridge zeppelin asks about %pM\n",
432432
dev->name, mesg->content.proxy.mac_addr);
@@ -452,7 +452,7 @@ static int lec_atm_send(struct atm_vcc *vcc, struct sk_buff *skb)
452452
sk->sk_data_ready(sk);
453453
}
454454
}
455-
#endif /* defined(CONFIG_BRIDGE) || defined(CONFIG_BRIDGE_MODULE) */
455+
#endif /* IS_ENABLED(CONFIG_BRIDGE) */
456456
break;
457457
default:
458458
pr_info("%s: Unknown message type %d\n", dev->name, mesg->type);

net/core/dev.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3904,8 +3904,7 @@ static void net_tx_action(struct softirq_action *h)
39043904
}
39053905
}
39063906

3907-
#if (defined(CONFIG_BRIDGE) || defined(CONFIG_BRIDGE_MODULE)) && \
3908-
(defined(CONFIG_ATM_LANE) || defined(CONFIG_ATM_LANE_MODULE))
3907+
#if IS_ENABLED(CONFIG_BRIDGE) && IS_ENABLED(CONFIG_ATM_LANE)
39093908
/* This hook is defined here for ATM LANE */
39103909
int (*br_fdb_test_addr_hook)(struct net_device *dev,
39113910
unsigned char *addr) __read_mostly;

net/ipv4/ip_output.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -490,7 +490,7 @@ static void ip_copy_metadata(struct sk_buff *to, struct sk_buff *from)
490490
to->tc_index = from->tc_index;
491491
#endif
492492
nf_copy(to, from);
493-
#if defined(CONFIG_IP_VS) || defined(CONFIG_IP_VS_MODULE)
493+
#if IS_ENABLED(CONFIG_IP_VS)
494494
to->ipvs_property = from->ipvs_property;
495495
#endif
496496
skb_copy_secmark(to, from);

net/l2tp/l2tp_core.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ struct l2tp_session {
139139
void (*session_close)(struct l2tp_session *session);
140140
void (*ref)(struct l2tp_session *session);
141141
void (*deref)(struct l2tp_session *session);
142-
#if defined(CONFIG_L2TP_DEBUGFS) || defined(CONFIG_L2TP_DEBUGFS_MODULE)
142+
#if IS_ENABLED(CONFIG_L2TP_DEBUGFS)
143143
void (*show)(struct seq_file *m, void *priv);
144144
#endif
145145
uint8_t priv[0]; /* private data */

net/l2tp/l2tp_eth.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ static void l2tp_eth_delete(struct l2tp_session *session)
195195
}
196196
}
197197

198-
#if defined(CONFIG_L2TP_DEBUGFS) || defined(CONFIG_L2TP_DEBUGFS_MODULE)
198+
#if IS_ENABLED(CONFIG_L2TP_DEBUGFS)
199199
static void l2tp_eth_show(struct seq_file *m, void *arg)
200200
{
201201
struct l2tp_session *session = arg;
@@ -268,7 +268,7 @@ static int l2tp_eth_create(struct net *net, u32 tunnel_id, u32 session_id, u32 p
268268
priv->tunnel_sock = tunnel->sock;
269269
session->recv_skb = l2tp_eth_dev_recv;
270270
session->session_close = l2tp_eth_delete;
271-
#if defined(CONFIG_L2TP_DEBUGFS) || defined(CONFIG_L2TP_DEBUGFS_MODULE)
271+
#if IS_ENABLED(CONFIG_L2TP_DEBUGFS)
272272
session->show = l2tp_eth_show;
273273
#endif
274274

net/l2tp/l2tp_ppp.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -552,7 +552,7 @@ static int pppol2tp_create(struct net *net, struct socket *sock, int kern)
552552
return error;
553553
}
554554

555-
#if defined(CONFIG_L2TP_DEBUGFS) || defined(CONFIG_L2TP_DEBUGFS_MODULE)
555+
#if IS_ENABLED(CONFIG_L2TP_DEBUGFS)
556556
static void pppol2tp_show(struct seq_file *m, void *arg)
557557
{
558558
struct l2tp_session *session = arg;
@@ -723,7 +723,7 @@ static int pppol2tp_connect(struct socket *sock, struct sockaddr *uservaddr,
723723

724724
session->recv_skb = pppol2tp_recv;
725725
session->session_close = pppol2tp_session_close;
726-
#if defined(CONFIG_L2TP_DEBUGFS) || defined(CONFIG_L2TP_DEBUGFS_MODULE)
726+
#if IS_ENABLED(CONFIG_L2TP_DEBUGFS)
727727
session->show = pppol2tp_show;
728728
#endif
729729

net/sched/cls_flow.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
#include <net/route.h>
3030
#include <net/flow_dissector.h>
3131

32-
#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
32+
#if IS_ENABLED(CONFIG_NF_CONNTRACK)
3333
#include <net/netfilter/nf_conntrack.h>
3434
#endif
3535

@@ -125,14 +125,14 @@ static u32 flow_get_mark(const struct sk_buff *skb)
125125

126126
static u32 flow_get_nfct(const struct sk_buff *skb)
127127
{
128-
#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
128+
#if IS_ENABLED(CONFIG_NF_CONNTRACK)
129129
return addr_fold(skb->nfct);
130130
#else
131131
return 0;
132132
#endif
133133
}
134134

135-
#if defined(CONFIG_NF_CONNTRACK) || defined(CONFIG_NF_CONNTRACK_MODULE)
135+
#if IS_ENABLED(CONFIG_NF_CONNTRACK)
136136
#define CTTUPLE(skb, member) \
137137
({ \
138138
enum ip_conntrack_info ctinfo; \

net/sctp/auth.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ static struct sctp_hmac sctp_hmac_list[SCTP_AUTH_NUM_HMACS] = {
4848
/* id 2 is reserved as well */
4949
.hmac_id = SCTP_AUTH_HMAC_ID_RESERVED_2,
5050
},
51-
#if defined (CONFIG_CRYPTO_SHA256) || defined (CONFIG_CRYPTO_SHA256_MODULE)
51+
#if IS_ENABLED(CONFIG_CRYPTO_SHA256)
5252
{
5353
.hmac_id = SCTP_AUTH_HMAC_ID_SHA256,
5454
.hmac_name = "hmac(sha256)",

net/xfrm/xfrm_algo.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
#include <linux/crypto.h>
1818
#include <linux/scatterlist.h>
1919
#include <net/xfrm.h>
20-
#if defined(CONFIG_INET_ESP) || defined(CONFIG_INET_ESP_MODULE) || defined(CONFIG_INET6_ESP) || defined(CONFIG_INET6_ESP_MODULE)
20+
#if IS_ENABLED(CONFIG_INET_ESP) || IS_ENABLED(CONFIG_INET6_ESP)
2121
#include <net/esp.h>
2222
#endif
2323

0 commit comments

Comments
 (0)