diff mbox

net: dsa/slave: Fix compilation warnings

Message ID 5afab1ebe83e4361f1fd75bbea0c559af195bf02.1351529738.git.viresh.kumar@linaro.org
State Superseded
Headers show

Commit Message

Viresh Kumar Oct. 29, 2012, 4:57 p.m. UTC
Currently when none of CONFIG_NET_DSA_TAG_DSA, CONFIG_NET_DSA_TAG_EDSA and
CONFIG_NET_DSA_TAG_TRAILER is defined, we get following compilation warnings:

net/dsa/slave.c:51:12: warning: 'dsa_slave_init' defined but not used [-Wunused-function]
net/dsa/slave.c:60:12: warning: 'dsa_slave_open' defined but not used [-Wunused-function]
net/dsa/slave.c:98:12: warning: 'dsa_slave_close' defined but not used [-Wunused-function]
net/dsa/slave.c:116:13: warning: 'dsa_slave_change_rx_flags' defined but not used [-Wunused-function]
net/dsa/slave.c:127:13: warning: 'dsa_slave_set_rx_mode' defined but not used [-Wunused-function]
net/dsa/slave.c:136:12: warning: 'dsa_slave_set_mac_address' defined but not used [-Wunused-function]
net/dsa/slave.c:164:12: warning: 'dsa_slave_ioctl' defined but not used [-Wunused-function]

Fix them by enclosing these routines under #ifdef,endif.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
---
 net/dsa/slave.c | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Ben Hutchings Oct. 29, 2012, 7:59 p.m. UTC | #1
On Mon, 2012-10-29 at 22:27 +0530, Viresh Kumar wrote:
> Currently when none of CONFIG_NET_DSA_TAG_DSA, CONFIG_NET_DSA_TAG_EDSA and
> CONFIG_NET_DSA_TAG_TRAILER is defined, we get following compilation warnings:
> 
> net/dsa/slave.c:51:12: warning: 'dsa_slave_init' defined but not used [-Wunused-function]
> net/dsa/slave.c:60:12: warning: 'dsa_slave_open' defined but not used [-Wunused-function]
> net/dsa/slave.c:98:12: warning: 'dsa_slave_close' defined but not used [-Wunused-function]
> net/dsa/slave.c:116:13: warning: 'dsa_slave_change_rx_flags' defined but not used [-Wunused-function]
> net/dsa/slave.c:127:13: warning: 'dsa_slave_set_rx_mode' defined but not used [-Wunused-function]
> net/dsa/slave.c:136:12: warning: 'dsa_slave_set_mac_address' defined but not used [-Wunused-function]
> net/dsa/slave.c:164:12: warning: 'dsa_slave_ioctl' defined but not used [-Wunused-function]
> 
> Fix them by enclosing these routines under #ifdef,endif.
[...]

This is not a useful configuration.  It might make more sense to make
NET_DSA a hidden option and have the DSA drivers (in drivers/net/dsa)
select it rather than depending on it.

Ben.
Viresh Kumar Oct. 30, 2012, 6:45 a.m. UTC | #2
On 30 October 2012 01:29, Ben Hutchings <bhutchings@solarflare.com> wrote:
> On Mon, 2012-10-29 at 22:27 +0530, Viresh Kumar wrote:
>> Currently when none of CONFIG_NET_DSA_TAG_DSA, CONFIG_NET_DSA_TAG_EDSA and
>> CONFIG_NET_DSA_TAG_TRAILER is defined, we get following compilation warnings:
>>
>> net/dsa/slave.c:51:12: warning: 'dsa_slave_init' defined but not used [-Wunused-function]
>> net/dsa/slave.c:60:12: warning: 'dsa_slave_open' defined but not used [-Wunused-function]
>> net/dsa/slave.c:98:12: warning: 'dsa_slave_close' defined but not used [-Wunused-function]
>> net/dsa/slave.c:116:13: warning: 'dsa_slave_change_rx_flags' defined but not used [-Wunused-function]
>> net/dsa/slave.c:127:13: warning: 'dsa_slave_set_rx_mode' defined but not used [-Wunused-function]
>> net/dsa/slave.c:136:12: warning: 'dsa_slave_set_mac_address' defined but not used [-Wunused-function]
>> net/dsa/slave.c:164:12: warning: 'dsa_slave_ioctl' defined but not used [-Wunused-function]
>>
>> Fix them by enclosing these routines under #ifdef,endif.
> [...]
>
> This is not a useful configuration.  It might make more sense to make
> NET_DSA a hidden option and have the DSA drivers (in drivers/net/dsa)
> select it rather than depending on it.

I don't have any idea about net/dsa/***. I just wanted to fix this
awkward looking warning :)
What i understood from your comment is: Atleast one of the tagging
formats must be
always enabled if we want to use net/dsa/ stuff ??

And so the functions i have enclosed under ifdefs will always be used
if net/dsa/ is
used.

And so, if we select NET_DSA from these tagging drivers, then only slave.c will
get compiled. Otherwise slave.c dsa.c dsa_core.c wouldn't be compiled and so
no warnings.

Correct??

--
viresh
diff mbox

Patch

diff --git a/net/dsa/slave.c b/net/dsa/slave.c
index e32083d..5606fae 100644
--- a/net/dsa/slave.c
+++ b/net/dsa/slave.c
@@ -48,6 +48,8 @@  void dsa_slave_mii_bus_init(struct dsa_switch *ds)
 
 
 /* slave device handling ****************************************************/
+#if defined(CONFIG_NET_DSA_TAG_DSA) || defined(CONFIG_NET_DSA_TAG_EDSA) || \
+		defined(CONFIG_NET_DSA_TAG_TRAILER)
 static int dsa_slave_init(struct net_device *dev)
 {
 	struct dsa_slave_priv *p = netdev_priv(dev);
@@ -170,6 +172,8 @@  static int dsa_slave_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
 
 	return -EOPNOTSUPP;
 }
+#endif /* defined(CONFIG_NET_DSA_TAG_DSA) || defined(CONFIG_NET_DSA_TAG_EDSA ||
+		defined(CONFIG_NET_DSA_TAG_TRAILER) */
 
 
 /* ethtool operations *******************************************************/