aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/cnic.c
diff options
context:
space:
mode:
authorJoe Perches <joe@perches.com>2010-02-17 10:01:54 -0500
committerDavid S. Miller <davem@davemloft.net>2010-02-17 20:45:21 -0500
commitddf79b20eefd27797ce461411679a48e998701ca (patch)
treea67dfacb36e9139f78b5db938c11f6d65b91ad61 /drivers/net/cnic.c
parent436d27d1db147713e4cd17b2fa491d22374bda98 (diff)
drivers/net/cnic.c: Use (pr|netdev)_<level> macro helpers
Add #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt Remove #define PFX Use pr_<level> Use netdev_<level> Remove periods from formats Coalesce long formats Use __func__ Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/cnic.c')
-rw-r--r--drivers/net/cnic.c87
1 files changed, 37 insertions, 50 deletions
diff --git a/drivers/net/cnic.c b/drivers/net/cnic.c
index 4332b3a2faf..6aecef930fa 100644
--- a/drivers/net/cnic.c
+++ b/drivers/net/cnic.c
@@ -10,6 +10,8 @@
10 * Modified and maintained by: Michael Chan <mchan@broadcom.com> 10 * Modified and maintained by: Michael Chan <mchan@broadcom.com>
11 */ 11 */
12 12
13#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
14
13#include <linux/module.h> 15#include <linux/module.h>
14 16
15#include <linux/kernel.h> 17#include <linux/kernel.h>
@@ -47,7 +49,6 @@
47#include "cnic_defs.h" 49#include "cnic_defs.h"
48 50
49#define DRV_MODULE_NAME "cnic" 51#define DRV_MODULE_NAME "cnic"
50#define PFX DRV_MODULE_NAME ": "
51 52
52static char version[] __devinitdata = 53static char version[] __devinitdata =
53 "Broadcom NetXtreme II CNIC Driver " DRV_MODULE_NAME " v" CNIC_MODULE_VERSION " (" CNIC_MODULE_RELDATE ")\n"; 54 "Broadcom NetXtreme II CNIC Driver " DRV_MODULE_NAME " v" CNIC_MODULE_VERSION " (" CNIC_MODULE_RELDATE ")\n";
@@ -409,14 +410,13 @@ int cnic_register_driver(int ulp_type, struct cnic_ulp_ops *ulp_ops)
409 struct cnic_dev *dev; 410 struct cnic_dev *dev;
410 411
411 if (ulp_type < 0 || ulp_type >= MAX_CNIC_ULP_TYPE) { 412 if (ulp_type < 0 || ulp_type >= MAX_CNIC_ULP_TYPE) {
412 printk(KERN_ERR PFX "cnic_register_driver: Bad type %d\n", 413 pr_err("%s: Bad type %d\n", __func__, ulp_type);
413 ulp_type);
414 return -EINVAL; 414 return -EINVAL;
415 } 415 }
416 mutex_lock(&cnic_lock); 416 mutex_lock(&cnic_lock);
417 if (cnic_ulp_tbl[ulp_type]) { 417 if (cnic_ulp_tbl[ulp_type]) {
418 printk(KERN_ERR PFX "cnic_register_driver: Type %d has already " 418 pr_err("%s: Type %d has already been registered\n",
419 "been registered\n", ulp_type); 419 __func__, ulp_type);
420 mutex_unlock(&cnic_lock); 420 mutex_unlock(&cnic_lock);
421 return -EBUSY; 421 return -EBUSY;
422 } 422 }
@@ -455,15 +455,14 @@ int cnic_unregister_driver(int ulp_type)
455 int i = 0; 455 int i = 0;
456 456
457 if (ulp_type < 0 || ulp_type >= MAX_CNIC_ULP_TYPE) { 457 if (ulp_type < 0 || ulp_type >= MAX_CNIC_ULP_TYPE) {
458 printk(KERN_ERR PFX "cnic_unregister_driver: Bad type %d\n", 458 pr_err("%s: Bad type %d\n", __func__, ulp_type);
459 ulp_type);
460 return -EINVAL; 459 return -EINVAL;
461 } 460 }
462 mutex_lock(&cnic_lock); 461 mutex_lock(&cnic_lock);
463 ulp_ops = cnic_ulp_tbl[ulp_type]; 462 ulp_ops = cnic_ulp_tbl[ulp_type];
464 if (!ulp_ops) { 463 if (!ulp_ops) {
465 printk(KERN_ERR PFX "cnic_unregister_driver: Type %d has not " 464 pr_err("%s: Type %d has not been registered\n",
466 "been registered\n", ulp_type); 465 __func__, ulp_type);
467 goto out_unlock; 466 goto out_unlock;
468 } 467 }
469 read_lock(&cnic_dev_lock); 468 read_lock(&cnic_dev_lock);
@@ -471,8 +470,8 @@ int cnic_unregister_driver(int ulp_type)
471 struct cnic_local *cp = dev->cnic_priv; 470 struct cnic_local *cp = dev->cnic_priv;
472 471
473 if (rcu_dereference(cp->ulp_ops[ulp_type])) { 472 if (rcu_dereference(cp->ulp_ops[ulp_type])) {
474 printk(KERN_ERR PFX "cnic_unregister_driver: Type %d " 473 pr_err("%s: Type %d still has devices registered\n",
475 "still has devices registered\n", ulp_type); 474 __func__, ulp_type);
476 read_unlock(&cnic_dev_lock); 475 read_unlock(&cnic_dev_lock);
477 goto out_unlock; 476 goto out_unlock;
478 } 477 }
@@ -492,8 +491,7 @@ int cnic_unregister_driver(int ulp_type)
492 } 491 }
493 492
494 if (atomic_read(&ulp_ops->ref_count) != 0) 493 if (atomic_read(&ulp_ops->ref_count) != 0)
495 printk(KERN_WARNING PFX "%s: Failed waiting for ref count to go" 494 netdev_warn(dev->netdev, "Failed waiting for ref count to go to zero\n");
496 " to zero.\n", dev->netdev->name);
497 return 0; 495 return 0;
498 496
499out_unlock: 497out_unlock:
@@ -511,20 +509,19 @@ static int cnic_register_device(struct cnic_dev *dev, int ulp_type,
511 struct cnic_ulp_ops *ulp_ops; 509 struct cnic_ulp_ops *ulp_ops;
512 510
513 if (ulp_type < 0 || ulp_type >= MAX_CNIC_ULP_TYPE) { 511 if (ulp_type < 0 || ulp_type >= MAX_CNIC_ULP_TYPE) {
514 printk(KERN_ERR PFX "cnic_register_device: Bad type %d\n", 512 pr_err("%s: Bad type %d\n", __func__, ulp_type);
515 ulp_type);
516 return -EINVAL; 513 return -EINVAL;
517 } 514 }
518 mutex_lock(&cnic_lock); 515 mutex_lock(&cnic_lock);
519 if (cnic_ulp_tbl[ulp_type] == NULL) { 516 if (cnic_ulp_tbl[ulp_type] == NULL) {
520 printk(KERN_ERR PFX "cnic_register_device: Driver with type %d " 517 pr_err("%s: Driver with type %d has not been registered\n",
521 "has not been registered\n", ulp_type); 518 __func__, ulp_type);
522 mutex_unlock(&cnic_lock); 519 mutex_unlock(&cnic_lock);
523 return -EAGAIN; 520 return -EAGAIN;
524 } 521 }
525 if (rcu_dereference(cp->ulp_ops[ulp_type])) { 522 if (rcu_dereference(cp->ulp_ops[ulp_type])) {
526 printk(KERN_ERR PFX "cnic_register_device: Type %d has already " 523 pr_err("%s: Type %d has already been registered to this device\n",
527 "been registered to this device\n", ulp_type); 524 __func__, ulp_type);
528 mutex_unlock(&cnic_lock); 525 mutex_unlock(&cnic_lock);
529 return -EBUSY; 526 return -EBUSY;
530 } 527 }
@@ -552,8 +549,7 @@ static int cnic_unregister_device(struct cnic_dev *dev, int ulp_type)
552 int i = 0; 549 int i = 0;
553 550
554 if (ulp_type < 0 || ulp_type >= MAX_CNIC_ULP_TYPE) { 551 if (ulp_type < 0 || ulp_type >= MAX_CNIC_ULP_TYPE) {
555 printk(KERN_ERR PFX "cnic_unregister_device: Bad type %d\n", 552 pr_err("%s: Bad type %d\n", __func__, ulp_type);
556 ulp_type);
557 return -EINVAL; 553 return -EINVAL;
558 } 554 }
559 mutex_lock(&cnic_lock); 555 mutex_lock(&cnic_lock);
@@ -561,8 +557,8 @@ static int cnic_unregister_device(struct cnic_dev *dev, int ulp_type)
561 rcu_assign_pointer(cp->ulp_ops[ulp_type], NULL); 557 rcu_assign_pointer(cp->ulp_ops[ulp_type], NULL);
562 cnic_put(dev); 558 cnic_put(dev);
563 } else { 559 } else {
564 printk(KERN_ERR PFX "cnic_unregister_device: device not " 560 pr_err("%s: device not registered to this ulp type %d\n",
565 "registered to this ulp type %d\n", ulp_type); 561 __func__, ulp_type);
566 mutex_unlock(&cnic_lock); 562 mutex_unlock(&cnic_lock);
567 return -EINVAL; 563 return -EINVAL;
568 } 564 }
@@ -576,8 +572,7 @@ static int cnic_unregister_device(struct cnic_dev *dev, int ulp_type)
576 i++; 572 i++;
577 } 573 }
578 if (test_bit(ULP_F_CALL_PENDING, &cp->ulp_flags[ulp_type])) 574 if (test_bit(ULP_F_CALL_PENDING, &cp->ulp_flags[ulp_type]))
579 printk(KERN_WARNING PFX "%s: Failed waiting for ULP up call" 575 netdev_warn(dev->netdev, "Failed waiting for ULP up call to complete\n");
580 " to complete.\n", dev->netdev->name);
581 576
582 return 0; 577 return 0;
583} 578}
@@ -1865,8 +1860,7 @@ static int cnic_bnx2x_connect(struct cnic_dev *dev, struct kwqe *wqes[],
1865 } 1860 }
1866 1861
1867 if (sizeof(*conn_buf) > CNIC_KWQ16_DATA_SIZE) { 1862 if (sizeof(*conn_buf) > CNIC_KWQ16_DATA_SIZE) {
1868 printk(KERN_ERR PFX "%s: conn_buf size too big\n", 1863 netdev_err(dev->netdev, "conn_buf size too big\n");
1869 dev->netdev->name);
1870 return -ENOMEM; 1864 return -ENOMEM;
1871 } 1865 }
1872 conn_buf = cnic_get_kwqe_16_data(cp, l5_cid, &l5_data); 1866 conn_buf = cnic_get_kwqe_16_data(cp, l5_cid, &l5_data);
@@ -2026,13 +2020,13 @@ static int cnic_submit_bnx2x_kwqes(struct cnic_dev *dev, struct kwqe *wqes[],
2026 break; 2020 break;
2027 default: 2021 default:
2028 ret = 0; 2022 ret = 0;
2029 printk(KERN_ERR PFX "%s: Unknown type of KWQE(0x%x)\n", 2023 netdev_err(dev->netdev, "Unknown type of KWQE(0x%x)\n",
2030 dev->netdev->name, opcode); 2024 opcode);
2031 break; 2025 break;
2032 } 2026 }
2033 if (ret < 0) 2027 if (ret < 0)
2034 printk(KERN_ERR PFX "%s: KWQE(0x%x) failed\n", 2028 netdev_err(dev->netdev, "KWQE(0x%x) failed\n",
2035 dev->netdev->name, opcode); 2029 opcode);
2036 i += work; 2030 i += work;
2037 } 2031 }
2038 return 0; 2032 return 0;
@@ -2074,8 +2068,8 @@ static void service_kcqes(struct cnic_dev *dev, int num_cqes)
2074 else if (kcqe_layer == KCQE_FLAGS_LAYER_MASK_L2) 2068 else if (kcqe_layer == KCQE_FLAGS_LAYER_MASK_L2)
2075 goto end; 2069 goto end;
2076 else { 2070 else {
2077 printk(KERN_ERR PFX "%s: Unknown type of KCQE(0x%x)\n", 2071 netdev_err(dev->netdev, "Unknown type of KCQE(0x%x)\n",
2078 dev->netdev->name, kcqe_op_flag); 2072 kcqe_op_flag);
2079 goto end; 2073 goto end;
2080 } 2074 }
2081 2075
@@ -3435,8 +3429,7 @@ static int cnic_init_bnx2_irq(struct cnic_dev *dev)
3435 return 0; 3429 return 0;
3436 3430
3437failed: 3431failed:
3438 printk(KERN_ERR PFX "%s: " "KCQ index not resetting to 0.\n", 3432 netdev_err(dev->netdev, "KCQ index not resetting to 0\n");
3439 dev->netdev->name);
3440 return -EBUSY; 3433 return -EBUSY;
3441} 3434}
3442 3435
@@ -3758,8 +3751,7 @@ static int cnic_start_bnx2_hw(struct cnic_dev *dev)
3758 3751
3759 err = cnic_init_bnx2_irq(dev); 3752 err = cnic_init_bnx2_irq(dev);
3760 if (err) { 3753 if (err) {
3761 printk(KERN_ERR PFX "%s: cnic_init_irq failed\n", 3754 netdev_err(dev->netdev, "cnic_init_irq failed\n");
3762 dev->netdev->name);
3763 cnic_reg_wr_ind(dev, BNX2_CP_SCRATCH + 0x20, 0); 3755 cnic_reg_wr_ind(dev, BNX2_CP_SCRATCH + 0x20, 0);
3764 cnic_reg_wr_ind(dev, BNX2_COM_SCRATCH + 0x20, 0); 3756 cnic_reg_wr_ind(dev, BNX2_COM_SCRATCH + 0x20, 0);
3765 return err; 3757 return err;
@@ -4122,8 +4114,7 @@ static int cnic_start_bnx2x_hw(struct cnic_dev *dev)
4122 offsetof(struct cstorm_status_block_c, 4114 offsetof(struct cstorm_status_block_c,
4123 index_values[HC_INDEX_C_ISCSI_EQ_CONS])); 4115 index_values[HC_INDEX_C_ISCSI_EQ_CONS]));
4124 if (eq_idx != 0) { 4116 if (eq_idx != 0) {
4125 printk(KERN_ERR PFX "%s: EQ cons index %x != 0\n", 4117 netdev_err(dev->netdev, "EQ cons index %x != 0\n", eq_idx);
4126 dev->netdev->name, eq_idx);
4127 return -EBUSY; 4118 return -EBUSY;
4128 } 4119 }
4129 ret = cnic_init_bnx2x_irq(dev); 4120 ret = cnic_init_bnx2x_irq(dev);
@@ -4208,8 +4199,7 @@ static int cnic_register_netdev(struct cnic_dev *dev)
4208 4199
4209 err = ethdev->drv_register_cnic(dev->netdev, cp->cnic_ops, dev); 4200 err = ethdev->drv_register_cnic(dev->netdev, cp->cnic_ops, dev);
4210 if (err) 4201 if (err)
4211 printk(KERN_ERR PFX "%s: register_cnic failed\n", 4202 netdev_err(dev->netdev, "register_cnic failed\n");
4212 dev->netdev->name);
4213 4203
4214 return err; 4204 return err;
4215} 4205}
@@ -4243,8 +4233,7 @@ static int cnic_start_hw(struct cnic_dev *dev)
4243 4233
4244 err = cp->alloc_resc(dev); 4234 err = cp->alloc_resc(dev);
4245 if (err) { 4235 if (err) {
4246 printk(KERN_ERR PFX "%s: allocate resource failure\n", 4236 netdev_err(dev->netdev, "allocate resource failure\n");
4247 dev->netdev->name);
4248 goto err1; 4237 goto err1;
4249 } 4238 }
4250 4239
@@ -4326,10 +4315,9 @@ static void cnic_free_dev(struct cnic_dev *dev)
4326 i++; 4315 i++;
4327 } 4316 }
4328 if (atomic_read(&dev->ref_count) != 0) 4317 if (atomic_read(&dev->ref_count) != 0)
4329 printk(KERN_ERR PFX "%s: Failed waiting for ref count to go" 4318 netdev_err(dev->netdev, "Failed waiting for ref count to go to zero\n");
4330 " to zero.\n", dev->netdev->name);
4331 4319
4332 printk(KERN_INFO PFX "Removed CNIC device: %s\n", dev->netdev->name); 4320 netdev_info(dev->netdev, "Removed CNIC device\n");
4333 dev_put(dev->netdev); 4321 dev_put(dev->netdev);
4334 kfree(dev); 4322 kfree(dev);
4335} 4323}
@@ -4345,8 +4333,7 @@ static struct cnic_dev *cnic_alloc_dev(struct net_device *dev,
4345 4333
4346 cdev = kzalloc(alloc_size , GFP_KERNEL); 4334 cdev = kzalloc(alloc_size , GFP_KERNEL);
4347 if (cdev == NULL) { 4335 if (cdev == NULL) {
4348 printk(KERN_ERR PFX "%s: allocate dev struct failure\n", 4336 netdev_err(dev, "allocate dev struct failure\n");
4349 dev->name);
4350 return NULL; 4337 return NULL;
4351 } 4338 }
4352 4339
@@ -4364,7 +4351,7 @@ static struct cnic_dev *cnic_alloc_dev(struct net_device *dev,
4364 4351
4365 spin_lock_init(&cp->cnic_ulp_lock); 4352 spin_lock_init(&cp->cnic_ulp_lock);
4366 4353
4367 printk(KERN_INFO PFX "Added CNIC device: %s\n", dev->name); 4354 netdev_info(dev, "Added CNIC device\n");
4368 4355
4369 return cdev; 4356 return cdev;
4370} 4357}
@@ -4605,7 +4592,7 @@ static int __init cnic_init(void)
4605{ 4592{
4606 int rc = 0; 4593 int rc = 0;
4607 4594
4608 printk(KERN_INFO "%s", version); 4595 pr_info("%s", version);
4609 4596
4610 rc = register_netdevice_notifier(&cnic_netdev_notifier); 4597 rc = register_netdevice_notifier(&cnic_netdev_notifier);
4611 if (rc) { 4598 if (rc) {