diff options
author | David Kilroy <kilroyd@googlemail.com> | 2009-06-18 18:21:22 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-07-10 15:01:43 -0400 |
commit | 44d8dade8f12ffe5c9b7eddd0512c1548c027a4c (patch) | |
tree | 41c3bac1450790dcfbe9c90dd9562ce81fbc7b56 /drivers/net/wireless/orinoco/fw.c | |
parent | a3f47b9c2ada45ffacc8f2b54507221a1ba8eb10 (diff) |
orinoco: firmware helpers should use dev_err and friends
We should be able to call these routines before we register with
netdev, so avoid printks using the netdev name.
Signed-off-by: David Kilroy <kilroyd@googlemail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/orinoco/fw.c')
-rw-r--r-- | drivers/net/wireless/orinoco/fw.c | 41 |
1 files changed, 17 insertions, 24 deletions
diff --git a/drivers/net/wireless/orinoco/fw.c b/drivers/net/wireless/orinoco/fw.c index 1084b43e04b..1257250a1e2 100644 --- a/drivers/net/wireless/orinoco/fw.c +++ b/drivers/net/wireless/orinoco/fw.c | |||
@@ -4,6 +4,7 @@ | |||
4 | */ | 4 | */ |
5 | #include <linux/kernel.h> | 5 | #include <linux/kernel.h> |
6 | #include <linux/firmware.h> | 6 | #include <linux/firmware.h> |
7 | #include <linux/device.h> | ||
7 | 8 | ||
8 | #include "hermes.h" | 9 | #include "hermes.h" |
9 | #include "hermes_dld.h" | 10 | #include "hermes_dld.h" |
@@ -99,7 +100,7 @@ orinoco_dl_firmware(struct orinoco_private *priv, | |||
99 | const void *end; | 100 | const void *end; |
100 | const char *firmware; | 101 | const char *firmware; |
101 | const char *fw_err; | 102 | const char *fw_err; |
102 | struct net_device *dev = priv->ndev; | 103 | struct device *dev = priv->dev; |
103 | int err = 0; | 104 | int err = 0; |
104 | 105 | ||
105 | pda = kzalloc(fw->pda_size, GFP_KERNEL); | 106 | pda = kzalloc(fw->pda_size, GFP_KERNEL); |
@@ -111,12 +112,11 @@ orinoco_dl_firmware(struct orinoco_private *priv, | |||
111 | else | 112 | else |
112 | firmware = fw->sta_fw; | 113 | firmware = fw->sta_fw; |
113 | 114 | ||
114 | printk(KERN_DEBUG "%s: Attempting to download firmware %s\n", | 115 | dev_dbg(dev, "Attempting to download firmware %s\n", firmware); |
115 | dev->name, firmware); | ||
116 | 116 | ||
117 | /* Read current plug data */ | 117 | /* Read current plug data */ |
118 | err = hermes_read_pda(hw, pda, fw->pda_addr, fw->pda_size, 0); | 118 | err = hermes_read_pda(hw, pda, fw->pda_addr, fw->pda_size, 0); |
119 | printk(KERN_DEBUG "%s: Read PDA returned %d\n", dev->name, err); | 119 | dev_dbg(dev, "Read PDA returned %d\n", err); |
120 | if (err) | 120 | if (err) |
121 | goto free; | 121 | goto free; |
122 | 122 | ||
@@ -124,8 +124,7 @@ orinoco_dl_firmware(struct orinoco_private *priv, | |||
124 | err = request_firmware(&fw_entry, firmware, priv->dev); | 124 | err = request_firmware(&fw_entry, firmware, priv->dev); |
125 | 125 | ||
126 | if (err) { | 126 | if (err) { |
127 | printk(KERN_ERR "%s: Cannot find firmware %s\n", | 127 | dev_err(dev, "Cannot find firmware %s\n", firmware); |
128 | dev->name, firmware); | ||
129 | err = -ENOENT; | 128 | err = -ENOENT; |
130 | goto free; | 129 | goto free; |
131 | } | 130 | } |
@@ -136,16 +135,15 @@ orinoco_dl_firmware(struct orinoco_private *priv, | |||
136 | 135 | ||
137 | fw_err = validate_fw(hdr, fw_entry->size); | 136 | fw_err = validate_fw(hdr, fw_entry->size); |
138 | if (fw_err) { | 137 | if (fw_err) { |
139 | printk(KERN_WARNING "%s: Invalid firmware image detected (%s). " | 138 | dev_warn(dev, "Invalid firmware image detected (%s). " |
140 | "Aborting download\n", | 139 | "Aborting download\n", fw_err); |
141 | dev->name, fw_err); | ||
142 | err = -EINVAL; | 140 | err = -EINVAL; |
143 | goto abort; | 141 | goto abort; |
144 | } | 142 | } |
145 | 143 | ||
146 | /* Enable aux port to allow programming */ | 144 | /* Enable aux port to allow programming */ |
147 | err = hermesi_program_init(hw, le32_to_cpu(hdr->entry_point)); | 145 | err = hermesi_program_init(hw, le32_to_cpu(hdr->entry_point)); |
148 | printk(KERN_DEBUG "%s: Program init returned %d\n", dev->name, err); | 146 | dev_dbg(dev, "Program init returned %d\n", err); |
149 | if (err != 0) | 147 | if (err != 0) |
150 | goto abort; | 148 | goto abort; |
151 | 149 | ||
@@ -156,7 +154,7 @@ orinoco_dl_firmware(struct orinoco_private *priv, | |||
156 | end = fw_entry->data + fw_entry->size; | 154 | end = fw_entry->data + fw_entry->size; |
157 | 155 | ||
158 | err = hermes_program(hw, first_block, end); | 156 | err = hermes_program(hw, first_block, end); |
159 | printk(KERN_DEBUG "%s: Program returned %d\n", dev->name, err); | 157 | dev_dbg(dev, "Program returned %d\n", err); |
160 | if (err != 0) | 158 | if (err != 0) |
161 | goto abort; | 159 | goto abort; |
162 | 160 | ||
@@ -167,19 +165,18 @@ orinoco_dl_firmware(struct orinoco_private *priv, | |||
167 | 165 | ||
168 | err = hermes_apply_pda_with_defaults(hw, first_block, end, pda, | 166 | err = hermes_apply_pda_with_defaults(hw, first_block, end, pda, |
169 | &pda[fw->pda_size / sizeof(*pda)]); | 167 | &pda[fw->pda_size / sizeof(*pda)]); |
170 | printk(KERN_DEBUG "%s: Apply PDA returned %d\n", dev->name, err); | 168 | dev_dbg(dev, "Apply PDA returned %d\n", err); |
171 | if (err) | 169 | if (err) |
172 | goto abort; | 170 | goto abort; |
173 | 171 | ||
174 | /* Tell card we've finished */ | 172 | /* Tell card we've finished */ |
175 | err = hermesi_program_end(hw); | 173 | err = hermesi_program_end(hw); |
176 | printk(KERN_DEBUG "%s: Program end returned %d\n", dev->name, err); | 174 | dev_dbg(dev, "Program end returned %d\n", err); |
177 | if (err != 0) | 175 | if (err != 0) |
178 | goto abort; | 176 | goto abort; |
179 | 177 | ||
180 | /* Check if we're running */ | 178 | /* Check if we're running */ |
181 | printk(KERN_DEBUG "%s: hermes_present returned %d\n", | 179 | dev_dbg(dev, "hermes_present returned %d\n", hermes_present(hw)); |
182 | dev->name, hermes_present(hw)); | ||
183 | 180 | ||
184 | abort: | 181 | abort: |
185 | /* If we requested the firmware, release it. */ | 182 | /* If we requested the firmware, release it. */ |
@@ -282,14 +279,13 @@ static int | |||
282 | symbol_dl_firmware(struct orinoco_private *priv, | 279 | symbol_dl_firmware(struct orinoco_private *priv, |
283 | const struct fw_info *fw) | 280 | const struct fw_info *fw) |
284 | { | 281 | { |
285 | struct net_device *dev = priv->ndev; | 282 | struct device *dev = priv->dev; |
286 | int ret; | 283 | int ret; |
287 | const struct firmware *fw_entry; | 284 | const struct firmware *fw_entry; |
288 | 285 | ||
289 | if (!orinoco_cached_fw_get(priv, true)) { | 286 | if (!orinoco_cached_fw_get(priv, true)) { |
290 | if (request_firmware(&fw_entry, fw->pri_fw, priv->dev) != 0) { | 287 | if (request_firmware(&fw_entry, fw->pri_fw, priv->dev) != 0) { |
291 | printk(KERN_ERR "%s: Cannot find firmware: %s\n", | 288 | dev_err(dev, "Cannot find firmware: %s\n", fw->pri_fw); |
292 | dev->name, fw->pri_fw); | ||
293 | return -ENOENT; | 289 | return -ENOENT; |
294 | } | 290 | } |
295 | } else | 291 | } else |
@@ -302,15 +298,13 @@ symbol_dl_firmware(struct orinoco_private *priv, | |||
302 | if (!orinoco_cached_fw_get(priv, true)) | 298 | if (!orinoco_cached_fw_get(priv, true)) |
303 | release_firmware(fw_entry); | 299 | release_firmware(fw_entry); |
304 | if (ret) { | 300 | if (ret) { |
305 | printk(KERN_ERR "%s: Primary firmware download failed\n", | 301 | dev_err(dev, "Primary firmware download failed\n"); |
306 | dev->name); | ||
307 | return ret; | 302 | return ret; |
308 | } | 303 | } |
309 | 304 | ||
310 | if (!orinoco_cached_fw_get(priv, false)) { | 305 | if (!orinoco_cached_fw_get(priv, false)) { |
311 | if (request_firmware(&fw_entry, fw->sta_fw, priv->dev) != 0) { | 306 | if (request_firmware(&fw_entry, fw->sta_fw, priv->dev) != 0) { |
312 | printk(KERN_ERR "%s: Cannot find firmware: %s\n", | 307 | dev_err(dev, "Cannot find firmware: %s\n", fw->sta_fw); |
313 | dev->name, fw->sta_fw); | ||
314 | return -ENOENT; | 308 | return -ENOENT; |
315 | } | 309 | } |
316 | } else | 310 | } else |
@@ -322,8 +316,7 @@ symbol_dl_firmware(struct orinoco_private *priv, | |||
322 | if (!orinoco_cached_fw_get(priv, false)) | 316 | if (!orinoco_cached_fw_get(priv, false)) |
323 | release_firmware(fw_entry); | 317 | release_firmware(fw_entry); |
324 | if (ret) { | 318 | if (ret) { |
325 | printk(KERN_ERR "%s: Secondary firmware download failed\n", | 319 | dev_err(dev, "Secondary firmware download failed\n"); |
326 | dev->name); | ||
327 | } | 320 | } |
328 | 321 | ||
329 | return ret; | 322 | return ret; |