diff mbox

[1/8] cfg80211: fix possible compile warning in wext-compat.h

Message ID c0bf65125e2d1fce1a1757cd2d46ef47d4a145b9.1397006688.git.gamerh2o@gmail.com (mailing list archive)
State Not Applicable, archived
Headers show

Commit Message

Gang ZHAO April 9, 2014, 1:28 a.m. UTC
Function cfg80211_wext_freq() is declared in wext-compat.h, but its
parameter struct wiphy's declaration is not included there. Actually
the parameter is not used in this function, so change it to normal
net_device.

The compile warning doesn't show up due to duplicate including, but
it's worth fixing it.

net/wireless/wext-compat.h:53:52: warning: ‘struct wiphy’ declared inside parameter list [enabled by default]
 int cfg80211_wext_freq(struct wiphy *wiphy, struct iw_freq *freq);
                                                    ^
net/wireless/wext-compat.h:53:52: warning: its scope is only this definition or declaration, which is probably not what you want [enabled by default]

Signed-off-by: Zhao, Gang <gamerh2o@gmail.com>
---
 net/wireless/ibss.c        | 2 +-
 net/wireless/scan.c        | 6 +++++-
 net/wireless/wext-compat.c | 8 ++++----
 net/wireless/wext-compat.h | 2 +-
 net/wireless/wext-sme.c    | 2 +-
 5 files changed, 12 insertions(+), 8 deletions(-)

Comments

Johannes Berg April 9, 2014, 12:46 p.m. UTC | #1
On Wed, 2014-04-09 at 09:28 +0800, Zhao, Gang wrote:
> Function cfg80211_wext_freq() is declared in wext-compat.h, but its
> parameter struct wiphy's declaration is not included there. Actually
> the parameter is not used in this function, so change it to normal
> net_device.
> 
> The compile warning doesn't show up due to duplicate including, but
> it's worth fixing it.

Why not just include the right file here?

johannes

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Gang ZHAO April 9, 2014, 2:18 p.m. UTC | #2
On Wed, 2014-04-09 at 14:46:50 +0200, Johannes Berg wrote:
> On Wed, 2014-04-09 at 09:28 +0800, Zhao, Gang wrote:
>> Function cfg80211_wext_freq() is declared in wext-compat.h, but its
>> parameter struct wiphy's declaration is not included there. Actually
>> the parameter is not used in this function, so change it to normal
>> net_device.
>> 
>> The compile warning doesn't show up due to duplicate including, but
>> it's worth fixing it.
>
> Why not just include the right file here?

As I said in commit log, that parameter is not used in that function,
and all the other functions in wext-compat.h use net_device as their
parameters, I don't see any reason why this function should be specific.

Although changing the parameter type seems complicated the problem, I
think it's the more reasonable way.

>
> johannes
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Johannes Berg April 10, 2014, 8:02 a.m. UTC | #3
On Wed, 2014-04-09 at 22:18 +0800, Zhao, Gang wrote:

> As I said in commit log, that parameter is not used in that function,
> and all the other functions in wext-compat.h use net_device as their
> parameters, I don't see any reason why this function should be specific.
> 
> Although changing the parameter type seems complicated the problem, I
> think it's the more reasonable way.

Fair enough. I'll take that patch.

johannes

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Johannes Berg April 10, 2014, 8:09 a.m. UTC | #4
On Wed, 2014-04-09 at 09:28 +0800, Zhao, Gang wrote:
> Function cfg80211_wext_freq() is declared in wext-compat.h, but its
> parameter struct wiphy's declaration is not included there. Actually
> the parameter is not used in this function, so change it to normal
> net_device.

I applied this, but the netdev argument is also unused so I just removed
it entirely.

johannes

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Gang ZHAO April 11, 2014, 12:27 a.m. UTC | #5
On Thu, 2014-04-10 at 10:09:36 +0200, Johannes Berg wrote:
> On Wed, 2014-04-09 at 09:28 +0800, Zhao, Gang wrote:
>> Function cfg80211_wext_freq() is declared in wext-compat.h, but its
>> parameter struct wiphy's declaration is not included there. Actually
>> the parameter is not used in this function, so change it to normal
>> net_device.
>
> I applied this, but the netdev argument is also unused so I just removed
> it entirely.

I added netdev argument just to be consistent with other functions. It's
OK to remove it.

>
> johannes
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/net/wireless/ibss.c b/net/wireless/ibss.c
index 071e99c..407f413 100644
--- a/net/wireless/ibss.c
+++ b/net/wireless/ibss.c
@@ -322,7 +322,7 @@  int cfg80211_ibss_wext_siwfreq(struct net_device *dev,
 	if (!rdev->ops->join_ibss)
 		return -EOPNOTSUPP;
 
-	freq = cfg80211_wext_freq(wdev->wiphy, wextfreq);
+	freq = cfg80211_wext_freq(dev, wextfreq);
 	if (freq < 0)
 		return freq;
 
diff --git a/net/wireless/scan.c b/net/wireless/scan.c
index 7d09a71..d526d65 100644
--- a/net/wireless/scan.c
+++ b/net/wireless/scan.c
@@ -1147,7 +1147,11 @@  int cfg80211_wext_siwscan(struct net_device *dev,
 				int k;
 				int wiphy_freq = wiphy->bands[band]->channels[j].center_freq;
 				for (k = 0; k < wreq->num_channels; k++) {
-					int wext_freq = cfg80211_wext_freq(wiphy, &wreq->channel_list[k]);
+					struct iw_freq *freq =
+						&wreq->channel_list[k];
+
+					int wext_freq =
+						cfg80211_wext_freq(dev, freq);
 					if (wext_freq == wiphy_freq)
 						goto wext_freq_found;
 				}
diff --git a/net/wireless/wext-compat.c b/net/wireless/wext-compat.c
index 5661a54..9984d2f 100644
--- a/net/wireless/wext-compat.c
+++ b/net/wireless/wext-compat.c
@@ -253,12 +253,12 @@  EXPORT_SYMBOL_GPL(cfg80211_wext_giwrange);
 
 /**
  * cfg80211_wext_freq - get wext frequency for non-"auto"
- * @wiphy: the wiphy
+ * @dev: the net device
  * @freq: the wext freq encoding
  *
  * Returns a frequency, or a negative error code, or 0 for auto.
  */
-int cfg80211_wext_freq(struct wiphy *wiphy, struct iw_freq *freq)
+int cfg80211_wext_freq(struct net_device *dev, struct iw_freq *freq)
 {
 	/*
 	 * Parse frequency - return 0 for auto and
@@ -787,7 +787,7 @@  static int cfg80211_wext_siwfreq(struct net_device *dev,
 	case NL80211_IFTYPE_ADHOC:
 		return cfg80211_ibss_wext_siwfreq(dev, info, wextfreq, extra);
 	case NL80211_IFTYPE_MONITOR:
-		freq = cfg80211_wext_freq(wdev->wiphy, wextfreq);
+		freq = cfg80211_wext_freq(dev, wextfreq);
 		if (freq < 0)
 			return freq;
 		if (freq == 0)
@@ -798,7 +798,7 @@  static int cfg80211_wext_siwfreq(struct net_device *dev,
 			return -EINVAL;
 		return cfg80211_set_monitor_channel(rdev, &chandef);
 	case NL80211_IFTYPE_MESH_POINT:
-		freq = cfg80211_wext_freq(wdev->wiphy, wextfreq);
+		freq = cfg80211_wext_freq(dev, wextfreq);
 		if (freq < 0)
 			return freq;
 		if (freq == 0)
diff --git a/net/wireless/wext-compat.h b/net/wireless/wext-compat.h
index 5d766b0..bd6aa81 100644
--- a/net/wireless/wext-compat.h
+++ b/net/wireless/wext-compat.h
@@ -50,7 +50,7 @@  int cfg80211_wext_siwgenie(struct net_device *dev,
 			   struct iw_point *data, char *extra);
 
 
-int cfg80211_wext_freq(struct wiphy *wiphy, struct iw_freq *freq);
+int cfg80211_wext_freq(struct net_device *dev, struct iw_freq *freq);
 
 
 extern const struct iw_handler_def cfg80211_wext_handler;
diff --git a/net/wireless/wext-sme.c b/net/wireless/wext-sme.c
index 86c331a..765e37b 100644
--- a/net/wireless/wext-sme.c
+++ b/net/wireless/wext-sme.c
@@ -75,7 +75,7 @@  int cfg80211_mgd_wext_siwfreq(struct net_device *dev,
 	if (WARN_ON(wdev->iftype != NL80211_IFTYPE_STATION))
 		return -EINVAL;
 
-	freq = cfg80211_wext_freq(wdev->wiphy, wextfreq);
+	freq = cfg80211_wext_freq(dev, wextfreq);
 	if (freq < 0)
 		return freq;