From: David Gibson <david@gibson.dropbear.id.au>

Don't attempt to manually set the channel in infrastructure mode, the firmware
doesn't like that much.  Also don't attempt to override the firmware's default
channel number for IBSS mode (I believe default channel can vary by regulatory
domain).

Signed-off-by: David Gibson <hermes@gibson.dropbear.id.au>
Signed-off-by: Andrew Morton <akpm@osdl.org>
---

 25-akpm/drivers/net/wireless/orinoco.c |   22 ++++++++++------------
 1 files changed, 10 insertions(+), 12 deletions(-)

diff -puN drivers/net/wireless/orinoco.c~orinoco-merge-updates-part-the-fourth-dont-set-channel-in-managed-mode drivers/net/wireless/orinoco.c
--- 25/drivers/net/wireless/orinoco.c~orinoco-merge-updates-part-the-fourth-dont-set-channel-in-managed-mode	Wed Mar 30 15:29:32 2005
+++ 25-akpm/drivers/net/wireless/orinoco.c	Wed Mar 30 15:29:32 2005
@@ -1616,17 +1616,15 @@ static int __orinoco_program_rids(struct
 		return err;
 	}
 	/* Set the channel/frequency */
-	if (priv->channel == 0) {
-		printk(KERN_DEBUG "%s: Channel is 0 in __orinoco_program_rids()\n", dev->name);
-		if (priv->createibss)
-			priv->channel = 10;
-	}
-	err = hermes_write_wordrec(hw, USER_BAP, HERMES_RID_CNFOWNCHANNEL,
-				   priv->channel);
-	if (err) {
-		printk(KERN_ERR "%s: Error %d setting channel\n",
-		       dev->name, err);
-		return err;
+	if (priv->channel != 0 && priv->iw_mode != IW_MODE_INFRA) {
+		err = hermes_write_wordrec(hw, USER_BAP,
+					   HERMES_RID_CNFOWNCHANNEL,
+					   priv->channel);
+		if (err) {
+			printk(KERN_ERR "%s: Error %d setting channel %d\n",
+			       dev->name, err, priv->channel);
+			return err;
+		}
 	}
 
 	if (priv->has_ibss) {
@@ -2406,7 +2404,7 @@ static int orinoco_init(struct net_devic
 	/* By default use IEEE/IBSS ad-hoc mode if we have it */
 	priv->prefer_port3 = priv->has_port3 && (! priv->has_ibss);
 	set_port_type(priv);
-	priv->channel = 10; /* default channel, more-or-less arbitrary */
+	priv->channel = 0; /* use firmware default */
 
 	priv->promiscuous = 0;
 	priv->wep_on = 0;
_