Skip to contentSkip to conversation

net: asix: Staticise non-exported symbols

PATCH Applied Mark Brown 6 participants 9 messages Aug 9, 2013 – Aug 13, 2013 2 messages not in the archive

Subsystems (3)
lore
Share & tools
lore

Mark Brown

author
#0 lore raw

PATCH 1/2 net: asix: Staticise non-exported symbols

From: Mark Brown <[email protected]>

Make functions that are only referenced from ops structures static, they do not need to be in the global namespace and sparse complains about this.

---
 drivers/net/usb/ax88172a.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/net/usb/ax88172a.c +5 -3
index d012203..723b387 100644
@@ -161,7 +161,8 @@ static const struct net_device_ops ax88172a_netdev_ops = {
 	.ndo_set_rx_mode        = asix_set_multicast,
 };
 
-int ax88172a_get_settings(struct net_device *net, struct ethtool_cmd *cmd)
+static int ax88172a_get_settings(struct net_device *net,
+				 struct ethtool_cmd *cmd)
 {
 	if (!net->phydev)
 		return -ENODEV;
@@ -169,7 +170,8 @@ int ax88172a_get_settings(struct net_device *net, struct ethtool_cmd *cmd)
 	return phy_ethtool_gset(net->phydev, cmd);
 }
 
-int ax88172a_set_settings(struct net_device *net, struct ethtool_cmd *cmd)
+static int ax88172a_set_settings(struct net_device *net,
+				 struct ethtool_cmd *cmd)
 {
 	if (!net->phydev)
 		return -ENODEV;
@@ -177,7 +179,7 @@ int ax88172a_set_settings(struct net_device *net, struct ethtool_cmd *cmd)
 	return phy_ethtool_sset(net->phydev, cmd);
 }
 
-int ax88172a_nway_reset(struct net_device *net)
+static int ax88172a_nway_reset(struct net_device *net)
 {
 	if (!net->phydev)
 		return -ENODEV;
Signature · 1 line
1.8.4.rc1
author
#1 lore raw

PATCH 2/2 net: asix: Move declaration of ax88172a_info to shared header

From: Mark Brown <[email protected]>

Ensure that the definition of ax88172a_info matches the declaration seen by users and silence sparse warnings about symbols without declarations in the global namespace by moving the declaration into the shared header asix.h.

---
 drivers/net/usb/asix.h         | 2 ++
 drivers/net/usb/asix_devices.c | 2 --
 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/net/usb/asix.h +2 -0
index 346c032..bdaa12d 100644
@@ -178,6 +178,8 @@ struct asix_common_private {
 	struct asix_rx_fixup_info rx_fixup_info;
 };
 
+extern const struct driver_info ax88172a_info;
+
 /* ASIX specific flags */
 #define FLAG_EEPROM_MAC		(1UL << 0)  /* init device MAC from eeprom */
 
drivers/net/usb/asix_devices.c +0 -2
index b96ad4f..386a3df 100644
@@ -946,8 +946,6 @@ static const struct driver_info hg20f9_info = {
 	.data = FLAG_EEPROM_MAC,
 };
 
-extern const struct driver_info ax88172a_info;
-
 static const struct usb_device_id	products [] = {
 {
 	// Linksys USB200M
Signature · 1 line
1.8.4.rc1

A message that is not in the archive (sent off-list or not yet received): 1376069482-16951-2-git-send-email-broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org

#3 lore raw

Re: [PATCH 2/2] net: asix: Move declaration of ax88172a_info to shared header

Quoted 18 lines · Mark Brown

From: Mark Brown <[email protected]>

Ensure that the definition of ax88172a_info matches the declaration seen by users and silence sparse warnings about symbols without declarations in the global namespace by moving the declaration into the shared header asix.h.

---
 drivers/net/usb/asix.h         | 2 ++
 drivers/net/usb/asix_devices.c | 2 --
 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/net/usb/asix.h +0 -0
index 346c032..bdaa12d 100644

drivers/net/usb/asix.h struct asix_common_private { · line 181

Quoted 4 lines
drivers/net/usb/asix.h +1 -0
@@ -178,6 +178,8 @@ struct asix_common_private {
        struct asix_rx_fixup_info rx_fixup_info;
 };
 
+extern const struct driver_info ax88172a_info;

You could drop the 'extern' here.

All other function prototypes in this header file do not use 'extern'. --
To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#4 lore raw

Re: [PATCH 2/2] net: asix: Move declaration of ax88172a_info to shared header

Quoted 22 lines · On Fri, 9 Aug 2013 14:39:06 -0300 Fabio Estevam <[email protected]> wrote:
Quoted 21 lines · Mark Brown

From: Mark Brown <[email protected]>

Ensure that the definition of ax88172a_info matches the declaration seen by users and silence sparse warnings about symbols without declarations in the global namespace by moving the declaration into the shared header asix.h.

---
 drivers/net/usb/asix.h         | 2 ++
 drivers/net/usb/asix_devices.c | 2 --
 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/net/usb/asix.h +0 -0
index 346c032..bdaa12d 100644
@@ -178,6 +178,8 @@ struct asix_common_private {
        struct asix_rx_fixup_info rx_fixup_info;
 };
 
Quoted 5 lines

drivers/net/usb/asix.h struct asix_common_private { · line 181

Quoted 1 line
drivers/net/usb/asix.h +1 -0
+extern const struct driver_info ax88172a_info;

You could drop the 'extern' here.

All other function prototypes in this header file do not use 'extern'.

That is data, not function prototype, so yes extern is needed.

A message that is not in the archive (sent off-list or not yet received): 20130809104016.236fcd9d-We1ePj4FEcvRI77zikRAJc56i+j3xesD0e7PPNI6Mm0@public.gmane.org

#6 lore raw

Re: [PATCH 2/2] net: asix: Move declaration of ax88172a_info to shared header

Quoted 25 lines · Stephen Hemminger
Quoted 22 lines · On Fri, 9 Aug 2013 14:39:06 -0300 Fabio Estevam…
Quoted 21 lines · Mark Brown

From: Mark Brown <[email protected]>

Ensure that the definition of ax88172a_info matches the declaration seen by users and silence sparse warnings about symbols without declarations in the global namespace by moving the declaration into the shared header asix.h.

---
 drivers/net/usb/asix.h         | 2 ++
 drivers/net/usb/asix_devices.c | 2 --
 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/net/usb/asix.h +0 -0
index 346c032..bdaa12d 100644
@@ -178,6 +178,8 @@ struct asix_common_private {
        struct asix_rx_fixup_info rx_fixup_info;
 };
 
Quoted 7 lines
Quoted 5 lines

drivers/net/usb/asix.h struct asix_common_private { · line 181

Quoted 1 line
drivers/net/usb/asix.h +1 -0
+extern const struct driver_info ax88172a_info;

You could drop the 'extern' here.

All other function prototypes in this header file do not use 'extern'.

That is data, not function prototype, so yes extern is needed.

And this kind of contradictions show why extern declarations make sense in include files, for text or/and data.

Some compiler folk decided 'extern' were not mandatory for code, but its really adding confusion and endless discussions.

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

maintainer
#7 lore raw

Re: [PATCH 2/2] net: asix: Move declaration of ax88172a_info to shared header

From: Eric Dumazet <[email protected]>
Date: Fri, 09 Aug 2013 10:50:36 -0700

Quoted 2 lines

Some compiler folk decided 'extern' were not mandatory for code, but its really adding confusion and endless discussions.

I certainly stopped talking about it, you could too :-)

#8 lore raw

Re: [PATCH 2/2] net: asix: Move declaration of ax88172a_info to shared header

In reply to Stephen Hemminger
Quoted 7 lines · Stephen Hemminger
Quoted 5 lines
Quoted 1 line

+extern const struct driver_info ax88172a_info;

You could drop the 'extern' here.

All other function prototypes in this header file do not use 'extern'.

That is data, not function prototype, so yes extern is needed.

You are right, sorry for the noise.

maintainer Applied
#9 lore raw

Re: [PATCH 2/2] net: asix: Move declaration of ax88172a_info to shared header

In reply to Mark Brown

From: Mark Brown <[email protected]>
Date: Fri, 9 Aug 2013 18:31:22 +0100

Quoted 8 lines

From: Mark Brown <[email protected]>

Ensure that the definition of ax88172a_info matches the declaration seen by users and silence sparse warnings about symbols without declarations in the global namespace by moving the declaration into the shared header asix.h.

Applied.