提交 ecc46789 编写于 作者: I Ivan Vecera 提交者: David S. Miller

bna: use netdev_* and dev_* instead of printk and pr_*

...and remove some of them. It is not necessary to log when .probe() and
.remove() are called or when TxQ is started or stopped. Also log level
of some of them was changed to more appropriate one (link up/down,
firmware loading failure.
Signed-off-by: NIvan Vecera <ivecera@redhat.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 ad24d6f0
...@@ -946,8 +946,7 @@ bnad_cb_ethport_link_status(struct bnad *bnad, ...@@ -946,8 +946,7 @@ bnad_cb_ethport_link_status(struct bnad *bnad,
if (link_up) { if (link_up) {
if (!netif_carrier_ok(bnad->netdev)) { if (!netif_carrier_ok(bnad->netdev)) {
uint tx_id, tcb_id; uint tx_id, tcb_id;
printk(KERN_WARNING "bna: %s link up\n", netdev_info(bnad->netdev, "link up\n");
bnad->netdev->name);
netif_carrier_on(bnad->netdev); netif_carrier_on(bnad->netdev);
BNAD_UPDATE_CTR(bnad, link_toggle); BNAD_UPDATE_CTR(bnad, link_toggle);
for (tx_id = 0; tx_id < bnad->num_tx; tx_id++) { for (tx_id = 0; tx_id < bnad->num_tx; tx_id++) {
...@@ -966,10 +965,6 @@ bnad_cb_ethport_link_status(struct bnad *bnad, ...@@ -966,10 +965,6 @@ bnad_cb_ethport_link_status(struct bnad *bnad,
/* /*
* Force an immediate * Force an immediate
* Transmit Schedule */ * Transmit Schedule */
printk(KERN_INFO "bna: %s %d "
"TXQ_STARTED\n",
bnad->netdev->name,
txq_id);
netif_wake_subqueue( netif_wake_subqueue(
bnad->netdev, bnad->netdev,
txq_id); txq_id);
...@@ -987,8 +982,7 @@ bnad_cb_ethport_link_status(struct bnad *bnad, ...@@ -987,8 +982,7 @@ bnad_cb_ethport_link_status(struct bnad *bnad,
} }
} else { } else {
if (netif_carrier_ok(bnad->netdev)) { if (netif_carrier_ok(bnad->netdev)) {
printk(KERN_WARNING "bna: %s link down\n", netdev_info(bnad->netdev, "link down\n");
bnad->netdev->name);
netif_carrier_off(bnad->netdev); netif_carrier_off(bnad->netdev);
BNAD_UPDATE_CTR(bnad, link_toggle); BNAD_UPDATE_CTR(bnad, link_toggle);
} }
...@@ -1058,8 +1052,6 @@ bnad_cb_tx_stall(struct bnad *bnad, struct bna_tx *tx) ...@@ -1058,8 +1052,6 @@ bnad_cb_tx_stall(struct bnad *bnad, struct bna_tx *tx)
txq_id = tcb->id; txq_id = tcb->id;
clear_bit(BNAD_TXQ_TX_STARTED, &tcb->flags); clear_bit(BNAD_TXQ_TX_STARTED, &tcb->flags);
netif_stop_subqueue(bnad->netdev, txq_id); netif_stop_subqueue(bnad->netdev, txq_id);
printk(KERN_INFO "bna: %s %d TXQ_STOPPED\n",
bnad->netdev->name, txq_id);
} }
} }
...@@ -1082,8 +1074,6 @@ bnad_cb_tx_resume(struct bnad *bnad, struct bna_tx *tx) ...@@ -1082,8 +1074,6 @@ bnad_cb_tx_resume(struct bnad *bnad, struct bna_tx *tx)
BUG_ON(*(tcb->hw_consumer_index) != 0); BUG_ON(*(tcb->hw_consumer_index) != 0);
if (netif_carrier_ok(bnad->netdev)) { if (netif_carrier_ok(bnad->netdev)) {
printk(KERN_INFO "bna: %s %d TXQ_STARTED\n",
bnad->netdev->name, txq_id);
netif_wake_subqueue(bnad->netdev, txq_id); netif_wake_subqueue(bnad->netdev, txq_id);
BNAD_UPDATE_CTR(bnad, netif_queue_wakeup); BNAD_UPDATE_CTR(bnad, netif_queue_wakeup);
} }
...@@ -2136,7 +2126,7 @@ bnad_reinit_rx(struct bnad *bnad) ...@@ -2136,7 +2126,7 @@ bnad_reinit_rx(struct bnad *bnad)
current_err = bnad_setup_rx(bnad, rx_id); current_err = bnad_setup_rx(bnad, rx_id);
if (current_err && !err) { if (current_err && !err) {
err = current_err; err = current_err;
pr_err("RXQ:%u setup failed\n", rx_id); netdev_err(netdev, "RXQ:%u setup failed\n", rx_id);
} }
} }
...@@ -2672,8 +2662,9 @@ bnad_enable_msix(struct bnad *bnad) ...@@ -2672,8 +2662,9 @@ bnad_enable_msix(struct bnad *bnad)
if (ret < 0) { if (ret < 0) {
goto intx_mode; goto intx_mode;
} else if (ret < bnad->msix_num) { } else if (ret < bnad->msix_num) {
pr_warn("BNA: %d MSI-X vectors allocated < %d requested\n", dev_warn(&bnad->pcidev->dev,
ret, bnad->msix_num); "%d MSI-X vectors allocated < %d requested\n",
ret, bnad->msix_num);
spin_lock_irqsave(&bnad->bna_lock, flags); spin_lock_irqsave(&bnad->bna_lock, flags);
/* ret = #of vectors that we got */ /* ret = #of vectors that we got */
...@@ -2695,7 +2686,8 @@ bnad_enable_msix(struct bnad *bnad) ...@@ -2695,7 +2686,8 @@ bnad_enable_msix(struct bnad *bnad)
return; return;
intx_mode: intx_mode:
pr_warn("BNA: MSI-X enable failed - operating in INTx mode\n"); dev_warn(&bnad->pcidev->dev,
"MSI-X enable failed - operating in INTx mode\n");
kfree(bnad->msix_table); kfree(bnad->msix_table);
bnad->msix_table = NULL; bnad->msix_table = NULL;
...@@ -3482,8 +3474,8 @@ bnad_init(struct bnad *bnad, ...@@ -3482,8 +3474,8 @@ bnad_init(struct bnad *bnad,
dev_err(&pdev->dev, "ioremap for bar0 failed\n"); dev_err(&pdev->dev, "ioremap for bar0 failed\n");
return -ENOMEM; return -ENOMEM;
} }
pr_info("bar0 mapped to %p, len %llu\n", bnad->bar0, dev_info(&pdev->dev, "bar0 mapped to %p, len %llu\n", bnad->bar0,
(unsigned long long) bnad->mmio_len); (unsigned long long) bnad->mmio_len);
spin_lock_irqsave(&bnad->bna_lock, flags); spin_lock_irqsave(&bnad->bna_lock, flags);
if (!bnad_msix_disable) if (!bnad_msix_disable)
...@@ -3604,13 +3596,10 @@ bnad_pci_probe(struct pci_dev *pdev, ...@@ -3604,13 +3596,10 @@ bnad_pci_probe(struct pci_dev *pdev,
struct bfa_pcidev pcidev_info; struct bfa_pcidev pcidev_info;
unsigned long flags; unsigned long flags;
pr_info("bnad_pci_probe : (0x%p, 0x%p) PCI Func : (%d)\n",
pdev, pcidev_id, PCI_FUNC(pdev->devfn));
mutex_lock(&bnad_fwimg_mutex); mutex_lock(&bnad_fwimg_mutex);
if (!cna_get_firmware_buf(pdev)) { if (!cna_get_firmware_buf(pdev)) {
mutex_unlock(&bnad_fwimg_mutex); mutex_unlock(&bnad_fwimg_mutex);
pr_warn("Failed to load Firmware Image!\n"); dev_err(&pdev->dev, "failed to load firmware image!\n");
return -ENODEV; return -ENODEV;
} }
mutex_unlock(&bnad_fwimg_mutex); mutex_unlock(&bnad_fwimg_mutex);
...@@ -3703,8 +3692,7 @@ bnad_pci_probe(struct pci_dev *pdev, ...@@ -3703,8 +3692,7 @@ bnad_pci_probe(struct pci_dev *pdev,
*/ */
err = bnad_ioceth_enable(bnad); err = bnad_ioceth_enable(bnad);
if (err) { if (err) {
pr_err("BNA: Initialization failed err=%d\n", dev_err(&pdev->dev, "initialization failed err=%d\n", err);
err);
goto probe_success; goto probe_success;
} }
...@@ -3746,7 +3734,7 @@ bnad_pci_probe(struct pci_dev *pdev, ...@@ -3746,7 +3734,7 @@ bnad_pci_probe(struct pci_dev *pdev,
/* Finally, reguister with net_device layer */ /* Finally, reguister with net_device layer */
err = register_netdev(netdev); err = register_netdev(netdev);
if (err) { if (err) {
pr_err("BNA : Registering with netdev failed\n"); dev_err(&pdev->dev, "registering net device failed\n");
goto probe_uninit; goto probe_uninit;
} }
set_bit(BNAD_RF_NETDEV_REGISTERED, &bnad->run_flags); set_bit(BNAD_RF_NETDEV_REGISTERED, &bnad->run_flags);
...@@ -3798,7 +3786,6 @@ bnad_pci_remove(struct pci_dev *pdev) ...@@ -3798,7 +3786,6 @@ bnad_pci_remove(struct pci_dev *pdev)
if (!netdev) if (!netdev)
return; return;
pr_info("%s bnad_pci_remove\n", netdev->name);
bnad = netdev_priv(netdev); bnad = netdev_priv(netdev);
bna = &bnad->bna; bna = &bnad->bna;
...@@ -3859,15 +3846,14 @@ bnad_module_init(void) ...@@ -3859,15 +3846,14 @@ bnad_module_init(void)
{ {
int err; int err;
pr_info("QLogic BR-series 10G Ethernet driver - version: %s\n", pr_info("bna: QLogic BR-series 10G Ethernet driver - version: %s\n",
BNAD_VERSION); BNAD_VERSION);
bfa_nw_ioc_auto_recover(bnad_ioc_auto_recover); bfa_nw_ioc_auto_recover(bnad_ioc_auto_recover);
err = pci_register_driver(&bnad_pci_driver); err = pci_register_driver(&bnad_pci_driver);
if (err < 0) { if (err < 0) {
pr_err("bna : PCI registration failed in module init " pr_err("bna: PCI driver registration failed err=%d\n", err);
"(%d)\n", err);
return err; return err;
} }
......
...@@ -76,8 +76,7 @@ bnad_debugfs_open_fwtrc(struct inode *inode, struct file *file) ...@@ -76,8 +76,7 @@ bnad_debugfs_open_fwtrc(struct inode *inode, struct file *file)
fw_debug->debug_buffer = NULL; fw_debug->debug_buffer = NULL;
kfree(fw_debug); kfree(fw_debug);
fw_debug = NULL; fw_debug = NULL;
pr_warn("bnad %s: Failed to collect fwtrc\n", netdev_warn(bnad->netdev, "failed to collect fwtrc\n");
pci_name(bnad->pcidev));
return -ENOMEM; return -ENOMEM;
} }
...@@ -117,8 +116,7 @@ bnad_debugfs_open_fwsave(struct inode *inode, struct file *file) ...@@ -117,8 +116,7 @@ bnad_debugfs_open_fwsave(struct inode *inode, struct file *file)
fw_debug->debug_buffer = NULL; fw_debug->debug_buffer = NULL;
kfree(fw_debug); kfree(fw_debug);
fw_debug = NULL; fw_debug = NULL;
pr_warn("bna %s: Failed to collect fwsave\n", netdev_warn(bnad->netdev, "failed to collect fwsave\n");
pci_name(bnad->pcidev));
return -ENOMEM; return -ENOMEM;
} }
...@@ -217,8 +215,7 @@ bnad_debugfs_open_drvinfo(struct inode *inode, struct file *file) ...@@ -217,8 +215,7 @@ bnad_debugfs_open_drvinfo(struct inode *inode, struct file *file)
drv_info->debug_buffer = NULL; drv_info->debug_buffer = NULL;
kfree(drv_info); kfree(drv_info);
drv_info = NULL; drv_info = NULL;
pr_warn("bna %s: Failed to collect drvinfo\n", netdev_warn(bnad->netdev, "failed to collect drvinfo\n");
pci_name(bnad->pcidev));
return -ENOMEM; return -ENOMEM;
} }
...@@ -328,8 +325,7 @@ bnad_debugfs_write_regrd(struct file *file, const char __user *buf, ...@@ -328,8 +325,7 @@ bnad_debugfs_write_regrd(struct file *file, const char __user *buf,
rc = sscanf(kern_buf, "%x:%x", &addr, &len); rc = sscanf(kern_buf, "%x:%x", &addr, &len);
if (rc < 2) { if (rc < 2) {
pr_warn("bna %s: Failed to read user buffer\n", netdev_warn(bnad->netdev, "failed to read user buffer\n");
pci_name(bnad->pcidev));
kfree(kern_buf); kfree(kern_buf);
return -EINVAL; return -EINVAL;
} }
...@@ -349,8 +345,7 @@ bnad_debugfs_write_regrd(struct file *file, const char __user *buf, ...@@ -349,8 +345,7 @@ bnad_debugfs_write_regrd(struct file *file, const char __user *buf,
/* offset and len sanity check */ /* offset and len sanity check */
rc = bna_reg_offset_check(ioc, addr, len); rc = bna_reg_offset_check(ioc, addr, len);
if (rc) { if (rc) {
pr_warn("bna %s: Failed reg offset check\n", netdev_warn(bnad->netdev, "failed reg offset check\n");
pci_name(bnad->pcidev));
kfree(bnad->regdata); kfree(bnad->regdata);
bnad->regdata = NULL; bnad->regdata = NULL;
bnad->reglen = 0; bnad->reglen = 0;
...@@ -389,8 +384,7 @@ bnad_debugfs_write_regwr(struct file *file, const char __user *buf, ...@@ -389,8 +384,7 @@ bnad_debugfs_write_regwr(struct file *file, const char __user *buf,
rc = sscanf(kern_buf, "%x:%x", &addr, &val); rc = sscanf(kern_buf, "%x:%x", &addr, &val);
if (rc < 2) { if (rc < 2) {
pr_warn("bna %s: Failed to read user buffer\n", netdev_warn(bnad->netdev, "failed to read user buffer\n");
pci_name(bnad->pcidev));
kfree(kern_buf); kfree(kern_buf);
return -EINVAL; return -EINVAL;
} }
...@@ -401,8 +395,7 @@ bnad_debugfs_write_regwr(struct file *file, const char __user *buf, ...@@ -401,8 +395,7 @@ bnad_debugfs_write_regwr(struct file *file, const char __user *buf,
/* offset and len sanity check */ /* offset and len sanity check */
rc = bna_reg_offset_check(ioc, addr, 1); rc = bna_reg_offset_check(ioc, addr, 1);
if (rc) { if (rc) {
pr_warn("bna %s: Failed reg offset check\n", netdev_warn(bnad->netdev, "failed reg offset check\n");
pci_name(bnad->pcidev));
return -EINVAL; return -EINVAL;
} }
...@@ -514,7 +507,8 @@ bnad_debugfs_init(struct bnad *bnad) ...@@ -514,7 +507,8 @@ bnad_debugfs_init(struct bnad *bnad)
bna_debugfs_root = debugfs_create_dir("bna", NULL); bna_debugfs_root = debugfs_create_dir("bna", NULL);
atomic_set(&bna_debugfs_port_count, 0); atomic_set(&bna_debugfs_port_count, 0);
if (!bna_debugfs_root) { if (!bna_debugfs_root) {
pr_warn("BNA: debugfs root dir creation failed\n"); netdev_warn(bnad->netdev,
"debugfs root dir creation failed\n");
return; return;
} }
} }
...@@ -525,8 +519,8 @@ bnad_debugfs_init(struct bnad *bnad) ...@@ -525,8 +519,8 @@ bnad_debugfs_init(struct bnad *bnad)
bnad->port_debugfs_root = bnad->port_debugfs_root =
debugfs_create_dir(name, bna_debugfs_root); debugfs_create_dir(name, bna_debugfs_root);
if (!bnad->port_debugfs_root) { if (!bnad->port_debugfs_root) {
pr_warn("bna pci_dev %s: root dir creation failed\n", netdev_warn(bnad->netdev,
pci_name(bnad->pcidev)); "debugfs root dir creation failed\n");
return; return;
} }
...@@ -541,9 +535,9 @@ bnad_debugfs_init(struct bnad *bnad) ...@@ -541,9 +535,9 @@ bnad_debugfs_init(struct bnad *bnad)
bnad, bnad,
file->fops); file->fops);
if (!bnad->bnad_dentry_files[i]) { if (!bnad->bnad_dentry_files[i]) {
pr_warn( netdev_warn(bnad->netdev,
"BNA pci_dev:%s: create %s entry failed\n", "create %s entry failed\n",
pci_name(bnad->pcidev), file->name); file->name);
return; return;
} }
} }
......
...@@ -1080,7 +1080,7 @@ bnad_flash_device(struct net_device *netdev, struct ethtool_flash *eflash) ...@@ -1080,7 +1080,7 @@ bnad_flash_device(struct net_device *netdev, struct ethtool_flash *eflash)
ret = request_firmware(&fw, eflash->data, &bnad->pcidev->dev); ret = request_firmware(&fw, eflash->data, &bnad->pcidev->dev);
if (ret) { if (ret) {
pr_err("BNA: Can't locate firmware %s\n", eflash->data); netdev_err(netdev, "can't load firmware %s\n", eflash->data);
goto out; goto out;
} }
...@@ -1093,7 +1093,7 @@ bnad_flash_device(struct net_device *netdev, struct ethtool_flash *eflash) ...@@ -1093,7 +1093,7 @@ bnad_flash_device(struct net_device *netdev, struct ethtool_flash *eflash)
bnad->id, (u8 *)fw->data, fw->size, 0, bnad->id, (u8 *)fw->data, fw->size, 0,
bnad_cb_completion, &fcomp); bnad_cb_completion, &fcomp);
if (ret != BFA_STATUS_OK) { if (ret != BFA_STATUS_OK) {
pr_warn("BNA: Flash update failed with err: %d\n", ret); netdev_warn(netdev, "flash update failed with err=%d\n", ret);
ret = -EIO; ret = -EIO;
spin_unlock_irq(&bnad->bna_lock); spin_unlock_irq(&bnad->bna_lock);
goto out; goto out;
...@@ -1103,8 +1103,9 @@ bnad_flash_device(struct net_device *netdev, struct ethtool_flash *eflash) ...@@ -1103,8 +1103,9 @@ bnad_flash_device(struct net_device *netdev, struct ethtool_flash *eflash)
wait_for_completion(&fcomp.comp); wait_for_completion(&fcomp.comp);
if (fcomp.comp_status != BFA_STATUS_OK) { if (fcomp.comp_status != BFA_STATUS_OK) {
ret = -EIO; ret = -EIO;
pr_warn("BNA: Firmware image update to flash failed with: %d\n", netdev_warn(netdev,
fcomp.comp_status); "firmware image update failed with err=%d\n",
fcomp.comp_status);
} }
out: out:
release_firmware(fw); release_firmware(fw);
......
...@@ -33,7 +33,7 @@ cna_read_firmware(struct pci_dev *pdev, u32 **bfi_image, ...@@ -33,7 +33,7 @@ cna_read_firmware(struct pci_dev *pdev, u32 **bfi_image,
u32 n; u32 n;
if (request_firmware(&fw, fw_name, &pdev->dev)) { if (request_firmware(&fw, fw_name, &pdev->dev)) {
pr_alert("Can't locate firmware %s\n", fw_name); dev_alert(&pdev->dev, "can't load firmware %s\n", fw_name);
goto error; goto error;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册