diff options
author | David Kilroy <kilroyd@googlemail.com> | 2009-06-18 18:21:21 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-07-10 15:01:43 -0400 |
commit | a3f47b9c2ada45ffacc8f2b54507221a1ba8eb10 (patch) | |
tree | 1f87a4c9647373e06b17bd0d1f21a8fd8a025aa1 /drivers/net/wireless/orinoco/hw.c | |
parent | 42a51b933034bbed93fa54009c96a482044e5b43 (diff) |
orinoco: use dev_err in early initialisation routines
This allows us to use determine_fw_capabilities,
orinoco_hw_read_card_setting and orinoco_hw_allocate_fid prior to
netdev registration.
Since dev_dbg only prints if DEBUG is defined (or dynamic debug is
enabled), move a couple of the more useful prints up to info.
Signed-off-by: David Kilroy <kilroyd@googlemail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/orinoco/hw.c')
-rw-r--r-- | drivers/net/wireless/orinoco/hw.c | 92 |
1 files changed, 42 insertions, 50 deletions
diff --git a/drivers/net/wireless/orinoco/hw.c b/drivers/net/wireless/orinoco/hw.c index 0f6426d54f28..4a26d68083f3 100644 --- a/drivers/net/wireless/orinoco/hw.c +++ b/drivers/net/wireless/orinoco/hw.c | |||
@@ -3,6 +3,7 @@ | |||
3 | * See copyright notice in main.c | 3 | * See copyright notice in main.c |
4 | */ | 4 | */ |
5 | #include <linux/kernel.h> | 5 | #include <linux/kernel.h> |
6 | #include <linux/device.h> | ||
6 | #include <linux/if_arp.h> | 7 | #include <linux/if_arp.h> |
7 | #include <linux/ieee80211.h> | 8 | #include <linux/ieee80211.h> |
8 | #include <linux/wireless.h> | 9 | #include <linux/wireless.h> |
@@ -56,10 +57,13 @@ static inline fwtype_t determine_firmware_type(struct comp_id *nic_id) | |||
56 | return FIRMWARE_TYPE_INTERSIL; | 57 | return FIRMWARE_TYPE_INTERSIL; |
57 | } | 58 | } |
58 | 59 | ||
59 | /* Set priv->firmware type, determine firmware properties */ | 60 | /* Set priv->firmware type, determine firmware properties |
61 | * This function can be called before we have registerred with netdev, | ||
62 | * so all errors go out with dev_* rather than printk | ||
63 | */ | ||
60 | int determine_fw_capabilities(struct orinoco_private *priv) | 64 | int determine_fw_capabilities(struct orinoco_private *priv) |
61 | { | 65 | { |
62 | struct net_device *dev = priv->ndev; | 66 | struct device *dev = priv->dev; |
63 | hermes_t *hw = &priv->hw; | 67 | hermes_t *hw = &priv->hw; |
64 | int err; | 68 | int err; |
65 | struct comp_id nic_id, sta_id; | 69 | struct comp_id nic_id, sta_id; |
@@ -69,8 +73,8 @@ int determine_fw_capabilities(struct orinoco_private *priv) | |||
69 | /* Get the hardware version */ | 73 | /* Get the hardware version */ |
70 | err = HERMES_READ_RECORD(hw, USER_BAP, HERMES_RID_NICID, &nic_id); | 74 | err = HERMES_READ_RECORD(hw, USER_BAP, HERMES_RID_NICID, &nic_id); |
71 | if (err) { | 75 | if (err) { |
72 | printk(KERN_ERR "%s: Cannot read hardware identity: error %d\n", | 76 | dev_err(dev, "Cannot read hardware identity: error %d\n", |
73 | dev->name, err); | 77 | err); |
74 | return err; | 78 | return err; |
75 | } | 79 | } |
76 | 80 | ||
@@ -78,17 +82,16 @@ int determine_fw_capabilities(struct orinoco_private *priv) | |||
78 | le16_to_cpus(&nic_id.variant); | 82 | le16_to_cpus(&nic_id.variant); |
79 | le16_to_cpus(&nic_id.major); | 83 | le16_to_cpus(&nic_id.major); |
80 | le16_to_cpus(&nic_id.minor); | 84 | le16_to_cpus(&nic_id.minor); |
81 | printk(KERN_DEBUG "%s: Hardware identity %04x:%04x:%04x:%04x\n", | 85 | dev_info(dev, "Hardware identity %04x:%04x:%04x:%04x\n", |
82 | dev->name, nic_id.id, nic_id.variant, | 86 | nic_id.id, nic_id.variant, nic_id.major, nic_id.minor); |
83 | nic_id.major, nic_id.minor); | ||
84 | 87 | ||
85 | priv->firmware_type = determine_firmware_type(&nic_id); | 88 | priv->firmware_type = determine_firmware_type(&nic_id); |
86 | 89 | ||
87 | /* Get the firmware version */ | 90 | /* Get the firmware version */ |
88 | err = HERMES_READ_RECORD(hw, USER_BAP, HERMES_RID_STAID, &sta_id); | 91 | err = HERMES_READ_RECORD(hw, USER_BAP, HERMES_RID_STAID, &sta_id); |
89 | if (err) { | 92 | if (err) { |
90 | printk(KERN_ERR "%s: Cannot read station identity: error %d\n", | 93 | dev_err(dev, "Cannot read station identity: error %d\n", |
91 | dev->name, err); | 94 | err); |
92 | return err; | 95 | return err; |
93 | } | 96 | } |
94 | 97 | ||
@@ -96,25 +99,21 @@ int determine_fw_capabilities(struct orinoco_private *priv) | |||
96 | le16_to_cpus(&sta_id.variant); | 99 | le16_to_cpus(&sta_id.variant); |
97 | le16_to_cpus(&sta_id.major); | 100 | le16_to_cpus(&sta_id.major); |
98 | le16_to_cpus(&sta_id.minor); | 101 | le16_to_cpus(&sta_id.minor); |
99 | printk(KERN_DEBUG "%s: Station identity %04x:%04x:%04x:%04x\n", | 102 | dev_info(dev, "Station identity %04x:%04x:%04x:%04x\n", |
100 | dev->name, sta_id.id, sta_id.variant, | 103 | sta_id.id, sta_id.variant, sta_id.major, sta_id.minor); |
101 | sta_id.major, sta_id.minor); | ||
102 | 104 | ||
103 | switch (sta_id.id) { | 105 | switch (sta_id.id) { |
104 | case 0x15: | 106 | case 0x15: |
105 | printk(KERN_ERR "%s: Primary firmware is active\n", | 107 | dev_err(dev, "Primary firmware is active\n"); |
106 | dev->name); | ||
107 | return -ENODEV; | 108 | return -ENODEV; |
108 | case 0x14b: | 109 | case 0x14b: |
109 | printk(KERN_ERR "%s: Tertiary firmware is active\n", | 110 | dev_err(dev, "Tertiary firmware is active\n"); |
110 | dev->name); | ||
111 | return -ENODEV; | 111 | return -ENODEV; |
112 | case 0x1f: /* Intersil, Agere, Symbol Spectrum24 */ | 112 | case 0x1f: /* Intersil, Agere, Symbol Spectrum24 */ |
113 | case 0x21: /* Symbol Spectrum24 Trilogy */ | 113 | case 0x21: /* Symbol Spectrum24 Trilogy */ |
114 | break; | 114 | break; |
115 | default: | 115 | default: |
116 | printk(KERN_NOTICE "%s: Unknown station ID, please report\n", | 116 | dev_notice(dev, "Unknown station ID, please report\n"); |
117 | dev->name); | ||
118 | break; | 117 | break; |
119 | } | 118 | } |
120 | 119 | ||
@@ -168,10 +167,8 @@ int determine_fw_capabilities(struct orinoco_private *priv) | |||
168 | HERMES_RID_SECONDARYVERSION_SYMBOL, | 167 | HERMES_RID_SECONDARYVERSION_SYMBOL, |
169 | SYMBOL_MAX_VER_LEN, NULL, &tmp); | 168 | SYMBOL_MAX_VER_LEN, NULL, &tmp); |
170 | if (err) { | 169 | if (err) { |
171 | printk(KERN_WARNING | 170 | dev_warn(dev, "Error %d reading Symbol firmware info. " |
172 | "%s: Error %d reading Symbol firmware info. " | 171 | "Wildly guessing capabilities...\n", err); |
173 | "Wildly guessing capabilities...\n", | ||
174 | dev->name, err); | ||
175 | firmver = 0; | 172 | firmver = 0; |
176 | tmp[0] = '\0'; | 173 | tmp[0] = '\0'; |
177 | } else { | 174 | } else { |
@@ -242,24 +239,24 @@ int determine_fw_capabilities(struct orinoco_private *priv) | |||
242 | if (firmver >= 0x000800) | 239 | if (firmver >= 0x000800) |
243 | priv->ibss_port = 0; | 240 | priv->ibss_port = 0; |
244 | else { | 241 | else { |
245 | printk(KERN_NOTICE "%s: Intersil firmware earlier " | 242 | dev_notice(dev, "Intersil firmware earlier than v0.8.x" |
246 | "than v0.8.x - several features not supported\n", | 243 | " - several features not supported\n"); |
247 | dev->name); | ||
248 | priv->ibss_port = 1; | 244 | priv->ibss_port = 1; |
249 | } | 245 | } |
250 | break; | 246 | break; |
251 | } | 247 | } |
252 | printk(KERN_DEBUG "%s: Firmware determined as %s\n", dev->name, | 248 | dev_info(dev, "Firmware determined as %s\n", priv->fw_name); |
253 | priv->fw_name); | ||
254 | 249 | ||
255 | return 0; | 250 | return 0; |
256 | } | 251 | } |
257 | 252 | ||
258 | /* Read settings from EEPROM into our private structure. | 253 | /* Read settings from EEPROM into our private structure. |
259 | * MAC address gets dropped into callers buffer */ | 254 | * MAC address gets dropped into callers buffer |
255 | * Can be called before netdev registration. | ||
256 | */ | ||
260 | int orinoco_hw_read_card_settings(struct orinoco_private *priv, u8 *dev_addr) | 257 | int orinoco_hw_read_card_settings(struct orinoco_private *priv, u8 *dev_addr) |
261 | { | 258 | { |
262 | struct net_device *dev = priv->ndev; | 259 | struct device *dev = priv->dev; |
263 | struct hermes_idstring nickbuf; | 260 | struct hermes_idstring nickbuf; |
264 | hermes_t *hw = &priv->hw; | 261 | hermes_t *hw = &priv->hw; |
265 | int len; | 262 | int len; |
@@ -270,20 +267,17 @@ int orinoco_hw_read_card_settings(struct orinoco_private *priv, u8 *dev_addr) | |||
270 | err = hermes_read_ltv(hw, USER_BAP, HERMES_RID_CNFOWNMACADDR, | 267 | err = hermes_read_ltv(hw, USER_BAP, HERMES_RID_CNFOWNMACADDR, |
271 | ETH_ALEN, NULL, dev_addr); | 268 | ETH_ALEN, NULL, dev_addr); |
272 | if (err) { | 269 | if (err) { |
273 | printk(KERN_WARNING "%s: failed to read MAC address!\n", | 270 | dev_warn(dev, "Failed to read MAC address!\n"); |
274 | dev->name); | ||
275 | goto out; | 271 | goto out; |
276 | } | 272 | } |
277 | 273 | ||
278 | printk(KERN_DEBUG "%s: MAC address %pM\n", | 274 | dev_dbg(dev, "MAC address %pM\n", dev_addr); |
279 | dev->name, dev_addr); | ||
280 | 275 | ||
281 | /* Get the station name */ | 276 | /* Get the station name */ |
282 | err = hermes_read_ltv(hw, USER_BAP, HERMES_RID_CNFOWNNAME, | 277 | err = hermes_read_ltv(hw, USER_BAP, HERMES_RID_CNFOWNNAME, |
283 | sizeof(nickbuf), &reclen, &nickbuf); | 278 | sizeof(nickbuf), &reclen, &nickbuf); |
284 | if (err) { | 279 | if (err) { |
285 | printk(KERN_ERR "%s: failed to read station name\n", | 280 | dev_err(dev, "failed to read station name\n"); |
286 | dev->name); | ||
287 | goto out; | 281 | goto out; |
288 | } | 282 | } |
289 | if (nickbuf.len) | 283 | if (nickbuf.len) |
@@ -293,14 +287,13 @@ int orinoco_hw_read_card_settings(struct orinoco_private *priv, u8 *dev_addr) | |||
293 | memcpy(priv->nick, &nickbuf.val, len); | 287 | memcpy(priv->nick, &nickbuf.val, len); |
294 | priv->nick[len] = '\0'; | 288 | priv->nick[len] = '\0'; |
295 | 289 | ||
296 | printk(KERN_DEBUG "%s: Station name \"%s\"\n", dev->name, priv->nick); | 290 | dev_dbg(dev, "Station name \"%s\"\n", priv->nick); |
297 | 291 | ||
298 | /* Get allowed channels */ | 292 | /* Get allowed channels */ |
299 | err = hermes_read_wordrec(hw, USER_BAP, HERMES_RID_CHANNELLIST, | 293 | err = hermes_read_wordrec(hw, USER_BAP, HERMES_RID_CHANNELLIST, |
300 | &priv->channel_mask); | 294 | &priv->channel_mask); |
301 | if (err) { | 295 | if (err) { |
302 | printk(KERN_ERR "%s: failed to read channel list!\n", | 296 | dev_err(dev, "Failed to read channel list!\n"); |
303 | dev->name); | ||
304 | goto out; | 297 | goto out; |
305 | } | 298 | } |
306 | 299 | ||
@@ -314,8 +307,7 @@ int orinoco_hw_read_card_settings(struct orinoco_private *priv, u8 *dev_addr) | |||
314 | err = hermes_read_wordrec(hw, USER_BAP, HERMES_RID_CNFRTSTHRESHOLD, | 307 | err = hermes_read_wordrec(hw, USER_BAP, HERMES_RID_CNFRTSTHRESHOLD, |
315 | &priv->rts_thresh); | 308 | &priv->rts_thresh); |
316 | if (err) { | 309 | if (err) { |
317 | printk(KERN_ERR "%s: failed to read RTS threshold!\n", | 310 | dev_err(dev, "Failed to read RTS threshold!\n"); |
318 | dev->name); | ||
319 | goto out; | 311 | goto out; |
320 | } | 312 | } |
321 | 313 | ||
@@ -329,8 +321,7 @@ int orinoco_hw_read_card_settings(struct orinoco_private *priv, u8 *dev_addr) | |||
329 | HERMES_RID_CNFFRAGMENTATIONTHRESHOLD, | 321 | HERMES_RID_CNFFRAGMENTATIONTHRESHOLD, |
330 | &priv->frag_thresh); | 322 | &priv->frag_thresh); |
331 | if (err) { | 323 | if (err) { |
332 | printk(KERN_ERR "%s: failed to read fragmentation settings!\n", | 324 | dev_err(dev, "Failed to read fragmentation settings!\n"); |
333 | dev->name); | ||
334 | goto out; | 325 | goto out; |
335 | } | 326 | } |
336 | 327 | ||
@@ -342,16 +333,16 @@ int orinoco_hw_read_card_settings(struct orinoco_private *priv, u8 *dev_addr) | |||
342 | HERMES_RID_CNFMAXSLEEPDURATION, | 333 | HERMES_RID_CNFMAXSLEEPDURATION, |
343 | &priv->pm_period); | 334 | &priv->pm_period); |
344 | if (err) { | 335 | if (err) { |
345 | printk(KERN_ERR "%s: failed to read power management " | 336 | dev_err(dev, "Failed to read power management " |
346 | "period!\n", dev->name); | 337 | "period!\n"); |
347 | goto out; | 338 | goto out; |
348 | } | 339 | } |
349 | err = hermes_read_wordrec(hw, USER_BAP, | 340 | err = hermes_read_wordrec(hw, USER_BAP, |
350 | HERMES_RID_CNFPMHOLDOVERDURATION, | 341 | HERMES_RID_CNFPMHOLDOVERDURATION, |
351 | &priv->pm_timeout); | 342 | &priv->pm_timeout); |
352 | if (err) { | 343 | if (err) { |
353 | printk(KERN_ERR "%s: failed to read power management " | 344 | dev_err(dev, "Failed to read power management " |
354 | "timeout!\n", dev->name); | 345 | "timeout!\n"); |
355 | goto out; | 346 | goto out; |
356 | } | 347 | } |
357 | } | 348 | } |
@@ -367,9 +358,10 @@ out: | |||
367 | return err; | 358 | return err; |
368 | } | 359 | } |
369 | 360 | ||
361 | /* Can be called before netdev registration */ | ||
370 | int orinoco_hw_allocate_fid(struct orinoco_private *priv) | 362 | int orinoco_hw_allocate_fid(struct orinoco_private *priv) |
371 | { | 363 | { |
372 | struct net_device *dev = priv->ndev; | 364 | struct device *dev = priv->dev; |
373 | struct hermes *hw = &priv->hw; | 365 | struct hermes *hw = &priv->hw; |
374 | int err; | 366 | int err; |
375 | 367 | ||
@@ -379,9 +371,9 @@ int orinoco_hw_allocate_fid(struct orinoco_private *priv) | |||
379 | priv->nicbuf_size = TX_NICBUF_SIZE_BUG; | 371 | priv->nicbuf_size = TX_NICBUF_SIZE_BUG; |
380 | err = hermes_allocate(hw, priv->nicbuf_size, &priv->txfid); | 372 | err = hermes_allocate(hw, priv->nicbuf_size, &priv->txfid); |
381 | 373 | ||
382 | printk(KERN_WARNING "%s: firmware ALLOC bug detected " | 374 | dev_warn(dev, "Firmware ALLOC bug detected " |
383 | "(old Symbol firmware?). Work around %s\n", | 375 | "(old Symbol firmware?). Work around %s\n", |
384 | dev->name, err ? "failed!" : "ok."); | 376 | err ? "failed!" : "ok."); |
385 | } | 377 | } |
386 | 378 | ||
387 | return err; | 379 | return err; |