From: Mark Brown broonie@linaro.org
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.
Signed-off-by: Mark Brown broonie@linaro.org --- drivers/net/usb/ax88172a.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/drivers/net/usb/ax88172a.c b/drivers/net/usb/ax88172a.c index d012203..723b387 100644 --- a/drivers/net/usb/ax88172a.c +++ b/drivers/net/usb/ax88172a.c @@ -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;
From: Mark Brown broonie@linaro.org
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.
Signed-off-by: Mark Brown broonie@linaro.org --- drivers/net/usb/asix.h | 2 ++ drivers/net/usb/asix_devices.c | 2 -- 2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/usb/asix.h b/drivers/net/usb/asix.h index 346c032..bdaa12d 100644 --- a/drivers/net/usb/asix.h +++ b/drivers/net/usb/asix.h @@ -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 */
diff --git a/drivers/net/usb/asix_devices.c b/drivers/net/usb/asix_devices.c index b96ad4f..386a3df 100644 --- a/drivers/net/usb/asix_devices.c +++ b/drivers/net/usb/asix_devices.c @@ -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
On Fri, Aug 9, 2013 at 2:31 PM, Mark Brown broonie@kernel.org wrote:
From: Mark Brown broonie@linaro.org
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.
Signed-off-by: Mark Brown broonie@linaro.org
drivers/net/usb/asix.h | 2 ++ drivers/net/usb/asix_devices.c | 2 -- 2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/usb/asix.h b/drivers/net/usb/asix.h index 346c032..bdaa12d 100644 --- a/drivers/net/usb/asix.h +++ b/drivers/net/usb/asix.h @@ -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'.
On Fri, 9 Aug 2013 14:39:06 -0300 Fabio Estevam festevam@gmail.com wrote:
On Fri, Aug 9, 2013 at 2:31 PM, Mark Brown broonie@kernel.org wrote:
From: Mark Brown broonie@linaro.org
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.
Signed-off-by: Mark Brown broonie@linaro.org
drivers/net/usb/asix.h | 2 ++ drivers/net/usb/asix_devices.c | 2 -- 2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/usb/asix.h b/drivers/net/usb/asix.h index 346c032..bdaa12d 100644 --- a/drivers/net/usb/asix.h +++ b/drivers/net/usb/asix.h @@ -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'.
That is data, not function prototype, so yes extern is needed.
On Fri, 2013-08-09 at 10:40 -0700, Stephen Hemminger wrote:
On Fri, 9 Aug 2013 14:39:06 -0300 Fabio Estevam festevam@gmail.com wrote:
On Fri, Aug 9, 2013 at 2:31 PM, Mark Brown broonie@kernel.org wrote:
From: Mark Brown broonie@linaro.org
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.
Signed-off-by: Mark Brown broonie@linaro.org
drivers/net/usb/asix.h | 2 ++ drivers/net/usb/asix_devices.c | 2 -- 2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/usb/asix.h b/drivers/net/usb/asix.h index 346c032..bdaa12d 100644 --- a/drivers/net/usb/asix.h +++ b/drivers/net/usb/asix.h @@ -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'.
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.
From: Eric Dumazet eric.dumazet@gmail.com Date: Fri, 09 Aug 2013 10:50:36 -0700
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 :-)
On Fri, Aug 9, 2013 at 2:40 PM, Stephen Hemminger stephen@networkplumber.org wrote:
+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.
From: Mark Brown broonie@kernel.org Date: Fri, 9 Aug 2013 18:31:22 +0100
From: Mark Brown broonie@linaro.org
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.
Signed-off-by: Mark Brown broonie@linaro.org
Applied.
From: Mark Brown broonie@kernel.org Date: Fri, 9 Aug 2013 18:31:21 +0100
From: Mark Brown broonie@linaro.org
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.
Signed-off-by: Mark Brown broonie@linaro.org
Applied.
linaro-kernel@lists.linaro.org