Search Linux Wireless

[PATCH 20/28] rt2x00: Move channel time detection to rt2x00lib

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Use the rt2x00lib provided function for detecting channel time.

Signed-off-by: Ivo van Doorn <IvDoorn@xxxxxxxxx>

---

diff --git a/drivers/net/wireless/mac80211/rt2x00/rt2400pci.c b/drivers/net/wireless/mac80211/rt2x00/rt2400pci.c
index f7347e3..fa1437c 100644
--- a/drivers/net/wireless/mac80211/rt2x00/rt2400pci.c
+++ b/drivers/net/wireless/mac80211/rt2x00/rt2400pci.c
@@ -1184,46 +1184,6 @@ continue_csr_init:
 	return 0;
 }
 
-static int rt2400pci_init_channel_time(struct rt2x00_dev *rt2x00dev)
-{
-	unsigned long jiffies_start;
-	unsigned long jiffies_end;
-
-	/*
-	 * Only initialize the channel_change_time
-	 * if it has not been set previously.
-	 */
-	if (rt2x00dev->hw->channel_change_time)
-		return 0;
-
-	/*
-	 * Invalidate the rx_status.channel value to make sure
-	 * the config channel will be correctly executed.
-	 */
-	rt2x00dev->rx_status.channel = 0;
-
-	/*
-	 * Determine channel_change_time
-	 * by measuring the time it takes
-	 * to switch the channel.
-	 */
-	jiffies_start = jiffies;
-	rt2400pci_config_channel(rt2x00dev,
-		rt2x00dev->hwmodes[0].channels[0].val,
-		rt2x00dev->hwmodes[0].channels[0].chan,
-		rt2x00dev->hwmodes[0].channels[0].freq,
-		0);
-	jiffies_end = jiffies;
-
-	rt2x00dev->hw->channel_change_time =
-		jiffies_to_usecs((long)jiffies_end - (long)jiffies_start);
-
-	NOTICE("Channel change time has been set to %d.\n",
-		rt2x00dev->hw->channel_change_time);
-
-	return 0;
-}
-
 /*
  * Device initialization functions.
  */
@@ -1333,7 +1293,7 @@ static int rt2400pci_enable_radio(struct rt2x00_dev *rt2x00dev)
 	/*
 	 * Determine channel change time.
 	 */
-	if (rt2400pci_init_channel_time(rt2x00dev))
+	if (rt2x00lib_detect_channel_time(rt2x00dev))
 		goto exit_fail;
 
 	/*
diff --git a/drivers/net/wireless/mac80211/rt2x00/rt2500pci.c b/drivers/net/wireless/mac80211/rt2x00/rt2500pci.c
index 40c3fb2..8ad17ba 100644
--- a/drivers/net/wireless/mac80211/rt2x00/rt2500pci.c
+++ b/drivers/net/wireless/mac80211/rt2x00/rt2500pci.c
@@ -1307,46 +1307,6 @@ continue_csr_init:
 	return 0;
 }
 
-static int rt2500pci_init_channel_time(struct rt2x00_dev *rt2x00dev)
-{
-	unsigned long jiffies_start;
-	unsigned long jiffies_end;
-
-	/*
-	 * Only initialize the channel_change_time
-	 * if it has not been set previously.
-	 */
-	if (rt2x00dev->hw->channel_change_time)
-		return 0;
-
-	/*
-	 * Invalidate the rx_status.channel value to make sure
-	 * the config channel will be correctly executed.
-	 */
-	rt2x00dev->rx_status.channel = 0;
-
-	/*
-	 * Determine channel_change_time
-	 * by measuring the time it takes
-	 * to switch the channel.
-	 */
-	jiffies_start = jiffies;
-	rt2500pci_config_channel(rt2x00dev,
-		rt2x00dev->hwmodes[0].channels[0].val,
-		rt2x00dev->hwmodes[0].channels[0].chan,
-		rt2x00dev->hwmodes[0].channels[0].freq,
-		rt2x00dev->hwmodes[0].channels[0].power_level);
-	jiffies_end = jiffies;
-
-	rt2x00dev->hw->channel_change_time =
-		jiffies_to_usecs((long)jiffies_end - (long)jiffies_start);
-
-	NOTICE("Channel change time has been set to %d.\n",
-		rt2x00dev->hw->channel_change_time);
-
-	return 0;
-}
-
 /*
  * Device initialization functions.
  */
@@ -1456,7 +1416,7 @@ static int rt2500pci_enable_radio(struct rt2x00_dev *rt2x00dev)
 	/*
 	 * Determine channel change time.
 	 */
-	if (rt2500pci_init_channel_time(rt2x00dev))
+	if (rt2x00lib_detect_channel_time(rt2x00dev))
 		goto exit_fail;
 
 	/*
diff --git a/drivers/net/wireless/mac80211/rt2x00/rt2500usb.c b/drivers/net/wireless/mac80211/rt2x00/rt2500usb.c
index d593d18..4244e9d 100644
--- a/drivers/net/wireless/mac80211/rt2x00/rt2500usb.c
+++ b/drivers/net/wireless/mac80211/rt2x00/rt2500usb.c
@@ -1213,46 +1213,6 @@ continue_csr_init:
 	return 0;
 }
 
-static int rt2500usb_init_channel_time(struct rt2x00_dev *rt2x00dev)
-{
-	unsigned long jiffies_start;
-	unsigned long jiffies_end;
-
-	/*
-	 * Only initialize the channel_change_time
-	 * if it has not been set previously.
-	 */
-	if (rt2x00dev->hw->channel_change_time)
-		return 0;
-
-	/*
-	 * Invalidate the rx_status.channel value to make sure
-	 * the config channel will be correctly executed.
-	 */
-	rt2x00dev->rx_status.channel = 0;
-
-	/*
-	 * Determine channel_change_time
-	 * by measuring the time it takes
-	 * to switch the channel.
-	 */
-	jiffies_start = jiffies;
-	rt2500usb_config_channel(rt2x00dev,
-		rt2x00dev->hwmodes[0].channels[0].val,
-		rt2x00dev->hwmodes[0].channels[0].chan,
-		rt2x00dev->hwmodes[0].channels[0].freq,
-		rt2x00dev->hwmodes[0].channels[0].power_level);
-	jiffies_end = jiffies;
-
-	rt2x00dev->hw->channel_change_time =
-		jiffies_to_usecs((long)jiffies_end - (long)jiffies_start);
-
-	NOTICE("Channel change time has been set to %d.\n",
-		rt2x00dev->hw->channel_change_time);
-
-	return 0;
-}
-
 /*
  * Device initialization functions.
  */
@@ -1354,7 +1314,7 @@ static int rt2500usb_enable_radio(struct rt2x00_dev *rt2x00dev)
 	/*
 	 * Determine channel change time.
 	 */
-	if (rt2500usb_init_channel_time(rt2x00dev))
+	if (rt2x00lib_detect_channel_time(rt2x00dev))
 		goto exit_fail;
 
 	SET_FLAG(rt2x00dev, DEVICE_ENABLED_RADIO);
diff --git a/drivers/net/wireless/mac80211/rt2x00/rt61pci.c b/drivers/net/wireless/mac80211/rt2x00/rt61pci.c
index 1cd68d0..53dedcb 100644
--- a/drivers/net/wireless/mac80211/rt2x00/rt61pci.c
+++ b/drivers/net/wireless/mac80211/rt2x00/rt61pci.c
@@ -1589,46 +1589,6 @@ continue_csr_init:
 	return 0;
 }
 
-static int rt61pci_init_channel_time(struct rt2x00_dev *rt2x00dev)
-{
-	unsigned long jiffies_start;
-	unsigned long jiffies_end;
-
-	/*
-	 * Only initialize the channel_change_time
-	 * if it has not been set previously.
-	 */
-	if (rt2x00dev->hw->channel_change_time)
-		return 0;
-
-	/*
-	 * Invalidate the rx_status.channel value to make sure
-	 * the config channel will be correctly executed.
-	 */
-	rt2x00dev->rx_status.channel = 0;
-
-	/*
-	 * Determine channel_change_time
-	 * by measuring the time it takes
-	 * to switch the channel.
-	 */
-	jiffies_start = jiffies;
-	rt61pci_config_channel(rt2x00dev,
-		rt2x00dev->hwmodes[0].channels[0].val,
-		rt2x00dev->hwmodes[0].channels[0].chan,
-		rt2x00dev->hwmodes[0].channels[0].freq,
-		rt2x00dev->hwmodes[0].channels[0].power_level);
-	jiffies_end = jiffies;
-
-	rt2x00dev->hw->channel_change_time =
-		jiffies_to_usecs((long)jiffies_end - (long)jiffies_start);
-
-	NOTICE("Channel change time has been set to %d.\n",
-		rt2x00dev->hw->channel_change_time);
-
-	return 0;
-}
-
 /*
  * Device initialization functions.
  */
@@ -1745,7 +1705,7 @@ static int rt61pci_enable_radio(struct rt2x00_dev *rt2x00dev)
 	/*
 	 * Determine channel change time.
 	 */
-	if (rt61pci_init_channel_time(rt2x00dev))
+	if (rt2x00lib_detect_channel_time(rt2x00dev))
 		goto exit_fail;
 
 	/*
diff --git a/drivers/net/wireless/mac80211/rt2x00/rt73usb.c b/drivers/net/wireless/mac80211/rt2x00/rt73usb.c
index 2418466..e628d43 100644
--- a/drivers/net/wireless/mac80211/rt2x00/rt73usb.c
+++ b/drivers/net/wireless/mac80211/rt2x00/rt73usb.c
@@ -1370,46 +1370,6 @@ continue_csr_init:
 	return 0;
 }
 
-static int rt73usb_init_channel_time(struct rt2x00_dev *rt2x00dev)
-{
-	unsigned long jiffies_start;
-	unsigned long jiffies_end;
-
-	/*
-	 * Only initialize the channel_change_time
-	 * if it has not been set previously.
-	 */
-	if (rt2x00dev->hw->channel_change_time)
-		return 0;
-
-	/*
-	 * Invalidate the rx_status.channel value to make sure
-	 * the config channel will be correctly executed.
-	 */
-	rt2x00dev->rx_status.channel = 0;
-
-	/*
-	 * Determine channel_change_time
-	 * by measuring the time it takes
-	 * to switch the channel.
-	 */
-	jiffies_start = jiffies;
-	rt73usb_config_channel(rt2x00dev,
-		rt2x00dev->hwmodes[0].channels[0].val,
-		rt2x00dev->hwmodes[0].channels[0].chan,
-		rt2x00dev->hwmodes[0].channels[0].freq,
-		rt2x00dev->hwmodes[0].channels[0].power_level);
-	jiffies_end = jiffies;
-
-	rt2x00dev->hw->channel_change_time =
-		jiffies_to_usecs((long)jiffies_end - (long)jiffies_start);
-
-	NOTICE("Channel change time has been set to %d.\n",
-		rt2x00dev->hw->channel_change_time);
-
-	return 0;
-}
-
 /*
  * Device initialization functions.
  */
@@ -1518,7 +1478,7 @@ static int rt73usb_enable_radio(struct rt2x00_dev *rt2x00dev)
 	/*
 	 * Determine channel change time.
 	 */
-	if (rt73usb_init_channel_time(rt2x00dev))
+	if (rt2x00lib_detect_channel_time(rt2x00dev))
 		goto exit_fail;
 
 	SET_FLAG(rt2x00dev, DEVICE_ENABLED_RADIO);
-
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]
  Powered by Linux