Skip to content

Commit c5e7299

Browse files
jerome-pouillerjhedberg
authored andcommitted
drivers: wifi: siwx917: Get rid of #ifdef
We try to avoid #ifdef when possible, especially in .c files. Signed-off-by: Jérôme Pouiller <[email protected]>
1 parent 6764e66 commit c5e7299

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

drivers/wifi/siwx917/siwx917_wifi_socket.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,14 +59,16 @@ static void siwx917_sockaddr_swap_bytes(struct sockaddr *out,
5959

6060
void siwx917_on_join_ipv4(struct siwx917_dev *sidev)
6161
{
62-
#ifdef CONFIG_NET_IPV4
6362
sl_net_ip_configuration_t ip_config4 = {
6463
.mode = SL_IP_MANAGEMENT_DHCP,
6564
.type = SL_IPV4,
6665
};
6766
struct in_addr addr4 = { };
6867
int ret;
6968

69+
if (!IS_ENABLED(CONFIG_NET_IPV4)) {
70+
return;
71+
}
7072
/* FIXME: support for static IP configuration */
7173
ret = sl_si91x_configure_ip_address(&ip_config4, SL_SI91X_WIFI_CLIENT_VAP_ID);
7274
if (!ret) {
@@ -76,19 +78,20 @@ void siwx917_on_join_ipv4(struct siwx917_dev *sidev)
7678
} else {
7779
LOG_ERR("sl_si91x_configure_ip_address(): %#04x", ret);
7880
}
79-
#endif
8081
}
8182

8283
void siwx917_on_join_ipv6(struct siwx917_dev *sidev)
8384
{
84-
#ifdef CONFIG_NET_IPV6
8585
sl_net_ip_configuration_t ip_config6 = {
8686
.mode = SL_IP_MANAGEMENT_DHCP,
8787
.type = SL_IPV6,
8888
};
8989
struct in6_addr addr6 = { };
9090
int ret, i;
9191

92+
if (!IS_ENABLED(CONFIG_NET_IPV6)) {
93+
return;
94+
}
9295
/* FIXME: support for static IP configuration */
9396
ret = sl_si91x_configure_ip_address(&ip_config6, SL_SI91X_WIFI_CLIENT_VAP_ID);
9497
if (!ret) {
@@ -104,7 +107,6 @@ void siwx917_on_join_ipv6(struct siwx917_dev *sidev)
104107
} else {
105108
LOG_ERR("sl_si91x_configure_ip_address(): %#04x", ret);
106109
}
107-
#endif
108110
}
109111

110112
static int siwx917_sock_recv_sync(struct net_context *context,

0 commit comments

Comments
 (0)