diff mbox

[RFC,2/4] cfg80211: rename function argument to be more readable

Message ID 1389194818-7864-3-git-send-email-michal.kazior@tieto.com (mailing list archive)
State Not Applicable, archived
Headers show

Commit Message

Michal Kazior Jan. 8, 2014, 3:26 p.m. UTC
Unifies variable naming regarding radar detection
width.

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
---
 net/wireless/core.h |  2 +-
 net/wireless/util.c | 14 +++++++-------
 2 files changed, 8 insertions(+), 8 deletions(-)

Comments

Johannes Berg Jan. 14, 2014, 4:08 p.m. UTC | #1
On Wed, 2014-01-08 at 16:26 +0100, Michal Kazior wrote:
> Unifies variable naming regarding radar detection
> width.

I think this is dangerous - "radar_detect_width" could easily be read as
an enum value, rather than a bitfield. I do wonder why
cfg80211_can_use_iftype_chan() gets passed a bitfield though, it might
be smarter to make that get an enum value for added type checking.
Actually I guess the reason is that there's no "no radar checking" value
in the enum then ...

At least for _widths, it's clear that it must be a bitfield since
otherwise more than one width wouldn't be possible.

> -		if (radar_detect && !(c->radar_detect_widths & radar_detect))
> +		if (radar_detect_width && !(c->radar_detect_widths & radar_detect_width))

That also makes it extend far beyond 80 columns.

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/core.h b/net/wireless/core.h
index 0a277c3..38f74fe 100644
--- a/net/wireless/core.h
+++ b/net/wireless/core.h
@@ -379,7 +379,7 @@  int cfg80211_can_use_iftype_chan(struct cfg80211_registered_device *rdev,
 				 enum nl80211_iftype iftype,
 				 struct ieee80211_channel *chan,
 				 enum cfg80211_chan_mode chanmode,
-				 u8 radar_detect);
+				 u8 radar_detect_width);
 
 /**
  * cfg80211_chandef_dfs_usable - checks if chandef is DFS usable
diff --git a/net/wireless/util.c b/net/wireless/util.c
index 935dea9..41013f1 100644
--- a/net/wireless/util.c
+++ b/net/wireless/util.c
@@ -1238,7 +1238,7 @@  int cfg80211_can_use_iftype_chan(struct cfg80211_registered_device *rdev,
 				 enum nl80211_iftype iftype,
 				 struct ieee80211_channel *chan,
 				 enum cfg80211_chan_mode chanmode,
-				 u8 radar_detect)
+				 u8 radar_detect_width)
 {
 	struct wireless_dev *wdev_iter;
 	u32 used_iftypes = BIT(iftype);
@@ -1254,7 +1254,7 @@  int cfg80211_can_use_iftype_chan(struct cfg80211_registered_device *rdev,
 
 	ASSERT_RTNL();
 
-	if (WARN_ON(hweight32(radar_detect) > 1))
+	if (WARN_ON(hweight32(radar_detect_width) > 1))
 		return -EINVAL;
 
 	switch (iftype) {
@@ -1268,7 +1268,7 @@  int cfg80211_can_use_iftype_chan(struct cfg80211_registered_device *rdev,
 		 * then mark DFS as required.
 		 */
 		if (!chan) {
-			if (chanmode != CHAN_MODE_UNDEFINED && radar_detect)
+			if (chanmode != CHAN_MODE_UNDEFINED && radar_detect_width)
 				radar_required = true;
 			break;
 		}
@@ -1285,12 +1285,12 @@  int cfg80211_can_use_iftype_chan(struct cfg80211_registered_device *rdev,
 		return -EINVAL;
 	}
 
-	if (radar_required && !radar_detect)
+	if (radar_required && !radar_detect_width)
 		return -EINVAL;
 
 	/* Always allow software iftypes */
 	if (rdev->wiphy.software_iftypes & BIT(iftype)) {
-		if (radar_detect)
+		if (radar_detect_width)
 			return -EINVAL;
 		return 0;
 	}
@@ -1366,7 +1366,7 @@  int cfg80211_can_use_iftype_chan(struct cfg80211_registered_device *rdev,
 		used_iftypes |= BIT(wdev_iter->iftype);
 	}
 
-	if (total == 1 && !radar_detect)
+	if (total == 1 && !radar_detect_width)
 		return 0;
 
 	for (i = 0; i < rdev->wiphy.n_iface_combinations; i++) {
@@ -1399,7 +1399,7 @@  int cfg80211_can_use_iftype_chan(struct cfg80211_registered_device *rdev,
 			}
 		}
 
-		if (radar_detect && !(c->radar_detect_widths & radar_detect))
+		if (radar_detect_width && !(c->radar_detect_widths & radar_detect_width))
 			goto cont;
 
 		/*