aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/orinoco/wext.c
diff options
context:
space:
mode:
authorDavid Kilroy <kilroyd@googlemail.com>2009-06-18 18:21:32 -0400
committerJohn W. Linville <linville@tuxdriver.com>2009-07-10 15:01:46 -0400
commit5217c571c898371c540e49671600d54346b2e123 (patch)
tree6a43660fb5669c02a0ba11f7a53404790638c7a3 /drivers/net/wireless/orinoco/wext.c
parent721aa2f75b00399074eb443fdf16d797b4504a36 (diff)
orinoco: convert mode setting to cfg80211
Signed-off-by: David Kilroy <kilroyd@googlemail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/orinoco/wext.c')
-rw-r--r--drivers/net/wireless/orinoco/wext.c75
1 files changed, 8 insertions, 67 deletions
diff --git a/drivers/net/wireless/orinoco/wext.c b/drivers/net/wireless/orinoco/wext.c
index 4c20b1d5c2a2..9cd991a41ad4 100644
--- a/drivers/net/wireless/orinoco/wext.c
+++ b/drivers/net/wireless/orinoco/wext.c
@@ -52,7 +52,7 @@ static struct iw_statistics *orinoco_get_wireless_stats(struct net_device *dev)
52 * here so we're not safe to sleep here. */ 52 * here so we're not safe to sleep here. */
53 hermes_inquire(hw, HERMES_INQ_TALLIES); 53 hermes_inquire(hw, HERMES_INQ_TALLIES);
54 54
55 if (priv->iw_mode == IW_MODE_ADHOC) { 55 if (priv->iw_mode == NL80211_IFTYPE_ADHOC) {
56 memset(&wstats->qual, 0, sizeof(wstats->qual)); 56 memset(&wstats->qual, 0, sizeof(wstats->qual));
57 /* If a spy address is defined, we report stats of the 57 /* If a spy address is defined, we report stats of the
58 * first spy address - Jean II */ 58 * first spy address - Jean II */
@@ -124,7 +124,7 @@ static int orinoco_ioctl_setwap(struct net_device *dev,
124 goto out; 124 goto out;
125 } 125 }
126 126
127 if (priv->iw_mode != IW_MODE_INFRA) { 127 if (priv->iw_mode != NL80211_IFTYPE_STATION) {
128 printk(KERN_WARNING "%s: Manual roaming supported only in " 128 printk(KERN_WARNING "%s: Manual roaming supported only in "
129 "managed mode\n", dev->name); 129 "managed mode\n", dev->name);
130 err = -EOPNOTSUPP; 130 err = -EOPNOTSUPP;
@@ -172,65 +172,6 @@ static int orinoco_ioctl_getwap(struct net_device *dev,
172 return err; 172 return err;
173} 173}
174 174
175static int orinoco_ioctl_setmode(struct net_device *dev,
176 struct iw_request_info *info,
177 u32 *mode,
178 char *extra)
179{
180 struct orinoco_private *priv = ndev_priv(dev);
181 int err = -EINPROGRESS; /* Call commit handler */
182 unsigned long flags;
183
184 if (priv->iw_mode == *mode)
185 return 0;
186
187 if (orinoco_lock(priv, &flags) != 0)
188 return -EBUSY;
189
190 switch (*mode) {
191 case IW_MODE_ADHOC:
192 if (!priv->has_ibss && !priv->has_port3)
193 err = -EOPNOTSUPP;
194 break;
195
196 case IW_MODE_INFRA:
197 break;
198
199 case IW_MODE_MONITOR:
200 if (priv->broken_monitor && !force_monitor) {
201 printk(KERN_WARNING "%s: Monitor mode support is "
202 "buggy in this firmware, not enabling\n",
203 dev->name);
204 err = -EOPNOTSUPP;
205 }
206 break;
207
208 default:
209 err = -EOPNOTSUPP;
210 break;
211 }
212
213 if (err == -EINPROGRESS) {
214 priv->iw_mode = *mode;
215 set_port_type(priv);
216 }
217
218 orinoco_unlock(priv, &flags);
219
220 return err;
221}
222
223static int orinoco_ioctl_getmode(struct net_device *dev,
224 struct iw_request_info *info,
225 u32 *mode,
226 char *extra)
227{
228 struct orinoco_private *priv = ndev_priv(dev);
229
230 *mode = priv->iw_mode;
231 return 0;
232}
233
234static int orinoco_ioctl_getiwrange(struct net_device *dev, 175static int orinoco_ioctl_getiwrange(struct net_device *dev,
235 struct iw_request_info *info, 176 struct iw_request_info *info,
236 struct iw_point *rrq, 177 struct iw_point *rrq,
@@ -280,7 +221,7 @@ static int orinoco_ioctl_getiwrange(struct net_device *dev,
280 if (priv->has_wpa) 221 if (priv->has_wpa)
281 range->enc_capa = IW_ENC_CAPA_WPA | IW_ENC_CAPA_CIPHER_TKIP; 222 range->enc_capa = IW_ENC_CAPA_WPA | IW_ENC_CAPA_CIPHER_TKIP;
282 223
283 if ((priv->iw_mode == IW_MODE_ADHOC) && (!SPY_NUMBER(priv))) { 224 if ((priv->iw_mode == NL80211_IFTYPE_ADHOC) && (!SPY_NUMBER(priv))) {
284 /* Quality stats meaningless in ad-hoc mode */ 225 /* Quality stats meaningless in ad-hoc mode */
285 } else { 226 } else {
286 range->max_qual.qual = 0x8b - 0x2f; 227 range->max_qual.qual = 0x8b - 0x2f;
@@ -596,7 +537,7 @@ static int orinoco_ioctl_setfreq(struct net_device *dev,
596 int err = -EINPROGRESS; /* Call commit handler */ 537 int err = -EINPROGRESS; /* Call commit handler */
597 538
598 /* In infrastructure mode the AP sets the channel */ 539 /* In infrastructure mode the AP sets the channel */
599 if (priv->iw_mode == IW_MODE_INFRA) 540 if (priv->iw_mode == NL80211_IFTYPE_STATION)
600 return -EBUSY; 541 return -EBUSY;
601 542
602 if ((frq->e == 0) && (frq->m <= 1000)) { 543 if ((frq->e == 0) && (frq->m <= 1000)) {
@@ -622,7 +563,7 @@ static int orinoco_ioctl_setfreq(struct net_device *dev,
622 return -EBUSY; 563 return -EBUSY;
623 564
624 priv->channel = chan; 565 priv->channel = chan;
625 if (priv->iw_mode == IW_MODE_MONITOR) { 566 if (priv->iw_mode == NL80211_IFTYPE_MONITOR) {
626 /* Fast channel change - no commit if successful */ 567 /* Fast channel change - no commit if successful */
627 hermes_t *hw = &priv->hw; 568 hermes_t *hw = &priv->hw;
628 err = hermes_docmd_wait(hw, HERMES_CMD_TEST | 569 err = hermes_docmd_wait(hw, HERMES_CMD_TEST |
@@ -1673,7 +1614,7 @@ static int orinoco_ioctl_setscan(struct net_device *dev,
1673 /* In monitor mode, the scan results are always empty. 1614 /* In monitor mode, the scan results are always empty.
1674 * Probe responses are passed to the driver as received 1615 * Probe responses are passed to the driver as received
1675 * frames and could be processed in software. */ 1616 * frames and could be processed in software. */
1676 if (priv->iw_mode == IW_MODE_MONITOR) { 1617 if (priv->iw_mode == NL80211_IFTYPE_MONITOR) {
1677 err = -EOPNOTSUPP; 1618 err = -EOPNOTSUPP;
1678 goto out; 1619 goto out;
1679 } 1620 }
@@ -2209,8 +2150,8 @@ static const iw_handler orinoco_handler[] = {
2209 STD_IW_HANDLER(SIOCGIWNAME, cfg80211_wext_giwname), 2150 STD_IW_HANDLER(SIOCGIWNAME, cfg80211_wext_giwname),
2210 STD_IW_HANDLER(SIOCSIWFREQ, orinoco_ioctl_setfreq), 2151 STD_IW_HANDLER(SIOCSIWFREQ, orinoco_ioctl_setfreq),
2211 STD_IW_HANDLER(SIOCGIWFREQ, orinoco_ioctl_getfreq), 2152 STD_IW_HANDLER(SIOCGIWFREQ, orinoco_ioctl_getfreq),
2212 STD_IW_HANDLER(SIOCSIWMODE, orinoco_ioctl_setmode), 2153 STD_IW_HANDLER(SIOCSIWMODE, cfg80211_wext_siwmode),
2213 STD_IW_HANDLER(SIOCGIWMODE, orinoco_ioctl_getmode), 2154 STD_IW_HANDLER(SIOCGIWMODE, cfg80211_wext_giwmode),
2214 STD_IW_HANDLER(SIOCSIWSENS, orinoco_ioctl_setsens), 2155 STD_IW_HANDLER(SIOCSIWSENS, orinoco_ioctl_setsens),
2215 STD_IW_HANDLER(SIOCGIWSENS, orinoco_ioctl_getsens), 2156 STD_IW_HANDLER(SIOCGIWSENS, orinoco_ioctl_getsens),
2216 STD_IW_HANDLER(SIOCGIWRANGE, orinoco_ioctl_getiwrange), 2157 STD_IW_HANDLER(SIOCGIWRANGE, orinoco_ioctl_getiwrange),