Commit 44d8dade authored by David Kilroy's avatar David Kilroy Committed by John W. Linville

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: default avatarDavid Kilroy <kilroyd@googlemail.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent a3f47b9c
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
*/ */
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/firmware.h> #include <linux/firmware.h>
#include <linux/device.h>
#include "hermes.h" #include "hermes.h"
#include "hermes_dld.h" #include "hermes_dld.h"
...@@ -99,7 +100,7 @@ orinoco_dl_firmware(struct orinoco_private *priv, ...@@ -99,7 +100,7 @@ orinoco_dl_firmware(struct orinoco_private *priv,
const void *end; const void *end;
const char *firmware; const char *firmware;
const char *fw_err; const char *fw_err;
struct net_device *dev = priv->ndev; struct device *dev = priv->dev;
int err = 0; int err = 0;
pda = kzalloc(fw->pda_size, GFP_KERNEL); pda = kzalloc(fw->pda_size, GFP_KERNEL);
...@@ -111,12 +112,11 @@ orinoco_dl_firmware(struct orinoco_private *priv, ...@@ -111,12 +112,11 @@ orinoco_dl_firmware(struct orinoco_private *priv,
else else
firmware = fw->sta_fw; firmware = fw->sta_fw;
printk(KERN_DEBUG "%s: Attempting to download firmware %s\n", dev_dbg(dev, "Attempting to download firmware %s\n", firmware);
dev->name, firmware);
/* Read current plug data */ /* Read current plug data */
err = hermes_read_pda(hw, pda, fw->pda_addr, fw->pda_size, 0); err = hermes_read_pda(hw, pda, fw->pda_addr, fw->pda_size, 0);
printk(KERN_DEBUG "%s: Read PDA returned %d\n", dev->name, err); dev_dbg(dev, "Read PDA returned %d\n", err);
if (err) if (err)
goto free; goto free;
...@@ -124,8 +124,7 @@ orinoco_dl_firmware(struct orinoco_private *priv, ...@@ -124,8 +124,7 @@ orinoco_dl_firmware(struct orinoco_private *priv,
err = request_firmware(&fw_entry, firmware, priv->dev); err = request_firmware(&fw_entry, firmware, priv->dev);
if (err) { if (err) {
printk(KERN_ERR "%s: Cannot find firmware %s\n", dev_err(dev, "Cannot find firmware %s\n", firmware);
dev->name, firmware);
err = -ENOENT; err = -ENOENT;
goto free; goto free;
} }
...@@ -136,16 +135,15 @@ orinoco_dl_firmware(struct orinoco_private *priv, ...@@ -136,16 +135,15 @@ orinoco_dl_firmware(struct orinoco_private *priv,
fw_err = validate_fw(hdr, fw_entry->size); fw_err = validate_fw(hdr, fw_entry->size);
if (fw_err) { if (fw_err) {
printk(KERN_WARNING "%s: Invalid firmware image detected (%s). " dev_warn(dev, "Invalid firmware image detected (%s). "
"Aborting download\n", "Aborting download\n", fw_err);
dev->name, fw_err);
err = -EINVAL; err = -EINVAL;
goto abort; goto abort;
} }
/* Enable aux port to allow programming */ /* Enable aux port to allow programming */
err = hermesi_program_init(hw, le32_to_cpu(hdr->entry_point)); err = hermesi_program_init(hw, le32_to_cpu(hdr->entry_point));
printk(KERN_DEBUG "%s: Program init returned %d\n", dev->name, err); dev_dbg(dev, "Program init returned %d\n", err);
if (err != 0) if (err != 0)
goto abort; goto abort;
...@@ -156,7 +154,7 @@ orinoco_dl_firmware(struct orinoco_private *priv, ...@@ -156,7 +154,7 @@ orinoco_dl_firmware(struct orinoco_private *priv,
end = fw_entry->data + fw_entry->size; end = fw_entry->data + fw_entry->size;
err = hermes_program(hw, first_block, end); err = hermes_program(hw, first_block, end);
printk(KERN_DEBUG "%s: Program returned %d\n", dev->name, err); dev_dbg(dev, "Program returned %d\n", err);
if (err != 0) if (err != 0)
goto abort; goto abort;
...@@ -167,19 +165,18 @@ orinoco_dl_firmware(struct orinoco_private *priv, ...@@ -167,19 +165,18 @@ orinoco_dl_firmware(struct orinoco_private *priv,
err = hermes_apply_pda_with_defaults(hw, first_block, end, pda, err = hermes_apply_pda_with_defaults(hw, first_block, end, pda,
&pda[fw->pda_size / sizeof(*pda)]); &pda[fw->pda_size / sizeof(*pda)]);
printk(KERN_DEBUG "%s: Apply PDA returned %d\n", dev->name, err); dev_dbg(dev, "Apply PDA returned %d\n", err);
if (err) if (err)
goto abort; goto abort;
/* Tell card we've finished */ /* Tell card we've finished */
err = hermesi_program_end(hw); err = hermesi_program_end(hw);
printk(KERN_DEBUG "%s: Program end returned %d\n", dev->name, err); dev_dbg(dev, "Program end returned %d\n", err);
if (err != 0) if (err != 0)
goto abort; goto abort;
/* Check if we're running */ /* Check if we're running */
printk(KERN_DEBUG "%s: hermes_present returned %d\n", dev_dbg(dev, "hermes_present returned %d\n", hermes_present(hw));
dev->name, hermes_present(hw));
abort: abort:
/* If we requested the firmware, release it. */ /* If we requested the firmware, release it. */
...@@ -282,14 +279,13 @@ static int ...@@ -282,14 +279,13 @@ static int
symbol_dl_firmware(struct orinoco_private *priv, symbol_dl_firmware(struct orinoco_private *priv,
const struct fw_info *fw) const struct fw_info *fw)
{ {
struct net_device *dev = priv->ndev; struct device *dev = priv->dev;
int ret; int ret;
const struct firmware *fw_entry; const struct firmware *fw_entry;
if (!orinoco_cached_fw_get(priv, true)) { if (!orinoco_cached_fw_get(priv, true)) {
if (request_firmware(&fw_entry, fw->pri_fw, priv->dev) != 0) { if (request_firmware(&fw_entry, fw->pri_fw, priv->dev) != 0) {
printk(KERN_ERR "%s: Cannot find firmware: %s\n", dev_err(dev, "Cannot find firmware: %s\n", fw->pri_fw);
dev->name, fw->pri_fw);
return -ENOENT; return -ENOENT;
} }
} else } else
...@@ -302,15 +298,13 @@ symbol_dl_firmware(struct orinoco_private *priv, ...@@ -302,15 +298,13 @@ symbol_dl_firmware(struct orinoco_private *priv,
if (!orinoco_cached_fw_get(priv, true)) if (!orinoco_cached_fw_get(priv, true))
release_firmware(fw_entry); release_firmware(fw_entry);
if (ret) { if (ret) {
printk(KERN_ERR "%s: Primary firmware download failed\n", dev_err(dev, "Primary firmware download failed\n");
dev->name);
return ret; return ret;
} }
if (!orinoco_cached_fw_get(priv, false)) { if (!orinoco_cached_fw_get(priv, false)) {
if (request_firmware(&fw_entry, fw->sta_fw, priv->dev) != 0) { if (request_firmware(&fw_entry, fw->sta_fw, priv->dev) != 0) {
printk(KERN_ERR "%s: Cannot find firmware: %s\n", dev_err(dev, "Cannot find firmware: %s\n", fw->sta_fw);
dev->name, fw->sta_fw);
return -ENOENT; return -ENOENT;
} }
} else } else
...@@ -322,8 +316,7 @@ symbol_dl_firmware(struct orinoco_private *priv, ...@@ -322,8 +316,7 @@ symbol_dl_firmware(struct orinoco_private *priv,
if (!orinoco_cached_fw_get(priv, false)) if (!orinoco_cached_fw_get(priv, false))
release_firmware(fw_entry); release_firmware(fw_entry);
if (ret) { if (ret) {
printk(KERN_ERR "%s: Secondary firmware download failed\n", dev_err(dev, "Secondary firmware download failed\n");
dev->name);
} }
return ret; return ret;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment