Re: [PATCH] net: mvneta: mark symbols static where possible

From: Sergei Shtylyov
Date: Sun Sep 18 2016 - 08:05:39 EST


Hello.

On 9/18/2016 12:20 PM, Baoyou Xie wrote:

We get 2 warnings when building kernel with W=1:
drivers/net/ethernet/marvell/mvneta.c:639:27: warning: no previous prototype for 'mvneta_get_stats64' [-Wmissing-prototypes]
drivers/net/ethernet/marvell/mvneta.c:3529:5: warning: no previous prototype for 'mvneta_ethtool_set_link_ksettings' [-Wmissing-prototypes]

In fact, these functions are only used in the file in which they are
declared and don't need a declaration, but can be made static.
so this patch marks these functions with 'static'.

Signed-off-by: Baoyou Xie <baoyou.xie@xxxxxxxxxx>
---
drivers/net/ethernet/marvell/mvneta.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/marvell/mvneta.c b/drivers/net/ethernet/marvell/mvneta.c
index 32f0cc4..03be592 100644
--- a/drivers/net/ethernet/marvell/mvneta.c
+++ b/drivers/net/ethernet/marvell/mvneta.c
@@ -636,8 +636,9 @@ static void mvneta_mib_counters_clear(struct mvneta_port *pp)
}

/* Get System Network Statistics */
-struct rtnl_link_stats64 *mvneta_get_stats64(struct net_device *dev,
- struct rtnl_link_stats64 *stats)
+static struct
+rtnl_link_stats64 *mvneta_get_stats64(struct net_device *dev,

I'd break the line after * heren not where you did it. This way the function type would remain all in one line.

+ struct rtnl_link_stats64 *stats)
{
struct mvneta_port *pp = netdev_priv(dev);
unsigned int start;
[...]

MBR, Sergei