diff options
author | Pavel Roskin <proski@gnu.org> | 2006-04-07 04:10:49 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2006-04-24 16:15:51 -0400 |
commit | 37a6c6117db3f10e1923c14dffa089b10600c4b8 (patch) | |
tree | 88e84f1635b2e24744061fdbac7c1e2b7ead38d9 | |
parent | 2c1bd26035491cd0ba7e49be6ed610fc4912fef9 (diff) |
[PATCH] orinoco: delay FID allocation after firmware initialization
This is needed to identify the card before possible allocation problems,
so that the user at least can report the firmware version that fails.
Signed-off-by: Pavel Roskin <proski@gnu.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r-- | drivers/net/wireless/orinoco.c | 28 |
1 files changed, 22 insertions, 6 deletions
diff --git a/drivers/net/wireless/orinoco.c b/drivers/net/wireless/orinoco.c index 80cf6fba3798..d4c13ff4d8a1 100644 --- a/drivers/net/wireless/orinoco.c +++ b/drivers/net/wireless/orinoco.c | |||
@@ -1345,16 +1345,12 @@ int __orinoco_down(struct net_device *dev) | |||
1345 | return 0; | 1345 | return 0; |
1346 | } | 1346 | } |
1347 | 1347 | ||
1348 | int orinoco_reinit_firmware(struct net_device *dev) | 1348 | static int orinoco_allocate_fid(struct net_device *dev) |
1349 | { | 1349 | { |
1350 | struct orinoco_private *priv = netdev_priv(dev); | 1350 | struct orinoco_private *priv = netdev_priv(dev); |
1351 | struct hermes *hw = &priv->hw; | 1351 | struct hermes *hw = &priv->hw; |
1352 | int err; | 1352 | int err; |
1353 | 1353 | ||
1354 | err = hermes_init(hw); | ||
1355 | if (err) | ||
1356 | return err; | ||
1357 | |||
1358 | err = hermes_allocate(hw, priv->nicbuf_size, &priv->txfid); | 1354 | err = hermes_allocate(hw, priv->nicbuf_size, &priv->txfid); |
1359 | if (err == -EIO && priv->nicbuf_size > TX_NICBUF_SIZE_BUG) { | 1355 | if (err == -EIO && priv->nicbuf_size > TX_NICBUF_SIZE_BUG) { |
1360 | /* Try workaround for old Symbol firmware bug */ | 1356 | /* Try workaround for old Symbol firmware bug */ |
@@ -1373,6 +1369,19 @@ int orinoco_reinit_firmware(struct net_device *dev) | |||
1373 | return err; | 1369 | return err; |
1374 | } | 1370 | } |
1375 | 1371 | ||
1372 | int orinoco_reinit_firmware(struct net_device *dev) | ||
1373 | { | ||
1374 | struct orinoco_private *priv = netdev_priv(dev); | ||
1375 | struct hermes *hw = &priv->hw; | ||
1376 | int err; | ||
1377 | |||
1378 | err = hermes_init(hw); | ||
1379 | if (!err) | ||
1380 | err = orinoco_allocate_fid(dev); | ||
1381 | |||
1382 | return err; | ||
1383 | } | ||
1384 | |||
1376 | static int __orinoco_hw_set_bitrate(struct orinoco_private *priv) | 1385 | static int __orinoco_hw_set_bitrate(struct orinoco_private *priv) |
1377 | { | 1386 | { |
1378 | hermes_t *hw = &priv->hw; | 1387 | hermes_t *hw = &priv->hw; |
@@ -2224,7 +2233,7 @@ static int orinoco_init(struct net_device *dev) | |||
2224 | priv->nicbuf_size = IEEE80211_FRAME_LEN + ETH_HLEN; | 2233 | priv->nicbuf_size = IEEE80211_FRAME_LEN + ETH_HLEN; |
2225 | 2234 | ||
2226 | /* Initialize the firmware */ | 2235 | /* Initialize the firmware */ |
2227 | err = orinoco_reinit_firmware(dev); | 2236 | err = hermes_init(hw); |
2228 | if (err != 0) { | 2237 | if (err != 0) { |
2229 | printk(KERN_ERR "%s: failed to initialize firmware (err = %d)\n", | 2238 | printk(KERN_ERR "%s: failed to initialize firmware (err = %d)\n", |
2230 | dev->name, err); | 2239 | dev->name, err); |
@@ -2282,6 +2291,13 @@ static int orinoco_init(struct net_device *dev) | |||
2282 | 2291 | ||
2283 | printk(KERN_DEBUG "%s: Station name \"%s\"\n", dev->name, priv->nick); | 2292 | printk(KERN_DEBUG "%s: Station name \"%s\"\n", dev->name, priv->nick); |
2284 | 2293 | ||
2294 | err = orinoco_allocate_fid(dev); | ||
2295 | if (err) { | ||
2296 | printk(KERN_ERR "%s: failed to allocate NIC buffer!\n", | ||
2297 | dev->name); | ||
2298 | goto out; | ||
2299 | } | ||
2300 | |||
2285 | /* Get allowed channels */ | 2301 | /* Get allowed channels */ |
2286 | err = hermes_read_wordrec(hw, USER_BAP, HERMES_RID_CHANNELLIST, | 2302 | err = hermes_read_wordrec(hw, USER_BAP, HERMES_RID_CHANNELLIST, |
2287 | &priv->channel_mask); | 2303 | &priv->channel_mask); |