All of lore.kernel.org
 help / color / mirror / Atom feed
From: Johannes Berg <johannes@sipsolutions.net>
To: John Linville <linville@tuxdriver.com>
Cc: linux-wireless@vger.kernel.org
Subject: [PATCH 6/8] mac80211: clean up ieee80211_hw_config errors
Date: Tue, 07 Oct 2008 12:04:34 +0200	[thread overview]
Message-ID: <20081007100441.810026000@sipsolutions.net> (raw)
In-Reply-To: 20081007100428.868688000@sipsolutions.net

Warn when ieee80211_hw_config returns an error, it shouldn't
happen; remove a number of printks that would happen in such
a case and one printk that is user-triggerable.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
---
 net/mac80211/cfg.c  |    3 +--
 net/mac80211/main.c |    8 +++++++-
 net/mac80211/scan.c |   16 +++-------------
 net/mac80211/util.c |    5 +----
 net/mac80211/wext.c |    6 +-----
 5 files changed, 13 insertions(+), 25 deletions(-)

--- everything.orig/net/mac80211/cfg.c	2008-10-07 11:27:02.000000000 +0200
+++ everything/net/mac80211/cfg.c	2008-10-07 11:27:02.000000000 +0200
@@ -396,8 +396,7 @@ static int ieee80211_config_beacon(struc
 	 */
 	if (params->interval) {
 		sdata->local->hw.conf.beacon_int = params->interval;
-		if (ieee80211_hw_config(sdata->local))
-			return -EINVAL;
+		ieee80211_hw_config(sdata->local);
 		/*
 		 * We updated some parameter so if below bails out
 		 * it's not an error.
--- everything.orig/net/mac80211/main.c	2008-10-07 11:27:00.000000000 +0200
+++ everything/net/mac80211/main.c	2008-10-07 11:27:02.000000000 +0200
@@ -222,8 +222,14 @@ int ieee80211_hw_config(struct ieee80211
 	       wiphy_name(local->hw.wiphy), chan->center_freq);
 #endif
 
-	if (local->open_count)
+	if (local->open_count) {
 		ret = local->ops->config(local_to_hw(local), &local->hw.conf);
+		/*
+		 * HW reconfiguration should never fail, the driver has told
+		 * us what it can support so it should live up to that promise.
+		 */
+		WARN_ON(ret);
+	}
 
 	return ret;
 }
--- everything.orig/net/mac80211/scan.c	2008-10-07 11:26:50.000000000 +0200
+++ everything/net/mac80211/scan.c	2008-10-07 11:27:02.000000000 +0200
@@ -447,18 +447,12 @@ void ieee80211_scan_completed(struct iee
 
 	if (local->hw_scanning) {
 		local->hw_scanning = false;
-		if (ieee80211_hw_config(local))
-			printk(KERN_DEBUG "%s: failed to restore operational "
-			       "channel after scan\n", wiphy_name(local->hw.wiphy));
-
+		ieee80211_hw_config(local);
 		goto done;
 	}
 
 	local->sw_scanning = false;
-	if (ieee80211_hw_config(local))
-		printk(KERN_DEBUG "%s: failed to restore operational "
-		       "channel after scan\n", wiphy_name(local->hw.wiphy));
-
+	ieee80211_hw_config(local);
 
 	netif_tx_lock_bh(local->mdev);
 	netif_addr_lock(local->mdev);
@@ -545,12 +539,8 @@ void ieee80211_scan_work(struct work_str
 
 		if (!skip) {
 			local->scan_channel = chan;
-			if (ieee80211_hw_config(local)) {
-				printk(KERN_DEBUG "%s: failed to set freq to "
-				       "%d MHz for scan\n", wiphy_name(local->hw.wiphy),
-				       chan->center_freq);
+			if (ieee80211_hw_config(local))
 				skip = 1;
-			}
 		}
 
 		/* advance state machine to next channel/band */
--- everything.orig/net/mac80211/util.c	2008-10-07 11:26:50.000000000 +0200
+++ everything/net/mac80211/util.c	2008-10-07 11:27:02.000000000 +0200
@@ -638,11 +638,8 @@ int ieee80211_set_freq(struct ieee80211_
 
 	if (chan && !(chan->flags & IEEE80211_CHAN_DISABLED)) {
 		if (sdata->vif.type == NL80211_IFTYPE_ADHOC &&
-		    chan->flags & IEEE80211_CHAN_NO_IBSS) {
-			printk(KERN_DEBUG "%s: IBSS not allowed on frequency "
-				"%d MHz\n", sdata->dev->name, chan->center_freq);
+		    chan->flags & IEEE80211_CHAN_NO_IBSS)
 			return ret;
-		}
 		local->oper_channel = chan;
 
 		if (local->sw_scanning || local->hw_scanning)
--- everything.orig/net/mac80211/wext.c	2008-10-07 11:26:50.000000000 +0200
+++ everything/net/mac80211/wext.c	2008-10-07 11:27:02.000000000 +0200
@@ -689,12 +689,8 @@ static int ieee80211_ioctl_siwtxpower(st
 		ieee80211_led_radio(local, local->hw.conf.radio_enabled);
 	}
 
-	if (need_reconfig) {
+	if (need_reconfig)
 		ieee80211_hw_config(local);
-		/* The return value of hw_config is not of big interest here,
-		 * as it doesn't say that it failed because of _this_ config
-		 * change or something else. Ignore it. */
-	}
 
 	return 0;
 }

-- 


  parent reply	other threads:[~2008-10-07 16:58 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-07 10:04 [PATCH 0/8] mac80211 fixes/cleanups/updates Johannes Berg
2008-10-07 10:04 ` [PATCH 1/8] mac80211: fix debugfs lockup Johannes Berg
2008-10-07 10:04 ` [PATCH 2/8] mac80211: remove aggregation status write support from debugfs Johannes Berg
2008-10-07 21:24   ` Tomas Winkler
2008-10-08  7:59     ` Johannes Berg
2008-10-10 18:22       ` Luis R. Rodriguez
2008-10-10 18:37         ` Johannes Berg
2008-10-10 18:39         ` Andrey Yurovsky
2008-10-10 18:42           ` Johannes Berg
2008-10-07 10:04 ` [PATCH 3/8] mac80211: remove writable debugs mesh parameters Johannes Berg
2008-10-07 17:45   ` Javier Cardona
2008-10-07 10:04 ` [PATCH 4/8] mac80211: minor code cleanups Johannes Berg
2008-10-07 10:04 ` [PATCH 5/8] mac80211: remove wiphy_to_hw Johannes Berg
2008-10-07 10:04 ` Johannes Berg [this message]
2008-10-07 10:04 ` [PATCH 7/8] mac80211: remove max_antenna_gain config Johannes Berg
2008-10-07 10:04 ` [PATCH 8/8] mac80211: fix short slot handling Johannes Berg
2008-10-08  8:55   ` [PATCH 8/8 v2] " Johannes Berg
2008-10-08  8:59     ` [PATCH 8/8 v3] " Johannes Berg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20081007100441.810026000@sipsolutions.net \
    --to=johannes@sipsolutions.net \
    --cc=linux-wireless@vger.kernel.org \
    --cc=linville@tuxdriver.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.