Skip to contentSkip to conversation

Trivial cleanups

PATCH New Joe Perches 1 participant 3 messages Nov 24, 2009

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover Trivial cleanups

Just a couple of cleanup patches on your latest submission.

Joe Perches (2):
drivers/net/bna: Use pr_<level>, dev_<level>, remove DPRINTK drivers/net/bna: Use kcalloc

 drivers/net/bna/bfa_csdebug.c |   10 +-
 drivers/net/bna/bfa_ioc.c     |    5 +-
 drivers/net/bna/bfad_fwimg.c  |    8 +-
 drivers/net/bna/bna_fn.c      |    7 +-
 drivers/net/bna/bna_if.c      |   48 ++++------
 drivers/net/bna/bnad.c        |  216 ++++++++++++++++-------------------------
 drivers/net/bna/bnad_compat.h |   13 ---
 drivers/net/bna/cna.h         |    5 -
 8 files changed, 116 insertions(+), 196 deletions(-)
#1 lore raw

PATCH 1/2 drivers/net/bna: Use pr_<level>, dev_<level>, remove DPRINTK

Remove DPRINTK(LEVEL, fmt, arg) and convert uses to pr_<level> Convert printk(KERN_<LEVEL> to pr_<level>
Use dev_<level> as appropriate.

---
 drivers/net/bna/bfa_csdebug.c |   10 +--
 drivers/net/bna/bfa_ioc.c     |    5 +-
 drivers/net/bna/bfad_fwimg.c  |    8 +-
 drivers/net/bna/bna_fn.c      |    7 +-
 drivers/net/bna/bna_if.c      |   48 +++++-------
 drivers/net/bna/bnad.c        |  171 +++++++++++++++-------------------------
 drivers/net/bna/bnad_compat.h |   13 ---
 drivers/net/bna/cna.h         |    5 -
 8 files changed, 97 insertions(+), 170 deletions(-)
drivers/net/bna/bfa_csdebug.c +4 -6
index c0ef773..c9f3480 100644
@@ -20,6 +20,8 @@
  *  pbind.c BFA FC Persistent target binding
  */
 
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
 #include "cs/bfa_debug.h"
 #include "cna.h"
 #include "cs/bfa_q.h"
@@ -31,18 +33,14 @@
 void
 bfa_panic(int line, char *file, char *panicstr)
 {
-
-	DPRINTK(ERR, "Assertion failure: %s:%d: %s",
-		file, line, panicstr);
+	pr_err("Assertion failure: %s:%d: %s\n", file, line, panicstr);
 	bfa_os_panic();
 }
 
 void
 bfa_sm_panic(struct bfa_log_mod *logm, int line, char *file, int event)
 {
-
-	DPRINTK(ERR, "SM Assertion failure: %s:%d: event = %d",
-		file, line, event);
+	pr_err("SM Assertion failure: %s:%d: event = %d\n", file, line, event);
 	bfa_os_panic();
 }
 
drivers/net/bna/bfa_ioc.c +3 -2
index b572cc5..f601850 100644
@@ -16,6 +16,8 @@
  * www.brocade.com
  */
 
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
 #include "bfa_ioc.h"
 #include "bfa_fwimg_priv.h"
 #include "cs/bfa_debug.h"
@@ -1015,8 +1017,7 @@ bfa_ioc_hb_check(void *cbarg)
 
 	hb_count = bfa_reg_read(ioc->ioc_regs.heartbeat);
 	if (ioc->hb_count == hb_count) {
-
-		DPRINTK(CRIT, "Firmware heartbeat failure at %d", hb_count);
+		pr_crit("Firmware heartbeat failure at %d\n", hb_count);
 		bfa_ioc_recover(ioc);
 		return;
 	} else {
drivers/net/bna/bfad_fwimg.c +5 -3
index 37fa6d5..d1ad2e2 100644
@@ -16,6 +16,8 @@
  * www.brocade.com
  */
 
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
 /**
  *  bfad_fwimg.c Linux driver PCI interface module.
  */
@@ -47,14 +49,14 @@ bfad_read_firmware(struct pci_dev *pdev, u32 **bfi_image,
 	const struct firmware *fw;
 
 	if (request_firmware(&fw, fw_name, &pdev->dev)) {
-		printk(KERN_ALERT "Can't locate firmware %s\n", fw_name);
+		pr_alert("Can't locate firmware %s\n", fw_name);
 		goto error;
 	}
 
 	*bfi_image = vmalloc(fw->size);
 	if (NULL == *bfi_image) {
-		printk(KERN_ALERT "Fail to allocate buffer for fw image "
-			"size=%x!\n", (u32) fw->size);
+		pr_alert("Fail to allocate buffer for fw image size=%x!\n",
+			 (u32)fw->size);
 		goto error;
 	}
 
drivers/net/bna/bna_fn.c +3 -4
index 01218ca..03d4e94 100644
@@ -18,6 +18,8 @@
  *    @file bna_fn.c BNA Rx and Tx Function Management
  */
 
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
 #include "cna.h"
 #include "bna.h"
 #include "bna_hwreg.h"
@@ -657,14 +659,11 @@ enum bna_status_e bna_rxf_mcast_mac_set_list(struct bna_dev *dev,
 {
 	u32 i, j;
 	int found;
-	char message[BNA_MESSAGE_SIZE];
 
 	BNA_ASSERT(rxf_id < BNA_RXF_ID_MAX);
 
 	if (mac_addr_num > BNA_MCAST_TABLE_SIZE) {
-		sprintf(message, "Too many Multicast Addresses [%d]",
-			       mac_addr_num);
-		DPRINTK(INFO, "%s", message);
+		pr_info("Too many Multicast Addresses [%d]\n", mac_addr_num);
 		return BNA_FAIL;
 	}
 
drivers/net/bna/bna_if.c +18 -30

103 lines not on this page · raw message

drivers/net/bna/bnad.c +64 -107

475 lines not on this page · raw message

drivers/net/bna/bnad_compat.h +0 -13
index 98232e8..4e3c80c 100644
@@ -73,19 +73,6 @@
 #define VERIFY_READ 0
 #endif
 
-#ifndef dev_err
-#define dev_err(dev, format, arg...)	\
-	printk(KERN_ERR "bna: " format, ## arg)
-#endif
-#ifndef dev_info
-#define dev_info(dev, format, arg...)	\
-	printk(KERN_INFO "bna: " format, ## arg)
-#endif
-#ifndef dev_warn
-#define dev_warn(dev, format, arg...)	\
-	printk(KERN_WARNING "bna: " format, ## arg)
-#endif
-
 #ifndef __force
 #define __force
 #endif
drivers/net/bna/cna.h +0 -5
index c75cdf5..4907041 100644
@@ -49,11 +49,6 @@
 
 #define bfa_wtole(_x) cpu_to_le32((_x))
 
-#define PFX "BNA: "
-#define DPRINTK(klevel, fmt, args...) do {  \
-	printk(KERN_##klevel PFX fmt, ## args);      \
-} while (0)
-
 extern char bfa_version[];
 void bfa_ioc_auto_recover(bool auto_recover);
 
Signature · 1 line
1.6.5.2.153.g6e31f
#2 lore raw

PATCH 2/2 drivers/net/bna: Use kcalloc

In reply to Joe Perches
---
 drivers/net/bna/bnad.c |   45 +++++++++++++++++++--------------------------
 1 files changed, 19 insertions(+), 26 deletions(-)
drivers/net/bna/bnad.c +19 -26
index 28df975..edc4a3a 100644
@@ -1186,9 +1186,8 @@ static int bnad_alloc_ibs(struct bnad *bnad)
 	int err;
 
 	bnad->ib_num = bnad->txq_num + bnad->cq_num;
-	bnad->ib_table =
-		kzalloc(bnad->ib_num * sizeof(struct bnad_ib_entry),
-			GFP_KERNEL);
+	bnad->ib_table = kcalloc(bnad->ib_num, sizeof(struct bnad_ib_entry),
+				 GFP_KERNEL);
 	if (!bnad->ib_table)
 		return -ENOMEM;
 
@@ -1250,7 +1249,7 @@ static int bnad_alloc_q(struct bnad *bnad, struct bna_qpt *qpt,
 		return -ENOMEM;
 	BNA_SET_DMA_ADDR(dma_addr, &qpt->hw_qpt_ptr);
 
-	q->qpt_ptr = kzalloc(qpt->page_count * sizeof(void *), GFP_KERNEL);
+	q->qpt_ptr = kcalloc(qpt->page_count, sizeof(void *), GFP_KERNEL);
 	if (!q->qpt_ptr)
 		return -ENOMEM;
 	qpt->qpt_ptr = q->qpt_ptr;
@@ -1386,9 +1385,8 @@ static int bnad_txqs_init(struct bnad *bnad)
 {
 	int i, err = 0;
 
-	bnad->txq_table =
-		kzalloc(bnad->txq_num * sizeof(struct bnad_txq_info),
-			GFP_KERNEL);
+	bnad->txq_table = kcalloc(bnad->txq_num, sizeof(struct bnad_txq_info),
+				  GFP_KERNEL);
 	if (!bnad->txq_table)
 		return -ENOMEM;
 
@@ -1425,9 +1423,8 @@ static int bnad_rxqs_init(struct bnad *bnad)
 {
 	int i, err = 0;
 
-	bnad->rxq_table =
-		kzalloc(bnad->rxq_num * sizeof(struct bnad_rxq_info),
-			GFP_KERNEL);
+	bnad->rxq_table = kcalloc(bnad->rxq_num, sizeof(struct bnad_rxq_info),
+				  GFP_KERNEL);
 	if (!bnad->rxq_table)
 		return -EINVAL;
 
@@ -1470,8 +1467,8 @@ static int bnad_cqs_init(struct bnad *bnad)
 {
 	int i, err = 0;
 
-	bnad->cq_table =
-		kzalloc(bnad->cq_num * sizeof(struct bnad_cq_info), GFP_KERNEL);
+	bnad->cq_table = kcalloc(bnad->cq_num, sizeof(struct bnad_cq_info),
+				 GFP_KERNEL);
 	if (!bnad->cq_table)
 		return -ENOMEM;
 
@@ -1633,16 +1630,14 @@ void bnad_rxf_init(struct bnad *bnad, uint rxf_id, u8 rit_offset, int rss)
 
 static int bnad_init_funcs(struct bnad *bnad)
 {
-	bnad->txf_table =
-		kzalloc(sizeof(struct bnad_txf_info) * bnad->txf_num,
-			GFP_KERNEL);
+	bnad->txf_table = kcalloc(bnad->txf_num, sizeof(struct bnad_txf_info),
+				  GFP_KERNEL);
 	if (!bnad->txf_table)
 		return -ENOMEM;
 	bnad_txf_init(bnad, BNAD_TX_FUNC_ID);
 
-	bnad->rxf_table =
-		kzalloc(sizeof(struct bnad_rxf_info) * bnad->rxf_num,
-			GFP_KERNEL);
+	bnad->rxf_table = kcalloc(bnad->rxf_num, sizeof(struct bnad_rxf_info),
+				  GFP_KERNEL);
 	if (!bnad->rxf_table)
 		return -ENOMEM;
 	bnad_rxf_init(bnad, BNAD_RX_FUNC_ID, BNAD_RIT_OFFSET,
@@ -1866,9 +1861,8 @@ static int bnad_init(struct bnad *bnad)
 	if (err)
 		goto finished;
 
-	bnad->rit =
-		kzalloc(bnad->cq_num * sizeof(struct bna_rit_entry),
-			GFP_KERNEL);
+	bnad->rit = kcalloc(bnad->cq_num, sizeof(struct bna_rit_entry),
+			    GFP_KERNEL);
 	if (!bnad->rit)
 		goto finished;
 
@@ -2421,9 +2415,8 @@ static void bnad_set_rx_mode_locked(struct net_device *netdev)
 		struct dev_mc_list *mc;
 		int i;
 
-		mcaddr_list =
-			kzalloc((netdev->mc_count + 1) * sizeof(struct mac),
-				GFP_ATOMIC);
+		mcaddr_list = kcalloc((netdev->mc_count + 1),
+				      sizeof(struct mac), GFP_ATOMIC);
 		if (!mcaddr_list)
 			return;
 
@@ -2663,8 +2656,8 @@ static void bnad_enable_msix(struct bnad *bnad)
 	if (!(bnad->config & BNAD_CF_MSIX) || bnad->msix_table)
 		return;
 
-	bnad->msix_table =
-		kzalloc(bnad->msix_num * sizeof(struct msix_entry), GFP_KERNEL);
+	bnad->msix_table = kcalloc(bnad->msix_num, sizeof(struct msix_entry),
+				   GFP_KERNEL);
 	if (!bnad->msix_table)
 		goto intx_mode;
 
Signature · 1 line
1.6.5.2.153.g6e31f