Skip to contentSkip to conversation

Staging: wilc1000: Move extern declaration to header

PATCH In review Bhumika Goyal 2 participants 4 messages Sep 17, 2016 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Staging: wilc1000: Move extern declaration to header

Move extern declaration in wilc_wfi_cfgoperations.c to the respective header wilc_wfi_cfgoperations.h. Extern removed using coccinelle and other changes done by hand. Script:
@@
identifier func;
type T;
@@
- extern
T func(...);

---
 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 2c2e8ac..3b26130 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..ca71e49 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);
+int wilc_mac_open(struct net_device *ndev);
+int wilc_mac_close(struct net_device *ndev);
 
 #endif
Signature · 1 line
1.9.1
#1 lore raw
Quoted 3 lines · Bhumika Goyal

Move extern declaration in wilc_wfi_cfgoperations.c to the respective header wilc_wfi_cfgoperations.h. Extern removed using coccinelle and other changes done by hand.

With grep, it looks to me like these functions are only used in linux_wlan.c. There is a declaration in wilc_wfi_cfgoperations.c, but no use. Thus, it looks like the functions could be static. Furthermore, if the declaration of the wilc_netdev_ops structure were moved lower in the file, perhaps the forward declarations could be dropped completely.

Be sure that you can compile the whole driver to check this. There is always the possibility of something strange being done with a macro that could obscure another use.

julia

Quoted 50 lines

Script:
@@
identifier func;
type T;
@@
- extern
T func(...);

---
 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 2c2e8ac..3b26130 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 -1
index 85a3810..ca71e49 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);
+int wilc_mac_open(struct net_device *ndev);
+int wilc_mac_close(struct net_device *ndev);
 
 #endif
--

1.9.1

--
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/1474098886-6239-1-git-send-email-bhumirks%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

#2 lore raw
Quoted 9 lines · Julia Lawall
Quoted 3 lines · Bhumika Goyal

Move extern declaration in wilc_wfi_cfgoperations.c to the respective header wilc_wfi_cfgoperations.h. Extern removed using coccinelle and other changes done by hand.

Quoted 6 lines

With grep, it looks to me like these functions are only used in linux_wlan.c. There is a declaration in wilc_wfi_cfgoperations.c, but no use. Thus, it looks like the functions could be static. Furthermore, if the declaration of the wilc_netdev_ops structure were moved lower in the file, perhaps the forward declarations could be dropped completely.

Yes, the functions wilc_mac_{close/open} can be made static. So I will do it in v2 of this patch and remove their declaration from the header as well as it won't be needed after making them static.
And the forward function prototypes can be dropped as well if the structure wilc_netdev_ops is moved lower.
I will make a separate patch for this change.

Thanks,
Bhumika

Quoted 57 lines

Be sure that you can compile the whole driver to check this. There is always the possibility of something strange being done with a macro that could obscure another use.

julia

Quoted 50 lines

Script:
@@
identifier func;
type T;
@@
- extern
T func(...);

---
 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 2c2e8ac..3b26130 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 -1
index 85a3810..ca71e49 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);
+int wilc_mac_open(struct net_device *ndev);
+int wilc_mac_close(struct net_device *ndev);
 
 #endif
--

1.9.1

--
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/1474098886-6239-1-git-send-email-bhumirks%40gmail.com.
For more options, visit https://groups.google.com/d/optout.

#3 lore raw
Quoted 25 lines · Bhumika Goyal
Quoted 9 lines · Julia Lawall
Quoted 3 lines · Bhumika Goyal

Move extern declaration in wilc_wfi_cfgoperations.c to the respective header wilc_wfi_cfgoperations.h. Extern removed using coccinelle and other changes done by hand.

Quoted 6 lines

With grep, it looks to me like these functions are only used in linux_wlan.c. There is a declaration in wilc_wfi_cfgoperations.c, but no use. Thus, it looks like the functions could be static. Furthermore, if the declaration of the wilc_netdev_ops structure were moved lower in the file, perhaps the forward declarations could be dropped completely.

Yes, the functions wilc_mac_{close/open} can be made static. So I will do it in v2 of this patch and remove their declaration from the header as well as it won't be needed after making them static.
And the forward function prototypes can be dropped as well if the structure wilc_netdev_ops is moved lower.
I will make a separate patch for this change.

Quoted 2 lines

Thanks,
Bhumika

Hey Greg,
I am dropping this patch because as pointed by Julia the functions can be made static. So, I will do that in a separate patch along with some other changes.

Thanks,
Bhumika

Quoted 57 lines
Quoted 57 lines

Be sure that you can compile the whole driver to check this. There is always the possibility of something strange being done with a macro that could obscure another use.

julia

Quoted 50 lines

Script:
@@
identifier func;
type T;
@@
- extern
T func(...);

---
 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 2c2e8ac..3b26130 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 -1
index 85a3810..ca71e49 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);
+int wilc_mac_open(struct net_device *ndev);
+int wilc_mac_close(struct net_device *ndev);
 
 #endif
--

1.9.1

--
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/1474098886-6239-1-git-send-email-bhumirks%40gmail.com.
For more options, visit https://groups.google.com/d/optout.