[PATCH] zd1211rw: Remove IW_FREQ_AUTO support

http://bugzilla.kernel.org/show_bug.cgi?id=7399

zd1211rw's support for IW_FREQ_AUTO is broken: when specified, the driver
tries to change to a channel specified in an uninitialized integer. As
IW_FREQ_AUTO is hard to implement properly, the solution (at least for now)
is to drop support for it and start ignoring the flags like all other wireless
drivers do.

This has the added advantage that kismet also starts working with zd1211rw,
even though kismet requesting IW_FREQ_AUTO is also a bug (fixed in their svn)

Signed-off-by: Daniel Drake <dsd@gentoo.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
This commit is contained in:
Daniel Drake 2006-11-22 00:05:30 +00:00 committed by Jeff Garzik
parent 571d6eee9b
commit 84bc715c46
4 changed files with 6 additions and 33 deletions

View File

@ -133,9 +133,6 @@ int zd_find_channel(u8 *channel, const struct iw_freq *freq)
int i, r; int i, r;
u32 mhz; u32 mhz;
if (!(freq->flags & IW_FREQ_FIXED))
return 0;
if (freq->m < 1000) { if (freq->m < 1000) {
if (freq->m > NUM_CHANNELS || freq->m == 0) if (freq->m > NUM_CHANNELS || freq->m == 0)
return -EINVAL; return -EINVAL;

View File

@ -317,21 +317,12 @@ int zd_mac_request_channel(struct zd_mac *mac, u8 channel)
return 0; return 0;
} }
int zd_mac_get_channel(struct zd_mac *mac, u8 *channel, u8 *flags) u8 zd_mac_get_channel(struct zd_mac *mac)
{ {
struct ieee80211_device *ieee = zd_mac_to_ieee80211(mac); u8 channel = zd_chip_get_channel(&mac->chip);
*channel = zd_chip_get_channel(&mac->chip); dev_dbg_f(zd_mac_dev(mac), "channel %u\n", channel);
if (ieee->iw_mode != IW_MODE_INFRA) { return channel;
spin_lock_irq(&mac->lock);
*flags = *channel == mac->requested_channel ?
MAC_FIXED_CHANNEL : 0;
spin_unlock(&mac->lock);
} else {
*flags = 0;
}
dev_dbg_f(zd_mac_dev(mac), "channel %u flags %u\n", *channel, *flags);
return 0;
} }
/* If wrong rate is given, we are falling back to the slowest rate: 1MBit/s */ /* If wrong rate is given, we are falling back to the slowest rate: 1MBit/s */

View File

@ -116,10 +116,6 @@ struct rx_status {
#define ZD_RX_CRC16_ERROR 0x40 #define ZD_RX_CRC16_ERROR 0x40
#define ZD_RX_ERROR 0x80 #define ZD_RX_ERROR 0x80
enum mac_flags {
MAC_FIXED_CHANNEL = 0x01,
};
struct housekeeping { struct housekeeping {
struct work_struct link_led_work; struct work_struct link_led_work;
}; };
@ -180,7 +176,7 @@ int zd_mac_set_regdomain(struct zd_mac *zd_mac, u8 regdomain);
u8 zd_mac_get_regdomain(struct zd_mac *zd_mac); u8 zd_mac_get_regdomain(struct zd_mac *zd_mac);
int zd_mac_request_channel(struct zd_mac *mac, u8 channel); int zd_mac_request_channel(struct zd_mac *mac, u8 channel);
int zd_mac_get_channel(struct zd_mac *mac, u8 *channel, u8 *flags); u8 zd_mac_get_channel(struct zd_mac *mac);
int zd_mac_set_mode(struct zd_mac *mac, u32 mode); int zd_mac_set_mode(struct zd_mac *mac, u32 mode);
int zd_mac_get_mode(struct zd_mac *mac, u32 *mode); int zd_mac_get_mode(struct zd_mac *mac, u32 *mode);

View File

@ -107,21 +107,10 @@ static int iw_get_freq(struct net_device *netdev,
struct iw_request_info *info, struct iw_request_info *info,
union iwreq_data *req, char *extra) union iwreq_data *req, char *extra)
{ {
int r;
struct zd_mac *mac = zd_netdev_mac(netdev); struct zd_mac *mac = zd_netdev_mac(netdev);
struct iw_freq *freq = &req->freq; struct iw_freq *freq = &req->freq;
u8 channel;
u8 flags;
r = zd_mac_get_channel(mac, &channel, &flags); return zd_channel_to_freq(freq, zd_mac_get_channel(mac));
if (r)
return r;
freq->flags = (flags & MAC_FIXED_CHANNEL) ?
IW_FREQ_FIXED : IW_FREQ_AUTO;
dev_dbg_f(zd_mac_dev(mac), "channel %s\n",
(flags & MAC_FIXED_CHANNEL) ? "fixed" : "auto");
return zd_channel_to_freq(freq, channel);
} }
static int iw_set_mode(struct net_device *netdev, static int iw_set_mode(struct net_device *netdev,