Skip to contentSkip to conversation

staging: wilc1000: Move externs from .c to .h files.

PATCH In review Elise Lennion 3 participants 4 messages Oct 7, 2016 – Oct 8, 2016 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 4/4 staging: wilc1000: Move externs from .c to .h files.

Fix checkpatch warning:

WARNING: externs should be avoided in .c files

Keep externs in .h files is better to keep the code congruent, also makes it easier to change in future patches.

---
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 3 ---
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.h | 2 ++
 2 files changed, 2 insertions(+), 3 deletions(-)
drivers/staging/wilc1000/wilc_wfi_cfgoperations.c +0 -3
index fca96d3..a5e2d96 100644
@@ -90,9 +90,6 @@ static const struct wiphy_wowlan_support wowlan_support = {
 #define IS_MGMT_STATUS_SUCCES			0x040
 #define GET_PKT_OFFSET(a) (((a) >> 22) & 0x1ff)
 
-extern int wilc_mac_open(struct net_device *ndev);
-extern int wilc_mac_close(struct net_device *ndev);
-
 static struct network_info last_scanned_shadow[MAX_NUM_SCANNED_NETWORKS_SHADOW];
 static u32 last_scanned_cnt;
 struct timer_list wilc_during_ip_timer;
drivers/staging/wilc1000/wilc_wfi_cfgoperations.h +2 -0
index 85a3810..d1d0546 100644
@@ -19,5 +19,7 @@ int WILC_WFI_deinit_mon_interface(void);
 struct net_device *WILC_WFI_init_mon_interface(const char *name, struct net_device *real_dev);
 void wilc_mgmt_frame_register(struct wiphy *wiphy, struct wireless_dev *wdev,
 			      u16 frame_type, bool reg);
+extern int wilc_mac_open(struct net_device *ndev);
+extern int wilc_mac_close(struct net_device *ndev);
 
 #endif
Signature · 1 line
2.7.4
#1 lore raw
Quoted 31 lines · Elise Lennion

Fix checkpatch warning:

WARNING: externs should be avoided in .c files

Keep externs in .h files is better to keep the code congruent, also makes it easier to change in future patches.

---
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 3 ---
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.h | 2 ++
 2 files changed, 2 insertions(+), 3 deletions(-)
drivers/staging/wilc1000/wilc_wfi_cfgoperations.c +0 -3
index fca96d3..a5e2d96 100644
@@ -90,9 +90,6 @@ static const struct wiphy_wowlan_support wowlan_support = {
 #define IS_MGMT_STATUS_SUCCES			0x040
 #define GET_PKT_OFFSET(a) (((a) >> 22) & 0x1ff)
 
-extern int wilc_mac_open(struct net_device *ndev);
-extern int wilc_mac_close(struct net_device *ndev);
-
 static struct network_info last_scanned_shadow[MAX_NUM_SCANNED_NETWORKS_SHADOW];
 static u32 last_scanned_cnt;
 struct timer_list wilc_during_ip_timer;
drivers/staging/wilc1000/wilc_wfi_cfgoperations.h +0 -0
index 85a3810..d1d0546 100644

drivers/staging/wilc1000/wilc_wfi_cfgoperations.h int WILC_WFI_deinit_mon_interface(void); · line 23

Quoted 5 lines
drivers/staging/wilc1000/wilc_wfi_cfgoperations.h +2 -0
@@ -19,5 +19,7 @@ int WILC_WFI_deinit_mon_interface(void);
 struct net_device *WILC_WFI_init_mon_interface(const char *name, struct net_device *real_dev);
 void wilc_mgmt_frame_register(struct wiphy *wiphy, struct wireless_dev *wdev,
 			      u16 frame_type, bool reg);
+extern int wilc_mac_open(struct net_device *ndev);
+extern int wilc_mac_close(struct net_device *ndev);

Doesn't it now complain that functions are extern by default? There is no extern on the function declaration on the line above for example.

julia

Quoted 12 lines
drivers/staging/wilc1000/wilc_wfi_cfgoperations.h +0 -1
 #endif
--

2.7.4

--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/20161007042221.GA23529%40lennorien.com.
For more options, visit https://groups.google.com/d/optout.

#3 lore raw
In reply to Elise Lennion
Quoted 8 lines · CEST Elise Lennion

Fix checkpatch warning:

WARNING: externs should be avoided in .c files

Keep externs in .h files is better to keep the code congruent, also makes it easier to change in future patches.

There are already declarations in wilc_wlan.h for these, I think you can just remove the duplicate ones from the .c file.

Arnd

#2 lore raw
In reply to Julia Lawall
Quoted 44 lines · Julia Lawall
Quoted 31 lines · Elise Lennion

Fix checkpatch warning:

WARNING: externs should be avoided in .c files

Keep externs in .h files is better to keep the code congruent, also makes it easier to change in future patches.

---
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 3 ---
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.h | 2 ++
 2 files changed, 2 insertions(+), 3 deletions(-)
drivers/staging/wilc1000/wilc_wfi_cfgoperations.c +0 -3
index fca96d3..a5e2d96 100644
@@ -90,9 +90,6 @@ static const struct wiphy_wowlan_support wowlan_support = {
 #define IS_MGMT_STATUS_SUCCES			0x040
 #define GET_PKT_OFFSET(a) (((a) >> 22) & 0x1ff)
 
-extern int wilc_mac_open(struct net_device *ndev);
-extern int wilc_mac_close(struct net_device *ndev);
-
 static struct network_info last_scanned_shadow[MAX_NUM_SCANNED_NETWORKS_SHADOW];
 static u32 last_scanned_cnt;
 struct timer_list wilc_during_ip_timer;
drivers/staging/wilc1000/wilc_wfi_cfgoperations.h +0 -0
index 85a3810..d1d0546 100644

drivers/staging/wilc1000/wilc_wfi_cfgoperations.h int WILC_WFI_deinit_mon_interface(void); · line 23

Quoted 5 lines
drivers/staging/wilc1000/wilc_wfi_cfgoperations.h +2 -0
@@ -19,5 +19,7 @@ int WILC_WFI_deinit_mon_interface(void);
 struct net_device *WILC_WFI_init_mon_interface(const char *name, struct net_device *real_dev);
 void wilc_mgmt_frame_register(struct wiphy *wiphy, struct wireless_dev *wdev,
 			      u16 frame_type, bool reg);
+extern int wilc_mac_open(struct net_device *ndev);
+extern int wilc_mac_close(struct net_device *ndev);

Doesn't it now complain that functions are extern by default? There is no extern on the function declaration on the line above for example.

Quoted 8 lines

julia

Quoted 6 lines
drivers/staging/wilc1000/wilc_wfi_cfgoperations.h +0 -1
 #endif
--

2.7.4

--

Yes it does complain as a CHECK and I didn't notice, I'll be more careful in future patches.

I decided to follow the sugestion of Arnd Bergmann <[email protected]> and remove the extern declarations.
There aren't files that don't include wilc_wlan.h and use them, so it seems unnecessary to move them to wilc_wfi_cfgoperations.h.

elise