linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 0/3] megaraid: use dev_printk() when possible
@ 2015-07-07 20:52 Bjorn Helgaas
  2015-07-07 20:52 ` [PATCH v3 1/3] megaraid : use dev_printk " Bjorn Helgaas
                   ` (2 more replies)
  0 siblings, 3 replies; 12+ messages in thread
From: Bjorn Helgaas @ 2015-07-07 20:52 UTC (permalink / raw)
  To: Kashyap Desai, Uday Lingala, Sumit Saxena
  Cc: megaraidlinux.pdl, linux-scsi, James E.J. Bottomley,
	linux-kernel, Joe Perches, Christoph Hellwig

The current megaraid driver messages are somewhat inconsistent, with
different combinations of driver name and device address:

  megasas: 0x1000:0x005b:0x15d9:0x0690: bus 1:slot 0:func 0
  megaraid_sas 0000:01:00.0: megasas: FW restarted successfully from megasas_init_fw!
  megasas: Waiting for FW to come to ready state

These patches use dev_printk() to include the driver name and device
address in the conventional format.

Changes between v2 and v3:
  - Rebase to v4.2-rc1
  - Fix more whitespace issues (but not all) in megaraid_sas_base.c

Changes between v1 and v2:
  - Rebase to next-20150601
  - Squash megaraid_sas_base.c and megaraid_sas_fusion.c changes into one patch
  - Split megasas_dump_pending_frames() run-on printks into one line each
  - Add patch to fix whitespace errors in megasas_dump_pending_frames()

---

Bjorn Helgaas (3):
      megaraid : use dev_printk when possible
      megaraid_sas : use dev_printk when possible
      megaraid_sas : fix whitespace errors


 drivers/scsi/megaraid.c                     |  140 +++----
 drivers/scsi/megaraid/megaraid_sas_base.c   |  544 +++++++++++++--------------
 drivers/scsi/megaraid/megaraid_sas_fusion.c |   95 ++---
 3 files changed, 378 insertions(+), 401 deletions(-)

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH v3 1/3] megaraid : use dev_printk when possible
  2015-07-07 20:52 [PATCH v3 0/3] megaraid: use dev_printk() when possible Bjorn Helgaas
@ 2015-07-07 20:52 ` Bjorn Helgaas
  2015-07-08  6:08   ` Sumit Saxena
  2015-07-08 10:44   ` Hannes Reinecke
  2015-07-07 20:52 ` [PATCH v3 2/3] megaraid_sas " Bjorn Helgaas
  2015-07-07 20:52 ` [PATCH v3 3/3] megaraid_sas : fix whitespace errors Bjorn Helgaas
  2 siblings, 2 replies; 12+ messages in thread
From: Bjorn Helgaas @ 2015-07-07 20:52 UTC (permalink / raw)
  To: Kashyap Desai, Uday Lingala, Sumit Saxena
  Cc: megaraidlinux.pdl, linux-scsi, James E.J. Bottomley,
	linux-kernel, Joe Perches, Christoph Hellwig

Use dev_printk() when possible to make messages more useful.

Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
---
 drivers/scsi/megaraid.c |  140 ++++++++++++++++++++++-------------------------
 1 file changed, 66 insertions(+), 74 deletions(-)

diff --git a/drivers/scsi/megaraid.c b/drivers/scsi/megaraid.c
index bc7b34c..9d05302 100644
--- a/drivers/scsi/megaraid.c
+++ b/drivers/scsi/megaraid.c
@@ -268,8 +268,8 @@ mega_query_adapter(adapter_t *adapter)
 		raw_mbox[2] = NC_SUBOP_PRODUCT_INFO;	/* i.e. 0x0E */
 
 		if ((retval = issue_scb_block(adapter, raw_mbox)))
-			printk(KERN_WARNING
-			"megaraid: Product_info cmd failed with error: %d\n",
+			dev_warn(&adapter->dev->dev,
+				"Product_info cmd failed with error: %d\n",
 				retval);
 
 		pci_unmap_single(adapter->dev, prod_info_dma_handle,
@@ -334,7 +334,7 @@ mega_query_adapter(adapter_t *adapter)
 		adapter->bios_version[4] = 0;
 	}
 
-	printk(KERN_NOTICE "megaraid: [%s:%s] detected %d logical drives.\n",
+	dev_notice(&adapter->dev->dev, "[%s:%s] detected %d logical drives\n",
 		adapter->fw_version, adapter->bios_version, adapter->numldrv);
 
 	/*
@@ -342,7 +342,7 @@ mega_query_adapter(adapter_t *adapter)
 	 */
 	adapter->support_ext_cdb = mega_support_ext_cdb(adapter);
 	if (adapter->support_ext_cdb)
-		printk(KERN_NOTICE "megaraid: supports extended CDBs.\n");
+		dev_notice(&adapter->dev->dev, "supports extended CDBs\n");
 
 
 	return 0;
@@ -678,11 +678,11 @@ mega_build_cmd(adapter_t *adapter, Scsi_Cmnd *cmd, int *busy)
 
 			if(!(adapter->flag & (1L << cmd->device->channel))) {
 
-				printk(KERN_NOTICE
-					"scsi%d: scanning scsi channel %d ",
+				dev_notice(&adapter->dev->dev,
+					"scsi%d: scanning scsi channel %d "
+					"for logical drives\n",
 						adapter->host->host_no,
 						cmd->device->channel);
-				printk("for logical drives.\n");
 
 				adapter->flag |= (1L << cmd->device->channel);
 			}
@@ -983,11 +983,11 @@ mega_prepare_passthru(adapter_t *adapter, scb_t *scb, Scsi_Cmnd *cmd,
 	case READ_CAPACITY:
 		if(!(adapter->flag & (1L << cmd->device->channel))) {
 
-			printk(KERN_NOTICE
-				"scsi%d: scanning scsi channel %d [P%d] ",
+			dev_notice(&adapter->dev->dev,
+				"scsi%d: scanning scsi channel %d [P%d] "
+				"for physical devices\n",
 					adapter->host->host_no,
 					cmd->device->channel, channel);
-			printk("for physical devices.\n");
 
 			adapter->flag |= (1L << cmd->device->channel);
 		}
@@ -1045,11 +1045,11 @@ mega_prepare_extpassthru(adapter_t *adapter, scb_t *scb, Scsi_Cmnd *cmd,
 	case READ_CAPACITY:
 		if(!(adapter->flag & (1L << cmd->device->channel))) {
 
-			printk(KERN_NOTICE
-				"scsi%d: scanning scsi channel %d [P%d] ",
+			dev_notice(&adapter->dev->dev,
+				"scsi%d: scanning scsi channel %d [P%d] "
+				"for physical devices\n",
 					adapter->host->host_no,
 					cmd->device->channel, channel);
-			printk("for physical devices.\n");
 
 			adapter->flag |= (1L << cmd->device->channel);
 		}
@@ -1241,7 +1241,7 @@ issue_scb_block(adapter_t *adapter, u_char *raw_mbox)
 	return mbox->m_in.status;
 
 bug_blocked_mailbox:
-	printk(KERN_WARNING "megaraid: Blocked mailbox......!!\n");
+	dev_warn(&adapter->dev->dev, "Blocked mailbox......!!\n");
 	udelay (1000);
 	return -1;
 }
@@ -1454,9 +1454,8 @@ mega_cmd_done(adapter_t *adapter, u8 completed[], int nstatus, int status)
 			 * Make sure f/w has completed a valid command
 			 */
 			if( !(scb->state & SCB_ISSUED) || scb->cmd == NULL ) {
-				printk(KERN_CRIT
-					"megaraid: invalid command ");
-				printk("Id %d, scb->state:%x, scsi cmd:%p\n",
+				dev_crit(&adapter->dev->dev, "invalid command "
+					"Id %d, scb->state:%x, scsi cmd:%p\n",
 					cmdid, scb->state, scb->cmd);
 
 				continue;
@@ -1467,8 +1466,8 @@ mega_cmd_done(adapter_t *adapter, u8 completed[], int nstatus, int status)
 			 */
 			if( scb->state & SCB_ABORT ) {
 
-				printk(KERN_WARNING
-				"megaraid: aborted cmd [%x] complete.\n",
+				dev_warn(&adapter->dev->dev,
+					"aborted cmd [%x] complete\n",
 					scb->idx);
 
 				scb->cmd->result = (DID_ABORT << 16);
@@ -1486,8 +1485,8 @@ mega_cmd_done(adapter_t *adapter, u8 completed[], int nstatus, int status)
 			 */
 			if( scb->state & SCB_RESET ) {
 
-				printk(KERN_WARNING
-				"megaraid: reset cmd [%x] complete.\n",
+				dev_warn(&adapter->dev->dev,
+					"reset cmd [%x] complete\n",
 					scb->idx);
 
 				scb->cmd->result = (DID_RESET << 16);
@@ -1553,8 +1552,7 @@ mega_cmd_done(adapter_t *adapter, u8 completed[], int nstatus, int status)
 			if( sg_page(sgl) ) {
 				c = *(unsigned char *) sg_virt(&sgl[0]);
 			} else {
-				printk(KERN_WARNING
-				       "megaraid: invalid sg.\n");
+				dev_warn(&adapter->dev->dev, "invalid sg\n");
 				c = 0;
 			}
 
@@ -1902,11 +1900,10 @@ megaraid_reset(struct scsi_cmnd *cmd)
 	mc.opcode = MEGA_RESET_RESERVATIONS;
 
 	if( mega_internal_command(adapter, &mc, NULL) != 0 ) {
-		printk(KERN_WARNING
-				"megaraid: reservation reset failed.\n");
+		dev_warn(&adapter->dev->dev, "reservation reset failed\n");
 	}
 	else {
-		printk(KERN_INFO "megaraid: reservation reset.\n");
+		dev_info(&adapter->dev->dev, "reservation reset\n");
 	}
 #endif
 
@@ -1939,7 +1936,7 @@ megaraid_abort_and_reset(adapter_t *adapter, Scsi_Cmnd *cmd, int aor)
 	struct list_head	*pos, *next;
 	scb_t			*scb;
 
-	printk(KERN_WARNING "megaraid: %s cmd=%x <c=%d t=%d l=%d>\n",
+	dev_warn(&adapter->dev->dev, "%s cmd=%x <c=%d t=%d l=%d>\n",
 	     (aor == SCB_ABORT)? "ABORTING":"RESET",
 	     cmd->cmnd[0], cmd->device->channel,
 	     cmd->device->id, (u32)cmd->device->lun);
@@ -1963,8 +1960,8 @@ megaraid_abort_and_reset(adapter_t *adapter, Scsi_Cmnd *cmd, int aor)
 			 */
 			if( scb->state & SCB_ISSUED ) {
 
-				printk(KERN_WARNING
-					"megaraid: %s[%x], fw owner.\n",
+				dev_warn(&adapter->dev->dev,
+					"%s[%x], fw owner\n",
 					(aor==SCB_ABORT) ? "ABORTING":"RESET",
 					scb->idx);
 
@@ -1976,8 +1973,8 @@ megaraid_abort_and_reset(adapter_t *adapter, Scsi_Cmnd *cmd, int aor)
 				 * Not yet issued! Remove from the pending
 				 * list
 				 */
-				printk(KERN_WARNING
-					"megaraid: %s-[%x], driver owner.\n",
+				dev_warn(&adapter->dev->dev,
+					"%s-[%x], driver owner\n",
 					(aor==SCB_ABORT) ? "ABORTING":"RESET",
 					scb->idx);
 
@@ -2197,7 +2194,7 @@ proc_show_rebuild_rate(struct seq_file *m, void *v)
 
 	if( mega_adapinq(adapter, dma_handle) != 0 ) {
 		seq_puts(m, "Adapter inquiry failed.\n");
-		printk(KERN_WARNING "megaraid: inquiry failed.\n");
+		dev_warn(&adapter->dev->dev, "inquiry failed\n");
 		goto free_inquiry;
 	}
 
@@ -2241,7 +2238,7 @@ proc_show_battery(struct seq_file *m, void *v)
 
 	if( mega_adapinq(adapter, dma_handle) != 0 ) {
 		seq_puts(m, "Adapter inquiry failed.\n");
-		printk(KERN_WARNING "megaraid: inquiry failed.\n");
+		dev_warn(&adapter->dev->dev, "inquiry failed\n");
 		goto free_inquiry;
 	}
 
@@ -2350,7 +2347,7 @@ proc_show_pdrv(struct seq_file *m, adapter_t *adapter, int channel)
 
 	if( mega_adapinq(adapter, dma_handle) != 0 ) {
 		seq_puts(m, "Adapter inquiry failed.\n");
-		printk(KERN_WARNING "megaraid: inquiry failed.\n");
+		dev_warn(&adapter->dev->dev, "inquiry failed\n");
 		goto free_inquiry;
 	}
 
@@ -2525,7 +2522,7 @@ proc_show_rdrv(struct seq_file *m, adapter_t *adapter, int start, int end )
 
 	if( mega_adapinq(adapter, dma_handle) != 0 ) {
 		seq_puts(m, "Adapter inquiry failed.\n");
-		printk(KERN_WARNING "megaraid: inquiry failed.\n");
+		dev_warn(&adapter->dev->dev, "inquiry failed\n");
 		goto free_inquiry;
 	}
 
@@ -2799,7 +2796,7 @@ mega_create_proc_entry(int index, struct proc_dir_entry *parent)
 	dir = adapter->controller_proc_dir_entry =
 		proc_mkdir_data(string, 0, parent, adapter);
 	if(!dir) {
-		printk(KERN_WARNING "\nmegaraid: proc_mkdir failed\n");
+		dev_warn(&adapter->dev->dev, "proc_mkdir failed\n");
 		return;
 	}
 
@@ -2807,7 +2804,7 @@ mega_create_proc_entry(int index, struct proc_dir_entry *parent)
 		de = proc_create_data(f->name, S_IRUSR, dir, &mega_proc_fops,
 				      f->show);
 		if (!de) {
-			printk(KERN_WARNING "\nmegaraid: proc_create failed\n");
+			dev_warn(&adapter->dev->dev, "proc_create failed\n");
 			return;
 		}
 
@@ -2874,9 +2871,9 @@ megaraid_biosparam(struct scsi_device *sdev, struct block_device *bdev,
 				return rval;
 		}
 
-		printk(KERN_INFO
-		"megaraid: invalid partition on this disk on channel %d\n",
-				sdev->channel);
+		dev_info(&adapter->dev->dev,
+			 "invalid partition on this disk on channel %d\n",
+			 sdev->channel);
 
 		/* Default heads (64) & sectors (32) */
 		heads = 64;
@@ -2936,7 +2933,7 @@ mega_init_scb(adapter_t *adapter)
 		scb->sgl = (mega_sglist *)scb->sgl64;
 
 		if( !scb->sgl ) {
-			printk(KERN_WARNING "RAID: Can't allocate sglist.\n");
+			dev_warn(&adapter->dev->dev, "RAID: Can't allocate sglist\n");
 			mega_free_sgl(adapter);
 			return -1;
 		}
@@ -2946,7 +2943,7 @@ mega_init_scb(adapter_t *adapter)
 				&scb->pthru_dma_addr);
 
 		if( !scb->pthru ) {
-			printk(KERN_WARNING "RAID: Can't allocate passthru.\n");
+			dev_warn(&adapter->dev->dev, "RAID: Can't allocate passthru\n");
 			mega_free_sgl(adapter);
 			return -1;
 		}
@@ -2956,8 +2953,8 @@ mega_init_scb(adapter_t *adapter)
 				&scb->epthru_dma_addr);
 
 		if( !scb->epthru ) {
-			printk(KERN_WARNING
-				"Can't allocate extended passthru.\n");
+			dev_warn(&adapter->dev->dev,
+				"Can't allocate extended passthru\n");
 			mega_free_sgl(adapter);
 			return -1;
 		}
@@ -3154,8 +3151,8 @@ megadev_ioctl(struct file *filep, unsigned int cmd, unsigned long arg)
 			 * Do we support this feature
 			 */
 			if( !adapter->support_random_del ) {
-				printk(KERN_WARNING "megaraid: logdrv ");
-				printk("delete on non-supporting F/W.\n");
+				dev_warn(&adapter->dev->dev, "logdrv "
+					"delete on non-supporting F/W\n");
 
 				return (-EINVAL);
 			}
@@ -3179,7 +3176,7 @@ megadev_ioctl(struct file *filep, unsigned int cmd, unsigned long arg)
 		if( uioc.uioc_rmbox[0] == MEGA_MBOXCMD_PASSTHRU64 ||
 			uioc.uioc_rmbox[0] == MEGA_MBOXCMD_EXTPTHRU ) {
 
-			printk(KERN_WARNING "megaraid: rejected passthru.\n");
+			dev_warn(&adapter->dev->dev, "rejected passthru\n");
 
 			return (-EINVAL);
 		}
@@ -3683,11 +3680,11 @@ mega_enum_raid_scsi(adapter_t *adapter)
 
 	for( i = 0; i < adapter->product_info.nchannels; i++ ) { 
 		if( (adapter->mega_ch_class >> i) & 0x01 ) {
-			printk(KERN_INFO "megaraid: channel[%d] is raid.\n",
+			dev_info(&adapter->dev->dev, "channel[%d] is raid\n",
 					i);
 		}
 		else {
-			printk(KERN_INFO "megaraid: channel[%d] is scsi.\n",
+			dev_info(&adapter->dev->dev, "channel[%d] is scsi\n",
 					i);
 		}
 	}
@@ -3893,7 +3890,7 @@ mega_do_del_logdrv(adapter_t *adapter, int logdrv)
 
 	/* log this event */
 	if(rval) {
-		printk(KERN_WARNING "megaraid: Delete LD-%d failed.", logdrv);
+		dev_warn(&adapter->dev->dev, "Delete LD-%d failed", logdrv);
 		return rval;
 	}
 
@@ -4161,7 +4158,7 @@ mega_internal_command(adapter_t *adapter, megacmd_t *mc, mega_passthru *pthru)
 	 * this information.
 	 */
 	if (rval && trace_level) {
-		printk("megaraid: cmd [%x, %x, %x] status:[%x]\n",
+		dev_info(&adapter->dev->dev, "cmd [%x, %x, %x] status:[%x]\n",
 			mc->cmd, mc->opcode, mc->subopcode, rval);
 	}
 
@@ -4244,11 +4241,8 @@ megaraid_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
 	subsysvid = pdev->subsystem_vendor;
 	subsysid = pdev->subsystem_device;
 
-	printk(KERN_NOTICE "megaraid: found 0x%4.04x:0x%4.04x:bus %d:",
-		id->vendor, id->device, pci_bus);
-
-	printk("slot %d:func %d\n",
-		PCI_SLOT(pci_dev_func), PCI_FUNC(pci_dev_func));
+	dev_notice(&pdev->dev, "found 0x%4.04x:0x%4.04x\n",
+		id->vendor, id->device);
 
 	/* Read the base port and IRQ from PCI */
 	mega_baseport = pci_resource_start(pdev, 0);
@@ -4259,14 +4253,13 @@ megaraid_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
 		flag |= BOARD_MEMMAP;
 
 		if (!request_mem_region(mega_baseport, 128, "megaraid")) {
-			printk(KERN_WARNING "megaraid: mem region busy!\n");
+			dev_warn(&pdev->dev, "mem region busy!\n");
 			goto out_disable_device;
 		}
 
 		mega_baseport = (unsigned long)ioremap(mega_baseport, 128);
 		if (!mega_baseport) {
-			printk(KERN_WARNING
-			       "megaraid: could not map hba memory\n");
+			dev_warn(&pdev->dev, "could not map hba memory\n");
 			goto out_release_region;
 		}
 	} else {
@@ -4285,7 +4278,7 @@ megaraid_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
 	adapter = (adapter_t *)host->hostdata;
 	memset(adapter, 0, sizeof(adapter_t));
 
-	printk(KERN_NOTICE
+	dev_notice(&pdev->dev,
 		"scsi%d:Found MegaRAID controller at 0x%lx, IRQ:%d\n",
 		host->host_no, mega_baseport, irq);
 
@@ -4323,21 +4316,20 @@ megaraid_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
 	adapter->mega_buffer = pci_alloc_consistent(adapter->dev,
 		MEGA_BUFFER_SIZE, &adapter->buf_dma_handle);
 	if (!adapter->mega_buffer) {
-		printk(KERN_WARNING "megaraid: out of RAM.\n");
+		dev_warn(&pdev->dev, "out of RAM\n");
 		goto out_host_put;
 	}
 
 	adapter->scb_list = kmalloc(sizeof(scb_t) * MAX_COMMANDS, GFP_KERNEL);
 	if (!adapter->scb_list) {
-		printk(KERN_WARNING "megaraid: out of RAM.\n");
+		dev_warn(&pdev->dev, "out of RAM\n");
 		goto out_free_cmd_buffer;
 	}
 
 	if (request_irq(irq, (adapter->flag & BOARD_MEMMAP) ?
 				megaraid_isr_memmapped : megaraid_isr_iomapped,
 					IRQF_SHARED, "megaraid", adapter)) {
-		printk(KERN_WARNING
-			"megaraid: Couldn't register IRQ %d!\n", irq);
+		dev_warn(&pdev->dev, "Couldn't register IRQ %d!\n", irq);
 		goto out_free_scb_list;
 	}
 
@@ -4357,9 +4349,9 @@ megaraid_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
 		if (!strcmp(adapter->fw_version, "3.00") ||
 				!strcmp(adapter->fw_version, "3.01")) {
 
-			printk( KERN_WARNING
-				"megaraid: Your  card is a Dell PERC "
-				"2/SC RAID controller with  "
+			dev_warn(&pdev->dev,
+				"Your card is a Dell PERC "
+				"2/SC RAID controller with "
 				"firmware\nmegaraid: 3.00 or 3.01.  "
 				"This driver is known to have "
 				"corruption issues\nmegaraid: with "
@@ -4390,12 +4382,12 @@ megaraid_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
 		if (!strcmp(adapter->fw_version, "H01.07") ||
 		    !strcmp(adapter->fw_version, "H01.08") ||
 		    !strcmp(adapter->fw_version, "H01.09") ) {
-			printk(KERN_WARNING
-				"megaraid: Firmware H.01.07, "
+			dev_warn(&pdev->dev,
+				"Firmware H.01.07, "
 				"H.01.08, and H.01.09 on 1M/2M "
 				"controllers\n"
-				"megaraid: do not support 64 bit "
-				"addressing.\nmegaraid: DISABLING "
+				"do not support 64 bit "
+				"addressing.\nDISABLING "
 				"64 bit support.\n");
 			adapter->flag &= ~BOARD_64BIT;
 		}
@@ -4503,8 +4495,8 @@ megaraid_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
 	 */
 	adapter->has_cluster = mega_support_cluster(adapter);
 	if (adapter->has_cluster) {
-		printk(KERN_NOTICE
-			"megaraid: Cluster driver, initiator id:%d\n",
+		dev_notice(&pdev->dev,
+			"Cluster driver, initiator id:%d\n",
 			adapter->this_id);
 	}
 #endif
@@ -4571,7 +4563,7 @@ __megaraid_shutdown(adapter_t *adapter)
 	issue_scb_block(adapter, raw_mbox);
 	
 	if (atomic_read(&adapter->pend_cmds) > 0)
-		printk(KERN_WARNING "megaraid: pending commands!!\n");
+		dev_warn(&adapter->dev->dev, "pending commands!!\n");
 
 	/*
 	 * Have a delibrate delay to make sure all the caches are


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH v3 2/3] megaraid_sas : use dev_printk when possible
  2015-07-07 20:52 [PATCH v3 0/3] megaraid: use dev_printk() when possible Bjorn Helgaas
  2015-07-07 20:52 ` [PATCH v3 1/3] megaraid : use dev_printk " Bjorn Helgaas
@ 2015-07-07 20:52 ` Bjorn Helgaas
  2015-07-08  9:13   ` Sumit Saxena
  2015-07-08 10:47   ` Hannes Reinecke
  2015-07-07 20:52 ` [PATCH v3 3/3] megaraid_sas : fix whitespace errors Bjorn Helgaas
  2 siblings, 2 replies; 12+ messages in thread
From: Bjorn Helgaas @ 2015-07-07 20:52 UTC (permalink / raw)
  To: Kashyap Desai, Uday Lingala, Sumit Saxena
  Cc: megaraidlinux.pdl, linux-scsi, James E.J. Bottomley,
	linux-kernel, Joe Perches, Christoph Hellwig

Use dev_printk() when possible to make messages more useful.

Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
---
 drivers/scsi/megaraid/megaraid_sas_base.c   |  304 +++++++++++++--------------
 drivers/scsi/megaraid/megaraid_sas_fusion.c |   95 ++++----
 2 files changed, 196 insertions(+), 203 deletions(-)

diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c
index 71b884d..a9bd592 100644
--- a/drivers/scsi/megaraid/megaraid_sas_base.c
+++ b/drivers/scsi/megaraid/megaraid_sas_base.c
@@ -216,7 +216,7 @@ struct megasas_cmd *megasas_get_cmd(struct megasas_instance
 				 struct megasas_cmd, list);
 		list_del_init(&cmd->list);
 	} else {
-		printk(KERN_ERR "megasas: Command pool empty!\n");
+		dev_err(&instance->pdev->dev, "Command pool empty!\n");
 	}
 
 	spin_unlock_irqrestore(&instance->mfi_pool_lock, flags);
@@ -370,9 +370,9 @@ megasas_adp_reset_xscale(struct megasas_instance *instance,
 		msleep(1000); /* sleep for 3 secs */
 	pcidata  = 0;
 	pci_read_config_dword(instance->pdev, MFI_1068_PCSR_OFFSET, &pcidata);
-	printk(KERN_NOTICE "pcidata = %x\n", pcidata);
+	dev_notice(&instance->pdev->dev, "pcidata = %x\n", pcidata);
 	if (pcidata & 0x2) {
-		printk(KERN_NOTICE "mfi 1068 offset read=%x\n", pcidata);
+		dev_notice(&instance->pdev->dev, "mfi 1068 offset read=%x\n", pcidata);
 		pcidata &= ~0x2;
 		pci_write_config_dword(instance->pdev,
 				MFI_1068_PCSR_OFFSET, pcidata);
@@ -383,9 +383,9 @@ megasas_adp_reset_xscale(struct megasas_instance *instance,
 		pcidata  = 0;
 		pci_read_config_dword(instance->pdev,
 				MFI_1068_FW_HANDSHAKE_OFFSET, &pcidata);
-		printk(KERN_NOTICE "1068 offset handshake read=%x\n", pcidata);
+		dev_notice(&instance->pdev->dev, "1068 offset handshake read=%x\n", pcidata);
 		if ((pcidata & 0xffff0000) == MFI_1068_FW_READY) {
-			printk(KERN_NOTICE "1068 offset pcidt=%x\n", pcidata);
+			dev_notice(&instance->pdev->dev, "1068 offset pcidt=%x\n", pcidata);
 			pcidata = 0;
 			pci_write_config_dword(instance->pdev,
 				MFI_1068_FW_HANDSHAKE_OFFSET, pcidata);
@@ -824,7 +824,7 @@ megasas_adp_reset_gen2(struct megasas_instance *instance,
 	while ( !( HostDiag & DIAG_WRITE_ENABLE) ) {
 		msleep(100);
 		HostDiag = (u32)readl(hostdiag_offset);
-		printk(KERN_NOTICE "RESETGEN2: retry=%x, hostdiag=%x\n",
+		dev_notice(&instance->pdev->dev, "RESETGEN2: retry=%x, hostdiag=%x\n",
 					retry, HostDiag);
 
 		if (retry++ >= 100)
@@ -832,7 +832,7 @@ megasas_adp_reset_gen2(struct megasas_instance *instance,
 
 	}
 
-	printk(KERN_NOTICE "ADP_RESET_GEN2: HostDiag=%x\n", HostDiag);
+	dev_notice(&instance->pdev->dev, "ADP_RESET_GEN2: HostDiag=%x\n", HostDiag);
 
 	writel((HostDiag | DIAG_RESET_ADAPTER), hostdiag_offset);
 
@@ -842,7 +842,7 @@ megasas_adp_reset_gen2(struct megasas_instance *instance,
 	while ( ( HostDiag & DIAG_RESET_ADAPTER) ) {
 		msleep(100);
 		HostDiag = (u32)readl(hostdiag_offset);
-		printk(KERN_NOTICE "RESET_GEN2: retry=%x, hostdiag=%x\n",
+		dev_notice(&instance->pdev->dev, "RESET_GEN2: retry=%x, hostdiag=%x\n",
 				retry, HostDiag);
 
 		if (retry++ >= 1000)
@@ -1241,7 +1241,7 @@ megasas_build_dcdb(struct megasas_instance *instance, struct scsi_cmnd *scp,
 						      &pthru->sgl);
 
 	if (pthru->sge_count > instance->max_num_sge) {
-		printk(KERN_ERR "megasas: DCDB two many SGE NUM=%x\n",
+		dev_err(&instance->pdev->dev, "DCDB too many SGE NUM=%x\n",
 			pthru->sge_count);
 		return 0;
 	}
@@ -1382,7 +1382,7 @@ megasas_build_ldio(struct megasas_instance *instance, struct scsi_cmnd *scp,
 		ldio->sge_count = megasas_make_sgl32(instance, scp, &ldio->sgl);
 
 	if (ldio->sge_count > instance->max_num_sge) {
-		printk(KERN_ERR "megasas: build_ld_io: sge_count = %x\n",
+		dev_err(&instance->pdev->dev, "build_ld_io: sge_count = %x\n",
 			ldio->sge_count);
 		return 0;
 	}
@@ -1449,24 +1449,24 @@ megasas_dump_pending_frames(struct megasas_instance *instance)
 	u32 sgcount;
 	u32 max_cmd = instance->max_fw_cmds;
 
-	printk(KERN_ERR "\nmegasas[%d]: Dumping Frame Phys Address of all pending cmds in FW\n",instance->host->host_no);
-	printk(KERN_ERR "megasas[%d]: Total OS Pending cmds : %d\n",instance->host->host_no,atomic_read(&instance->fw_outstanding));
+	dev_err(&instance->pdev->dev, "[%d]: Dumping Frame Phys Address of all pending cmds in FW\n",instance->host->host_no);
+	dev_err(&instance->pdev->dev, "[%d]: Total OS Pending cmds : %d\n",instance->host->host_no,atomic_read(&instance->fw_outstanding));
 	if (IS_DMA64)
-		printk(KERN_ERR "\nmegasas[%d]: 64 bit SGLs were sent to FW\n",instance->host->host_no);
+		dev_err(&instance->pdev->dev, "[%d]: 64 bit SGLs were sent to FW\n",instance->host->host_no);
 	else
-		printk(KERN_ERR "\nmegasas[%d]: 32 bit SGLs were sent to FW\n",instance->host->host_no);
+		dev_err(&instance->pdev->dev, "[%d]: 32 bit SGLs were sent to FW\n",instance->host->host_no);
 
-	printk(KERN_ERR "megasas[%d]: Pending OS cmds in FW : \n",instance->host->host_no);
+	dev_err(&instance->pdev->dev, "[%d]: Pending OS cmds in FW : \n",instance->host->host_no);
 	for (i = 0; i < max_cmd; i++) {
 		cmd = instance->cmd_list[i];
 		if(!cmd->scmd)
 			continue;
-		printk(KERN_ERR "megasas[%d]: Frame addr :0x%08lx : ",instance->host->host_no,(unsigned long)cmd->frame_phys_addr);
+		dev_err(&instance->pdev->dev, "[%d]: Frame addr :0x%08lx : ",instance->host->host_no,(unsigned long)cmd->frame_phys_addr);
 		if (megasas_cmd_type(cmd->scmd) == READ_WRITE_LDIO) {
 			ldio = (struct megasas_io_frame *)cmd->frame;
 			mfi_sgl = &ldio->sgl;
 			sgcount = ldio->sge_count;
-			printk(KERN_ERR "megasas[%d]: frame count : 0x%x, Cmd : 0x%x, Tgt id : 0x%x,"
+			dev_err(&instance->pdev->dev, "[%d]: frame count : 0x%x, Cmd : 0x%x, Tgt id : 0x%x,"
 			" lba lo : 0x%x, lba_hi : 0x%x, sense_buf addr : 0x%x,sge count : 0x%x\n",
 			instance->host->host_no, cmd->frame_count, ldio->cmd, ldio->target_id,
 			le32_to_cpu(ldio->start_lba_lo), le32_to_cpu(ldio->start_lba_hi),
@@ -1476,7 +1476,7 @@ megasas_dump_pending_frames(struct megasas_instance *instance)
 			pthru = (struct megasas_pthru_frame *) cmd->frame;
 			mfi_sgl = &pthru->sgl;
 			sgcount = pthru->sge_count;
-			printk(KERN_ERR "megasas[%d]: frame count : 0x%x, Cmd : 0x%x, Tgt id : 0x%x, "
+			dev_err(&instance->pdev->dev, "[%d]: frame count : 0x%x, Cmd : 0x%x, Tgt id : 0x%x, "
 			"lun : 0x%x, cdb_len : 0x%x, data xfer len : 0x%x, sense_buf addr : 0x%x,sge count : 0x%x\n",
 			instance->host->host_no, cmd->frame_count, pthru->cmd, pthru->target_id,
 			pthru->lun, pthru->cdb_len, le32_to_cpu(pthru->data_xfer_len),
@@ -1485,27 +1485,26 @@ megasas_dump_pending_frames(struct megasas_instance *instance)
 	if(megasas_dbg_lvl & MEGASAS_DBG_LVL){
 		for (n = 0; n < sgcount; n++){
 			if (IS_DMA64)
-				printk(KERN_ERR "megasas: sgl len : 0x%x, sgl addr : 0x%llx ",
+				dev_err(&instance->pdev->dev, "sgl len : 0x%x, sgl addr : 0x%llx\n",
 					le32_to_cpu(mfi_sgl->sge64[n].length),
 					le64_to_cpu(mfi_sgl->sge64[n].phys_addr));
 			else
-				printk(KERN_ERR "megasas: sgl len : 0x%x, sgl addr : 0x%x ",
+				dev_err(&instance->pdev->dev, "sgl len : 0x%x, sgl addr : 0x%x\n",
 					le32_to_cpu(mfi_sgl->sge32[n].length),
 					le32_to_cpu(mfi_sgl->sge32[n].phys_addr));
 			}
 		}
-		printk(KERN_ERR "\n");
 	} /*for max_cmd*/
-	printk(KERN_ERR "\nmegasas[%d]: Pending Internal cmds in FW : \n",instance->host->host_no);
+	dev_err(&instance->pdev->dev, "[%d]: Pending Internal cmds in FW : \n",instance->host->host_no);
 	for (i = 0; i < max_cmd; i++) {
 
 		cmd = instance->cmd_list[i];
 
 		if(cmd->sync_cmd == 1){
-			printk(KERN_ERR "0x%08lx : ", (unsigned long)cmd->frame_phys_addr);
+			dev_err(&instance->pdev->dev, "0x%08lx : ", (unsigned long)cmd->frame_phys_addr);
 		}
 	}
-	printk(KERN_ERR "megasas[%d]: Dumping Done.\n\n",instance->host->host_no);
+	dev_err(&instance->pdev->dev, "[%d]: Dumping Done\n\n",instance->host->host_no);
 }
 
 u32
@@ -1623,7 +1622,7 @@ megasas_queue_command(struct Scsi_Host *shost, struct scsi_cmnd *scmd)
 	}
 
 	if (instance->instancet->build_and_issue_cmd(instance, scmd)) {
-		printk(KERN_ERR "megasas: Err returned from build_and_issue_cmd\n");
+		dev_err(&instance->pdev->dev, "Err returned from build_and_issue_cmd\n");
 		return SCSI_MLQUEUE_HOST_BUSY;
 	}
 
@@ -1794,7 +1793,7 @@ static void megasas_complete_cmd_dpc(unsigned long instance_addr)
 	while (consumer != producer) {
 		context = le32_to_cpu(instance->reply_queue[consumer]);
 		if (context >= instance->max_fw_cmds) {
-			printk(KERN_ERR "Unexpected context value %x\n",
+			dev_err(&instance->pdev->dev, "Unexpected context value %x\n",
 				context);
 			BUG();
 		}
@@ -1873,8 +1872,8 @@ static int megasas_get_ld_vf_affiliation_111(struct megasas_instance *instance,
 	cmd = megasas_get_cmd(instance);
 
 	if (!cmd) {
-		printk(KERN_DEBUG "megasas: megasas_get_ld_vf_affiliation_111:"
-		       "Failed to get cmd for scsi%d.\n",
+		dev_printk(KERN_DEBUG, &instance->pdev->dev, "megasas_get_ld_vf_affiliation_111:"
+		       "Failed to get cmd for scsi%d\n",
 			instance->host->host_no);
 		return -ENOMEM;
 	}
@@ -1882,8 +1881,8 @@ static int megasas_get_ld_vf_affiliation_111(struct megasas_instance *instance,
 	dcmd = &cmd->frame->dcmd;
 
 	if (!instance->vf_affiliation_111) {
-		printk(KERN_WARNING "megasas: SR-IOV: Couldn't get LD/VF "
-		       "affiliation for scsi%d.\n", instance->host->host_no);
+		dev_warn(&instance->pdev->dev, "SR-IOV: Couldn't get LD/VF "
+		       "affiliation for scsi%d\n", instance->host->host_no);
 		megasas_return_cmd(instance, cmd);
 		return -ENOMEM;
 	}
@@ -1897,8 +1896,8 @@ static int megasas_get_ld_vf_affiliation_111(struct megasas_instance *instance,
 					     sizeof(struct MR_LD_VF_AFFILIATION_111),
 					     &new_affiliation_111_h);
 		if (!new_affiliation_111) {
-			printk(KERN_DEBUG "megasas: SR-IOV: Couldn't allocate "
-			       "memory for new affiliation for scsi%d.\n",
+			dev_printk(KERN_DEBUG, &instance->pdev->dev, "SR-IOV: Couldn't allocate "
+			       "memory for new affiliation for scsi%d\n",
 			       instance->host->host_no);
 			megasas_return_cmd(instance, cmd);
 			return -ENOMEM;
@@ -1929,14 +1928,14 @@ static int megasas_get_ld_vf_affiliation_111(struct megasas_instance *instance,
 	dcmd->sgl.sge32[0].length = cpu_to_le32(
 		sizeof(struct MR_LD_VF_AFFILIATION_111));
 
-	printk(KERN_WARNING "megasas: SR-IOV: Getting LD/VF affiliation for "
+	dev_warn(&instance->pdev->dev, "SR-IOV: Getting LD/VF affiliation for "
 	       "scsi%d\n", instance->host->host_no);
 
 	megasas_issue_blocked_cmd(instance, cmd, 0);
 
 	if (dcmd->cmd_status) {
-		printk(KERN_WARNING "megasas: SR-IOV: LD/VF affiliation DCMD"
-		       " failed with status 0x%x for scsi%d.\n",
+		dev_warn(&instance->pdev->dev, "SR-IOV: LD/VF affiliation DCMD"
+		       " failed with status 0x%x for scsi%d\n",
 		       dcmd->cmd_status, instance->host->host_no);
 		retval = 1; /* Do a scan if we couldn't get affiliation */
 		goto out;
@@ -1947,9 +1946,8 @@ static int megasas_get_ld_vf_affiliation_111(struct megasas_instance *instance,
 		for (ld = 0 ; ld < new_affiliation_111->vdCount; ld++)
 			if (instance->vf_affiliation_111->map[ld].policy[thisVf] !=
 			    new_affiliation_111->map[ld].policy[thisVf]) {
-				printk(KERN_WARNING "megasas: SR-IOV: "
-				       "Got new LD/VF affiliation "
-				       "for scsi%d.\n",
+				dev_warn(&instance->pdev->dev, "SR-IOV: "
+				       "Got new LD/VF affiliation for scsi%d\n",
 				       instance->host->host_no);
 				memcpy(instance->vf_affiliation_111,
 				       new_affiliation_111,
@@ -1985,8 +1983,8 @@ static int megasas_get_ld_vf_affiliation_12(struct megasas_instance *instance,
 	cmd = megasas_get_cmd(instance);
 
 	if (!cmd) {
-		printk(KERN_DEBUG "megasas: megasas_get_ld_vf_affiliation12: "
-		       "Failed to get cmd for scsi%d.\n",
+		dev_printk(KERN_DEBUG, &instance->pdev->dev, "megasas_get_ld_vf_affiliation12: "
+		       "Failed to get cmd for scsi%d\n",
 		       instance->host->host_no);
 		return -ENOMEM;
 	}
@@ -1994,8 +1992,8 @@ static int megasas_get_ld_vf_affiliation_12(struct megasas_instance *instance,
 	dcmd = &cmd->frame->dcmd;
 
 	if (!instance->vf_affiliation) {
-		printk(KERN_WARNING "megasas: SR-IOV: Couldn't get LD/VF "
-		       "affiliation for scsi%d.\n", instance->host->host_no);
+		dev_warn(&instance->pdev->dev, "SR-IOV: Couldn't get LD/VF "
+		       "affiliation for scsi%d\n", instance->host->host_no);
 		megasas_return_cmd(instance, cmd);
 		return -ENOMEM;
 	}
@@ -2010,8 +2008,8 @@ static int megasas_get_ld_vf_affiliation_12(struct megasas_instance *instance,
 					     sizeof(struct MR_LD_VF_AFFILIATION),
 					     &new_affiliation_h);
 		if (!new_affiliation) {
-			printk(KERN_DEBUG "megasas: SR-IOV: Couldn't allocate "
-			       "memory for new affiliation for scsi%d.\n",
+			dev_printk(KERN_DEBUG, &instance->pdev->dev, "SR-IOV: Couldn't allocate "
+			       "memory for new affiliation for scsi%d\n",
 			       instance->host->host_no);
 			megasas_return_cmd(instance, cmd);
 			return -ENOMEM;
@@ -2042,14 +2040,14 @@ static int megasas_get_ld_vf_affiliation_12(struct megasas_instance *instance,
 	dcmd->sgl.sge32[0].length = cpu_to_le32((MAX_LOGICAL_DRIVES + 1) *
 		sizeof(struct MR_LD_VF_AFFILIATION));
 
-	printk(KERN_WARNING "megasas: SR-IOV: Getting LD/VF affiliation for "
+	dev_warn(&instance->pdev->dev, "SR-IOV: Getting LD/VF affiliation for "
 	       "scsi%d\n", instance->host->host_no);
 
 	megasas_issue_blocked_cmd(instance, cmd, 0);
 
 	if (dcmd->cmd_status) {
-		printk(KERN_WARNING "megasas: SR-IOV: LD/VF affiliation DCMD"
-		       " failed with status 0x%x for scsi%d.\n",
+		dev_warn(&instance->pdev->dev, "SR-IOV: LD/VF affiliation DCMD"
+		       " failed with status 0x%x for scsi%d\n",
 		       dcmd->cmd_status, instance->host->host_no);
 		retval = 1; /* Do a scan if we couldn't get affiliation */
 		goto out;
@@ -2057,8 +2055,8 @@ static int megasas_get_ld_vf_affiliation_12(struct megasas_instance *instance,
 
 	if (!initial) {
 		if (!new_affiliation->ldCount) {
-			printk(KERN_WARNING "megasas: SR-IOV: Got new LD/VF "
-			       "affiliation for passive path for scsi%d.\n",
+			dev_warn(&instance->pdev->dev, "SR-IOV: Got new LD/VF "
+			       "affiliation for passive path for scsi%d\n",
 			       instance->host->host_no);
 			retval = 1;
 			goto out;
@@ -2123,8 +2121,8 @@ static int megasas_get_ld_vf_affiliation_12(struct megasas_instance *instance,
 	}
 out:
 	if (doscan) {
-		printk(KERN_WARNING "megasas: SR-IOV: Got new LD/VF "
-		       "affiliation for scsi%d.\n", instance->host->host_no);
+		dev_warn(&instance->pdev->dev, "SR-IOV: Got new LD/VF "
+		       "affiliation for scsi%d\n", instance->host->host_no);
 		memcpy(instance->vf_affiliation, new_affiliation,
 		       new_affiliation->size);
 		retval = 1;
@@ -2164,8 +2162,8 @@ int megasas_sriov_start_heartbeat(struct megasas_instance *instance,
 	cmd = megasas_get_cmd(instance);
 
 	if (!cmd) {
-		printk(KERN_DEBUG "megasas: megasas_sriov_start_heartbeat: "
-		       "Failed to get cmd for scsi%d.\n",
+		dev_printk(KERN_DEBUG, &instance->pdev->dev, "megasas_sriov_start_heartbeat: "
+		       "Failed to get cmd for scsi%d\n",
 		       instance->host->host_no);
 		return -ENOMEM;
 	}
@@ -2178,9 +2176,9 @@ int megasas_sriov_start_heartbeat(struct megasas_instance *instance,
 					      sizeof(struct MR_CTRL_HB_HOST_MEM),
 					      &instance->hb_host_mem_h);
 		if (!instance->hb_host_mem) {
-			printk(KERN_DEBUG "megasas: SR-IOV: Couldn't allocate"
-			       " memory for heartbeat host memory for "
-			       "scsi%d.\n", instance->host->host_no);
+			dev_printk(KERN_DEBUG, &instance->pdev->dev, "SR-IOV: Couldn't allocate"
+			       " memory for heartbeat host memory for scsi%d\n",
+			       instance->host->host_no);
 			retval = -ENOMEM;
 			goto out;
 		}
@@ -2200,7 +2198,7 @@ int megasas_sriov_start_heartbeat(struct megasas_instance *instance,
 	dcmd->sgl.sge32[0].phys_addr = cpu_to_le32(instance->hb_host_mem_h);
 	dcmd->sgl.sge32[0].length = cpu_to_le32(sizeof(struct MR_CTRL_HB_HOST_MEM));
 
-	printk(KERN_WARNING "megasas: SR-IOV: Starting heartbeat for scsi%d\n",
+	dev_warn(&instance->pdev->dev, "SR-IOV: Starting heartbeat for scsi%d\n",
 	       instance->host->host_no);
 
 	if (instance->ctrl_context && !instance->mask_interrupts)
@@ -2236,7 +2234,7 @@ void megasas_sriov_heartbeat_handler(unsigned long instance_addr)
 		mod_timer(&instance->sriov_heartbeat_timer,
 			  jiffies + MEGASAS_SRIOV_HEARTBEAT_INTERVAL_VF);
 	} else {
-		printk(KERN_WARNING "megasas: SR-IOV: Heartbeat never "
+		dev_warn(&instance->pdev->dev, "SR-IOV: Heartbeat never "
 		       "completed for scsi%d\n", instance->host->host_no);
 		schedule_work(&instance->work_init);
 	}
@@ -2274,7 +2272,7 @@ static int megasas_wait_for_outstanding(struct megasas_instance *instance)
 				&clist_local);
 		spin_unlock_irqrestore(&instance->hba_lock, flags);
 
-		printk(KERN_NOTICE "megasas: HBA reset wait ...\n");
+		dev_notice(&instance->pdev->dev, "HBA reset wait ...\n");
 		for (i = 0; i < wait_time; i++) {
 			msleep(1000);
 			spin_lock_irqsave(&instance->hba_lock, flags);
@@ -2285,7 +2283,7 @@ static int megasas_wait_for_outstanding(struct megasas_instance *instance)
 		}
 
 		if (adprecovery != MEGASAS_HBA_OPERATIONAL) {
-			printk(KERN_NOTICE "megasas: reset: Stopping HBA.\n");
+			dev_notice(&instance->pdev->dev, "reset: Stopping HBA.\n");
 			spin_lock_irqsave(&instance->hba_lock, flags);
 			instance->adprecovery	= MEGASAS_HW_CRITICAL_ERROR;
 			spin_unlock_irqrestore(&instance->hba_lock, flags);
@@ -2299,14 +2297,14 @@ static int megasas_wait_for_outstanding(struct megasas_instance *instance)
 			list_del_init(&reset_cmd->list);
 			if (reset_cmd->scmd) {
 				reset_cmd->scmd->result = DID_RESET << 16;
-				printk(KERN_NOTICE "%d:%p reset [%02x]\n",
+				dev_notice(&instance->pdev->dev, "%d:%p reset [%02x]\n",
 					reset_index, reset_cmd,
 					reset_cmd->scmd->cmnd[0]);
 
 				reset_cmd->scmd->scsi_done(reset_cmd->scmd);
 				megasas_return_cmd(instance, reset_cmd);
 			} else if (reset_cmd->sync_cmd) {
-				printk(KERN_NOTICE "megasas:%p synch cmds"
+				dev_notice(&instance->pdev->dev, "%p synch cmds"
 						"reset queue\n",
 						reset_cmd);
 
@@ -2315,7 +2313,7 @@ static int megasas_wait_for_outstanding(struct megasas_instance *instance)
 						reset_cmd->frame_phys_addr,
 						0, instance->reg_set);
 			} else {
-				printk(KERN_NOTICE "megasas: %p unexpected"
+				dev_notice(&instance->pdev->dev, "%p unexpected"
 					"cmds lst\n",
 					reset_cmd);
 			}
@@ -2333,7 +2331,7 @@ static int megasas_wait_for_outstanding(struct megasas_instance *instance)
 			break;
 
 		if (!(i % MEGASAS_RESET_NOTICE_INTERVAL)) {
-			printk(KERN_NOTICE "megasas: [%2d]waiting for %d "
+			dev_notice(&instance->pdev->dev, "[%2d]waiting for %d "
 			       "commands to complete\n",i,outstanding);
 			/*
 			 * Call cmd completion routine. Cmd to be
@@ -2384,7 +2382,7 @@ static int megasas_wait_for_outstanding(struct megasas_instance *instance)
 
 	if (atomic_read(&instance->fw_outstanding) ||
 					(kill_adapter_flag == 2)) {
-		printk(KERN_NOTICE "megaraid_sas: pending cmds after reset\n");
+		dev_notice(&instance->pdev->dev, "pending cmds after reset\n");
 		/*
 		* Send signal to FW to stop processing any pending cmds.
 		* The controller will be taken offline by the OS now.
@@ -2406,7 +2404,7 @@ static int megasas_wait_for_outstanding(struct megasas_instance *instance)
 		return FAILED;
 	}
 
-	printk(KERN_NOTICE "megaraid_sas: no pending cmds after reset\n");
+	dev_notice(&instance->pdev->dev, "no pending cmds after reset\n");
 
 	return SUCCESS;
 }
@@ -2430,16 +2428,15 @@ static int megasas_generic_reset(struct scsi_cmnd *scmd)
 		 scmd->cmnd[0], scmd->retries);
 
 	if (instance->adprecovery == MEGASAS_HW_CRITICAL_ERROR) {
-		printk(KERN_ERR "megasas: cannot recover from previous reset "
-		       "failures\n");
+		dev_err(&instance->pdev->dev, "cannot recover from previous reset failures\n");
 		return FAILED;
 	}
 
 	ret_val = megasas_wait_for_outstanding(instance);
 	if (ret_val == SUCCESS)
-		printk(KERN_NOTICE "megasas: reset successful \n");
+		dev_notice(&instance->pdev->dev, "reset successful\n");
 	else
-		printk(KERN_ERR "megasas: failed to do reset\n");
+		dev_err(&instance->pdev->dev, "failed to do reset\n");
 
 	return ret_val;
 }
@@ -2597,7 +2594,7 @@ megasas_service_aen(struct megasas_instance *instance, struct megasas_cmd *cmd)
 		struct megasas_aen_event *ev;
 		ev = kzalloc(sizeof(*ev), GFP_ATOMIC);
 		if (!ev) {
-			printk(KERN_ERR "megasas_service_aen: out of memory\n");
+			dev_err(&instance->pdev->dev, "megasas_service_aen: out of memory\n");
 		} else {
 			ev->instance = instance;
 			instance->ev = ev;
@@ -2847,10 +2844,10 @@ megasas_complete_cmd(struct megasas_instance *instance, struct megasas_cmd *cmd,
 		   MR_DCMD_CTRL_EVENT_GET_INFO left over from the main kernel
 		   when booting the kdump kernel.  Ignore this command to
 		   prevent a kernel panic on shutdown of the kdump kernel. */
-		printk(KERN_WARNING "megaraid_sas: MFI_CMD_INVALID command "
-		       "completed.\n");
-		printk(KERN_WARNING "megaraid_sas: If you have a controller "
-		       "other than PERC5, please upgrade your firmware.\n");
+		dev_warn(&instance->pdev->dev, "MFI_CMD_INVALID command "
+		       "completed\n");
+		dev_warn(&instance->pdev->dev, "If you have a controller "
+		       "other than PERC5, please upgrade your firmware\n");
 		break;
 	case MFI_CMD_PD_SCSI_IO:
 	case MFI_CMD_LD_SCSI_IO:
@@ -2918,7 +2915,7 @@ megasas_complete_cmd(struct megasas_instance *instance, struct megasas_cmd *cmd,
 			break;
 
 		default:
-			printk(KERN_DEBUG "megasas: MFI FW status %#x\n",
+			dev_printk(KERN_DEBUG, &instance->pdev->dev, "MFI FW status %#x\n",
 			       hdr->cmd_status);
 			cmd->scmd->result = DID_ERROR << 16;
 			break;
@@ -2944,8 +2941,7 @@ megasas_complete_cmd(struct megasas_instance *instance, struct megasas_cmd *cmd,
 			if (cmd->frame->hdr.cmd_status != 0) {
 				if (cmd->frame->hdr.cmd_status !=
 				    MFI_STAT_NOT_FOUND)
-					printk(KERN_WARNING "megasas: map sync"
-					       "failed, status = 0x%x.\n",
+					dev_warn(&instance->pdev->dev, "map syncfailed, status = 0x%x\n",
 					       cmd->frame->hdr.cmd_status);
 				else {
 					megasas_return_cmd(instance, cmd);
@@ -2997,7 +2993,7 @@ megasas_complete_cmd(struct megasas_instance *instance, struct megasas_cmd *cmd,
 		break;
 
 	default:
-		printk("megasas: Unknown command completed! [0x%X]\n",
+		dev_info(&instance->pdev->dev, "Unknown command completed! [0x%X]\n",
 		       hdr->cmd);
 		break;
 	}
@@ -3028,14 +3024,14 @@ megasas_issue_pending_cmds_again(struct megasas_instance *instance)
 		list_del_init(&cmd->list);
 
 		if (cmd->sync_cmd || cmd->scmd) {
-			printk(KERN_NOTICE "megaraid_sas: command %p, %p:%d"
-				"detected to be pending while HBA reset.\n",
+			dev_notice(&instance->pdev->dev, "command %p, %p:%d"
+				"detected to be pending while HBA reset\n",
 					cmd, cmd->scmd, cmd->sync_cmd);
 
 			cmd->retry_for_fw_reset++;
 
 			if (cmd->retry_for_fw_reset == 3) {
-				printk(KERN_NOTICE "megaraid_sas: cmd %p, %p:%d"
+				dev_notice(&instance->pdev->dev, "cmd %p, %p:%d"
 					"was tried multiple times during reset."
 					"Shutting down the HBA\n",
 					cmd, cmd->scmd, cmd->sync_cmd);
@@ -3048,10 +3044,10 @@ megasas_issue_pending_cmds_again(struct megasas_instance *instance)
 
 		if (cmd->sync_cmd == 1) {
 			if (cmd->scmd) {
-				printk(KERN_NOTICE "megaraid_sas: unexpected"
+				dev_notice(&instance->pdev->dev, "unexpected"
 					"cmd attached to internal command!\n");
 			}
-			printk(KERN_NOTICE "megasas: %p synchronous cmd"
+			dev_notice(&instance->pdev->dev, "%p synchronous cmd"
 						"on the internal reset queue,"
 						"issue it again.\n", cmd);
 			cmd->cmd_status_drv = MFI_STAT_INVALID_STATUS;
@@ -3059,7 +3055,7 @@ megasas_issue_pending_cmds_again(struct megasas_instance *instance)
 							cmd->frame_phys_addr ,
 							0, instance->reg_set);
 		} else if (cmd->scmd) {
-			printk(KERN_NOTICE "megasas: %p scsi cmd [%02x]"
+			dev_notice(&instance->pdev->dev, "%p scsi cmd [%02x]"
 			"detected on the internal queue, issue again.\n",
 			cmd, cmd->scmd->cmnd[0]);
 
@@ -3068,14 +3064,14 @@ megasas_issue_pending_cmds_again(struct megasas_instance *instance)
 					cmd->frame_phys_addr,
 					cmd->frame_count-1, instance->reg_set);
 		} else {
-			printk(KERN_NOTICE "megasas: %p unexpected cmd on the"
+			dev_notice(&instance->pdev->dev, "%p unexpected cmd on the"
 				"internal reset defer list while re-issue!!\n",
 				cmd);
 		}
 	}
 
 	if (instance->aen_cmd) {
-		printk(KERN_NOTICE "megaraid_sas: aen_cmd in def process\n");
+		dev_notice(&instance->pdev->dev, "aen_cmd in def process\n");
 		megasas_return_cmd(instance, instance->aen_cmd);
 
 		instance->aen_cmd	= NULL;
@@ -3115,12 +3111,12 @@ megasas_internal_reset_defer_cmds(struct megasas_instance *instance)
 	for (i = 0; i < max_cmd; i++) {
 		cmd = instance->cmd_list[i];
 		if (cmd->sync_cmd == 1 || cmd->scmd) {
-			printk(KERN_NOTICE "megasas: moving cmd[%d]:%p:%d:%p"
+			dev_notice(&instance->pdev->dev, "moving cmd[%d]:%p:%d:%p"
 					"on the defer queue as internal\n",
 				defer_index, cmd, cmd->sync_cmd, cmd->scmd);
 
 			if (!list_empty(&cmd->list)) {
-				printk(KERN_NOTICE "megaraid_sas: ERROR while"
+				dev_notice(&instance->pdev->dev, "ERROR while"
 					" moving this cmd:%p, %d %p, it was"
 					"discovered on some list?\n",
 					cmd, cmd->sync_cmd, cmd->scmd);
@@ -3145,13 +3141,13 @@ process_fw_state_change_wq(struct work_struct *work)
 	unsigned long flags;
 
 	if (instance->adprecovery != MEGASAS_ADPRESET_SM_INFAULT) {
-		printk(KERN_NOTICE "megaraid_sas: error, recovery st %x \n",
+		dev_notice(&instance->pdev->dev, "error, recovery st %x\n",
 				instance->adprecovery);
 		return ;
 	}
 
 	if (instance->adprecovery == MEGASAS_ADPRESET_SM_INFAULT) {
-		printk(KERN_NOTICE "megaraid_sas: FW detected to be in fault"
+		dev_notice(&instance->pdev->dev, "FW detected to be in fault"
 					"state, restarting it...\n");
 
 		instance->instancet->disable_intr(instance);
@@ -3161,10 +3157,10 @@ process_fw_state_change_wq(struct work_struct *work)
 		instance->instancet->adp_reset(instance, instance->reg_set);
 		atomic_set(&instance->fw_reset_no_pci_access, 0 );
 
-		printk(KERN_NOTICE "megaraid_sas: FW restarted successfully,"
+		dev_notice(&instance->pdev->dev, "FW restarted successfully,"
 					"initiating next stage...\n");
 
-		printk(KERN_NOTICE "megaraid_sas: HBA recovery state machine,"
+		dev_notice(&instance->pdev->dev, "HBA recovery state machine,"
 					"state 2 starting...\n");
 
 		/*waitting for about 20 second before start the second init*/
@@ -3173,7 +3169,7 @@ process_fw_state_change_wq(struct work_struct *work)
 		}
 
 		if (megasas_transition_to_ready(instance, 1)) {
-			printk(KERN_NOTICE "megaraid_sas:adapter not ready\n");
+			dev_notice(&instance->pdev->dev, "adapter not ready\n");
 
 			atomic_set(&instance->fw_reset_no_pci_access, 1);
 			megaraid_sas_kill_hba(instance);
@@ -3238,13 +3234,13 @@ megasas_deplete_reply_queue(struct megasas_instance *instance,
 				instance->reg_set) & MFI_STATE_MASK;
 
 		if (fw_state != MFI_STATE_FAULT) {
-			printk(KERN_NOTICE "megaraid_sas: fw state:%x\n",
+			dev_notice(&instance->pdev->dev, "fw state:%x\n",
 						fw_state);
 		}
 
 		if ((fw_state == MFI_STATE_FAULT) &&
 				(instance->disableOnlineCtrlReset == 0)) {
-			printk(KERN_NOTICE "megaraid_sas: wait adp restart\n");
+			dev_notice(&instance->pdev->dev, "wait adp restart\n");
 
 			if ((instance->pdev->device ==
 					PCI_DEVICE_ID_LSI_SAS1064R) ||
@@ -3265,14 +3261,14 @@ megasas_deplete_reply_queue(struct megasas_instance *instance,
 			atomic_set(&instance->fw_outstanding, 0);
 			megasas_internal_reset_defer_cmds(instance);
 
-			printk(KERN_NOTICE "megasas: fwState=%x, stage:%d\n",
+			dev_notice(&instance->pdev->dev, "fwState=%x, stage:%d\n",
 					fw_state, instance->adprecovery);
 
 			schedule_work(&instance->work_init);
 			return IRQ_HANDLED;
 
 		} else {
-			printk(KERN_NOTICE "megasas: fwstate:%x, dis_OCR=%x\n",
+			dev_notice(&instance->pdev->dev, "fwstate:%x, dis_OCR=%x\n",
 				fw_state, instance->disableOnlineCtrlReset);
 		}
 	}
@@ -3322,7 +3318,7 @@ megasas_transition_to_ready(struct megasas_instance *instance, int ocr)
 	fw_state = abs_state & MFI_STATE_MASK;
 
 	if (fw_state != MFI_STATE_READY)
-		printk(KERN_INFO "megasas: Waiting for FW to come to ready"
+		dev_info(&instance->pdev->dev, "Waiting for FW to come to ready"
 		       " state\n");
 
 	while (fw_state != MFI_STATE_READY) {
@@ -3330,7 +3326,7 @@ megasas_transition_to_ready(struct megasas_instance *instance, int ocr)
 		switch (fw_state) {
 
 		case MFI_STATE_FAULT:
-			printk(KERN_DEBUG "megasas: FW in FAULT state!!\n");
+			dev_printk(KERN_DEBUG, &instance->pdev->dev, "FW in FAULT state!!\n");
 			if (ocr) {
 				max_wait = MEGASAS_RESET_WAIT_TIME;
 				cur_state = MFI_STATE_FAULT;
@@ -3469,7 +3465,7 @@ megasas_transition_to_ready(struct megasas_instance *instance, int ocr)
 			break;
 
 		default:
-			printk(KERN_DEBUG "megasas: Unknown state 0x%x\n",
+			dev_printk(KERN_DEBUG, &instance->pdev->dev, "Unknown state 0x%x\n",
 			       fw_state);
 			return -ENODEV;
 		}
@@ -3491,7 +3487,7 @@ megasas_transition_to_ready(struct megasas_instance *instance, int ocr)
 		 * Return error if fw_state hasn't changed after max_wait
 		 */
 		if (curr_abs_state == abs_state) {
-			printk(KERN_DEBUG "FW state [%d] hasn't changed "
+			dev_printk(KERN_DEBUG, &instance->pdev->dev, "FW state [%d] hasn't changed "
 			       "in %d secs\n", fw_state, max_wait);
 			return -ENODEV;
 		}
@@ -3499,7 +3495,7 @@ megasas_transition_to_ready(struct megasas_instance *instance, int ocr)
 		abs_state = curr_abs_state;
 		fw_state = curr_abs_state & MFI_STATE_MASK;
 	}
-	printk(KERN_INFO "megasas: FW now in Ready state\n");
+	dev_info(&instance->pdev->dev, "FW now in Ready state\n");
 
 	return 0;
 }
@@ -3594,7 +3590,7 @@ static int megasas_create_frame_pool(struct megasas_instance *instance)
 					instance->pdev, total_sz, 256, 0);
 
 	if (!instance->frame_dma_pool) {
-		printk(KERN_DEBUG "megasas: failed to setup frame pool\n");
+		dev_printk(KERN_DEBUG, &instance->pdev->dev, "failed to setup frame pool\n");
 		return -ENOMEM;
 	}
 
@@ -3602,7 +3598,7 @@ static int megasas_create_frame_pool(struct megasas_instance *instance)
 						   instance->pdev, 128, 4, 0);
 
 	if (!instance->sense_dma_pool) {
-		printk(KERN_DEBUG "megasas: failed to setup sense pool\n");
+		dev_printk(KERN_DEBUG, &instance->pdev->dev, "failed to setup sense pool\n");
 
 		pci_pool_destroy(instance->frame_dma_pool);
 		instance->frame_dma_pool = NULL;
@@ -3630,7 +3626,7 @@ static int megasas_create_frame_pool(struct megasas_instance *instance)
 		 * whatever has been allocated
 		 */
 		if (!cmd->frame || !cmd->sense) {
-			printk(KERN_DEBUG "megasas: pci_pool_alloc failed \n");
+			dev_printk(KERN_DEBUG, &instance->pdev->dev, "pci_pool_alloc failed\n");
 			megasas_teardown_frame_pool(instance);
 			return -ENOMEM;
 		}
@@ -3708,7 +3704,7 @@ int megasas_alloc_cmds(struct megasas_instance *instance)
 	instance->cmd_list = kcalloc(max_cmd, sizeof(struct megasas_cmd*), GFP_KERNEL);
 
 	if (!instance->cmd_list) {
-		printk(KERN_DEBUG "megasas: out of memory\n");
+		dev_printk(KERN_DEBUG, &instance->pdev->dev, "out of memory\n");
 		return -ENOMEM;
 	}
 
@@ -3744,7 +3740,7 @@ int megasas_alloc_cmds(struct megasas_instance *instance)
 	 * Create a frame pool and assign one frame to each cmd
 	 */
 	if (megasas_create_frame_pool(instance)) {
-		printk(KERN_DEBUG "megasas: Error creating frame DMA pool\n");
+		dev_printk(KERN_DEBUG, &instance->pdev->dev, "Error creating frame DMA pool\n");
 		megasas_free_cmds(instance);
 	}
 
@@ -3773,7 +3769,7 @@ megasas_get_pd_list(struct megasas_instance *instance)
 	cmd = megasas_get_cmd(instance);
 
 	if (!cmd) {
-		printk(KERN_DEBUG "megasas (get_pd_list): Failed to get cmd\n");
+		dev_printk(KERN_DEBUG, &instance->pdev->dev, "(get_pd_list): Failed to get cmd\n");
 		return -ENOMEM;
 	}
 
@@ -3783,7 +3779,7 @@ megasas_get_pd_list(struct megasas_instance *instance)
 		  MEGASAS_MAX_PD * sizeof(struct MR_PD_LIST), &ci_h);
 
 	if (!ci) {
-		printk(KERN_DEBUG "Failed to alloc mem for pd_list\n");
+		dev_printk(KERN_DEBUG, &instance->pdev->dev, "Failed to alloc mem for pd_list\n");
 		megasas_return_cmd(instance, cmd);
 		return -ENOMEM;
 	}
@@ -3868,7 +3864,7 @@ megasas_get_ld_list(struct megasas_instance *instance)
 	cmd = megasas_get_cmd(instance);
 
 	if (!cmd) {
-		printk(KERN_DEBUG "megasas_get_ld_list: Failed to get cmd\n");
+		dev_printk(KERN_DEBUG, &instance->pdev->dev, "megasas_get_ld_list: Failed to get cmd\n");
 		return -ENOMEM;
 	}
 
@@ -3879,7 +3875,7 @@ megasas_get_ld_list(struct megasas_instance *instance)
 				&ci_h);
 
 	if (!ci) {
-		printk(KERN_DEBUG "Failed to alloc mem in get_ld_list\n");
+		dev_printk(KERN_DEBUG, &instance->pdev->dev, "Failed to alloc mem in get_ld_list\n");
 		megasas_return_cmd(instance, cmd);
 		return -ENOMEM;
 	}
@@ -3954,8 +3950,8 @@ megasas_ld_list_query(struct megasas_instance *instance, u8 query_type)
 	cmd = megasas_get_cmd(instance);
 
 	if (!cmd) {
-		printk(KERN_WARNING
-		       "megasas:(megasas_ld_list_query): Failed to get cmd\n");
+		dev_warn(&instance->pdev->dev,
+		         "megasas_ld_list_query: Failed to get cmd\n");
 		return -ENOMEM;
 	}
 
@@ -3965,8 +3961,8 @@ megasas_ld_list_query(struct megasas_instance *instance, u8 query_type)
 				  sizeof(struct MR_LD_TARGETID_LIST), &ci_h);
 
 	if (!ci) {
-		printk(KERN_WARNING
-		       "megasas: Failed to alloc mem for ld_list_query\n");
+		dev_warn(&instance->pdev->dev,
+		         "Failed to alloc mem for ld_list_query\n");
 		megasas_return_cmd(instance, cmd);
 		return -ENOMEM;
 	}
@@ -4093,7 +4089,7 @@ megasas_get_ctrl_info(struct megasas_instance *instance)
 	cmd = megasas_get_cmd(instance);
 
 	if (!cmd) {
-		printk(KERN_DEBUG "megasas: Failed to get a free cmd\n");
+		dev_printk(KERN_DEBUG, &instance->pdev->dev, "Failed to get a free cmd\n");
 		return -ENOMEM;
 	}
 
@@ -4103,7 +4099,7 @@ megasas_get_ctrl_info(struct megasas_instance *instance)
 				  sizeof(struct megasas_ctrl_info), &ci_h);
 
 	if (!ci) {
-		printk(KERN_DEBUG "Failed to alloc mem for ctrl info\n");
+		dev_printk(KERN_DEBUG, &instance->pdev->dev, "Failed to alloc mem for ctrl info\n");
 		megasas_return_cmd(instance, cmd);
 		return -ENOMEM;
 	}
@@ -4269,7 +4265,7 @@ megasas_issue_init_mfi(struct megasas_instance *instance)
 	 */
 
 	if (megasas_issue_polled(instance, cmd)) {
-		printk(KERN_ERR "megasas: Failed to init firmware\n");
+		dev_err(&instance->pdev->dev, "Failed to init firmware\n");
 		megasas_return_cmd(instance, cmd);
 		goto fail_fw_init;
 	}
@@ -4342,7 +4338,7 @@ megasas_init_adapter_mfi(struct megasas_instance *instance)
 						     &instance->reply_queue_h);
 
 	if (!instance->reply_queue) {
-		printk(KERN_DEBUG "megasas: Out of DMA mem for reply queue\n");
+		dev_printk(KERN_DEBUG, &instance->pdev->dev, "Out of DMA mem for reply queue\n");
 		goto fail_reply_queue;
 	}
 
@@ -4361,7 +4357,7 @@ megasas_init_adapter_mfi(struct megasas_instance *instance)
 		(instance->instancet->read_fw_status_reg(reg_set) &
 		0x04000000);
 
-	printk(KERN_NOTICE "megasas_init_mfi: fw_support_ieee=%d",
+	dev_notice(&instance->pdev->dev, "megasas_init_mfi: fw_support_ieee=%d",
 			instance->fw_support_ieee);
 
 	if (instance->fw_support_ieee)
@@ -4505,7 +4501,7 @@ static int megasas_init_fw(struct megasas_instance *instance)
 	instance->bar = find_first_bit(&bar_list, sizeof(unsigned long));
 	if (pci_request_selected_regions(instance->pdev, instance->bar,
 					 "megasas: LSI")) {
-		printk(KERN_DEBUG "megasas: IO memory region busy!\n");
+		dev_printk(KERN_DEBUG, &instance->pdev->dev, "IO memory region busy!\n");
 		return -EBUSY;
 	}
 
@@ -4513,7 +4509,7 @@ static int megasas_init_fw(struct megasas_instance *instance)
 	instance->reg_set = ioremap_nocache(base_addr, 8192);
 
 	if (!instance->reg_set) {
-		printk(KERN_DEBUG "megasas: Failed to map IO mem\n");
+		dev_printk(KERN_DEBUG, &instance->pdev->dev, "Failed to map IO mem\n");
 		goto fail_ioremap;
 	}
 
@@ -4551,7 +4547,7 @@ static int megasas_init_fw(struct megasas_instance *instance)
 			(instance, instance->reg_set);
 		atomic_set(&instance->fw_reset_no_pci_access, 0);
 		dev_info(&instance->pdev->dev,
-			"megasas: FW restarted successfully from %s!\n",
+			"FW restarted successfully from %s!\n",
 			__func__);
 
 		/*waitting for about 30 second before retry*/
@@ -4652,7 +4648,7 @@ static int megasas_init_fw(struct megasas_instance *instance)
 
 	instance->instancet->enable_intr(instance);
 
-	printk(KERN_ERR "megasas: INIT adapter done\n");
+	dev_err(&instance->pdev->dev, "INIT adapter done\n");
 
 	/** for passthrough
 	* the following function will get the PD LIST.
@@ -4661,7 +4657,7 @@ static int megasas_init_fw(struct megasas_instance *instance)
 	memset(instance->pd_list, 0 ,
 		(MEGASAS_MAX_PD * sizeof(struct megasas_pd_list)));
 	if (megasas_get_pd_list(instance) < 0) {
-		printk(KERN_ERR "megasas: failed to get PD list\n");
+		dev_err(&instance->pdev->dev, "failed to get PD list\n");
 		goto fail_get_pd_list;
 	}
 
@@ -4960,7 +4956,7 @@ megasas_register_aen(struct megasas_instance *instance, u32 seq_num,
 								  aen_cmd, 30);
 
 			if (ret_val) {
-				printk(KERN_DEBUG "megasas: Failed to abort "
+				dev_printk(KERN_DEBUG, &instance->pdev->dev, "Failed to abort "
 				       "previous AEN command\n");
 				return ret_val;
 			}
@@ -5079,7 +5075,7 @@ static int megasas_io_attach(struct megasas_instance *instance)
 				(max_sectors <= MEGASAS_MAX_SECTORS)) {
 				instance->max_sectors_per_req = max_sectors;
 			} else {
-			printk(KERN_INFO "megasas: max_sectors should be > 0"
+			dev_info(&instance->pdev->dev, "max_sectors should be > 0"
 				"and <= %d (or < 1MB for GEN2 controller)\n",
 				instance->max_sectors_per_req);
 			}
@@ -5206,7 +5202,7 @@ static int megasas_probe_one(struct pci_dev *pdev,
 			       sizeof(struct megasas_instance));
 
 	if (!host) {
-		printk(KERN_DEBUG "megasas: scsi_host_alloc failed\n");
+		dev_printk(KERN_DEBUG, &pdev->dev, "scsi_host_alloc failed\n");
 		goto fail_alloc_instance;
 	}
 
@@ -5226,7 +5222,7 @@ static int megasas_probe_one(struct pci_dev *pdev,
 		instance->ctrl_context = (void *)__get_free_pages(GFP_KERNEL,
 				instance->ctrl_context_pages);
 		if (!instance->ctrl_context) {
-			printk(KERN_DEBUG "megasas: Failed to allocate "
+			dev_printk(KERN_DEBUG, &pdev->dev, "Failed to allocate "
 			       "memory for Fusion context info\n");
 			goto fail_alloc_dma_buf;
 		}
@@ -5245,7 +5241,7 @@ static int megasas_probe_one(struct pci_dev *pdev,
 					     &instance->consumer_h);
 
 		if (!instance->producer || !instance->consumer) {
-			printk(KERN_DEBUG "megasas: Failed to allocate"
+			dev_printk(KERN_DEBUG, &pdev->dev, "Failed to allocate"
 			       "memory for producer, consumer\n");
 			goto fail_alloc_dma_buf;
 		}
@@ -5276,7 +5272,7 @@ static int megasas_probe_one(struct pci_dev *pdev,
 						CRASH_DMA_BUF_SIZE,
 						&instance->crash_dump_h);
 	if (!instance->crash_dump_buf)
-		dev_err(&instance->pdev->dev, "Can't allocate Firmware "
+		dev_err(&pdev->dev, "Can't allocate Firmware "
 			"crash dump DMA buffer\n");
 
 	megasas_poll_wait_aen = 0;
@@ -5292,7 +5288,7 @@ static int megasas_probe_one(struct pci_dev *pdev,
 						    &instance->evt_detail_h);
 
 	if (!instance->evt_detail) {
-		printk(KERN_DEBUG "megasas: Failed to allocate memory for "
+		dev_printk(KERN_DEBUG, &pdev->dev, "Failed to allocate memory for "
 		       "event detail structure\n");
 		goto fail_alloc_dma_buf;
 	}
@@ -5356,7 +5352,7 @@ static int megasas_probe_one(struct pci_dev *pdev,
 				pci_alloc_consistent(pdev, sizeof(struct MR_LD_VF_AFFILIATION_111),
 						     &instance->vf_affiliation_111_h);
 			if (!instance->vf_affiliation_111)
-				printk(KERN_WARNING "megasas: Can't allocate "
+				dev_warn(&pdev->dev, "Can't allocate "
 				       "memory for VF affiliation buffer\n");
 		} else {
 			instance->vf_affiliation =
@@ -5365,7 +5361,7 @@ static int megasas_probe_one(struct pci_dev *pdev,
 						     sizeof(struct MR_LD_VF_AFFILIATION),
 						     &instance->vf_affiliation_h);
 			if (!instance->vf_affiliation)
-				printk(KERN_WARNING "megasas: Can't allocate "
+				dev_warn(&pdev->dev, "Can't allocate "
 				       "memory for VF affiliation buffer\n");
 		}
 	}
@@ -5399,7 +5395,7 @@ static int megasas_probe_one(struct pci_dev *pdev,
 	 * Initiate AEN (Asynchronous Event Notification)
 	 */
 	if (megasas_start_aen(instance)) {
-		printk(KERN_DEBUG "megasas: start aen failed\n");
+		dev_printk(KERN_DEBUG, &pdev->dev, "start aen failed\n");
 		goto fail_start_aen;
 	}
 
@@ -5607,7 +5603,7 @@ megasas_resume(struct pci_dev *pdev)
 	rval = pci_enable_device_mem(pdev);
 
 	if (rval) {
-		printk(KERN_ERR "megasas: Enable device failed\n");
+		dev_err(&pdev->dev, "Enable device failed\n");
 		return rval;
 	}
 
@@ -5686,7 +5682,7 @@ megasas_resume(struct pci_dev *pdev)
 	 * Initiate AEN (Asynchronous Event Notification)
 	 */
 	if (megasas_start_aen(instance))
-		printk(KERN_ERR "megasas: Start AEN failed\n");
+		dev_err(&instance->pdev->dev, "Start AEN failed\n");
 
 	return 0;
 
@@ -5982,14 +5978,14 @@ megasas_mgmt_fw_ioctl(struct megasas_instance *instance,
 	memset(kbuff_arr, 0, sizeof(kbuff_arr));
 
 	if (ioc->sge_count > MAX_IOCTL_SGE) {
-		printk(KERN_DEBUG "megasas: SGE count [%d] >  max limit [%d]\n",
+		dev_printk(KERN_DEBUG, &instance->pdev->dev, "SGE count [%d] >  max limit [%d]\n",
 		       ioc->sge_count, MAX_IOCTL_SGE);
 		return -EINVAL;
 	}
 
 	cmd = megasas_get_cmd(instance);
 	if (!cmd) {
-		printk(KERN_DEBUG "megasas: Failed to get a cmd packet\n");
+		dev_printk(KERN_DEBUG, &instance->pdev->dev, "Failed to get a cmd packet\n");
 		return -ENOMEM;
 	}
 
@@ -6034,8 +6030,8 @@ megasas_mgmt_fw_ioctl(struct megasas_instance *instance,
 						    ioc->sgl[i].iov_len,
 						    &buf_handle, GFP_KERNEL);
 		if (!kbuff_arr[i]) {
-			printk(KERN_DEBUG "megasas: Failed to alloc "
-			       "kernel SGL buffer for IOCTL \n");
+			dev_printk(KERN_DEBUG, &instance->pdev->dev, "Failed to alloc "
+			       "kernel SGL buffer for IOCTL\n");
 			error = -ENOMEM;
 			goto out;
 		}
@@ -6108,7 +6104,7 @@ megasas_mgmt_fw_ioctl(struct megasas_instance *instance,
 
 		if (copy_to_user((void __user *)((unsigned long)(*sense_ptr)),
 				 sense, ioc->sense_len)) {
-			printk(KERN_ERR "megasas: Failed to copy out to user "
+			dev_err(&instance->pdev->dev, "Failed to copy out to user "
 					"sense data\n");
 			error = -EFAULT;
 			goto out;
@@ -6120,7 +6116,7 @@ megasas_mgmt_fw_ioctl(struct megasas_instance *instance,
 	 */
 	if (copy_to_user(&user_ioc->frame.hdr.cmd_status,
 			 &cmd->frame->hdr.cmd_status, sizeof(u8))) {
-		printk(KERN_DEBUG "megasas: Error copying out cmd_status\n");
+		dev_printk(KERN_DEBUG, &instance->pdev->dev, "Error copying out cmd_status\n");
 		error = -EFAULT;
 	}
 
@@ -6180,7 +6176,7 @@ static int megasas_mgmt_ioctl_fw(struct file *file, unsigned long arg)
 	}
 
 	if (instance->adprecovery == MEGASAS_HW_CRITICAL_ERROR) {
-		printk(KERN_ERR "Controller in crit error\n");
+		dev_err(&instance->pdev->dev, "Controller in crit error\n");
 		error = -ENODEV;
 		goto out_kfree_ioc;
 	}
@@ -6205,7 +6201,7 @@ static int megasas_mgmt_ioctl_fw(struct file *file, unsigned long arg)
 		spin_unlock_irqrestore(&instance->hba_lock, flags);
 
 		if (!(i % MEGASAS_RESET_NOTICE_INTERVAL)) {
-			printk(KERN_NOTICE "megasas: waiting"
+			dev_notice(&instance->pdev->dev, "waiting"
 				"for controller reset to finish\n");
 		}
 
@@ -6216,7 +6212,7 @@ static int megasas_mgmt_ioctl_fw(struct file *file, unsigned long arg)
 	if (instance->adprecovery != MEGASAS_HBA_OPERATIONAL) {
 		spin_unlock_irqrestore(&instance->hba_lock, flags);
 
-		printk(KERN_ERR "megaraid_sas: timed out while"
+		dev_err(&instance->pdev->dev, "timed out while"
 			"waiting for HBA to recover\n");
 		error = -ENODEV;
 		goto out_up;
@@ -6275,7 +6271,7 @@ static int megasas_mgmt_ioctl_aen(struct file *file, unsigned long arg)
 		spin_unlock_irqrestore(&instance->hba_lock, flags);
 
 		if (!(i % MEGASAS_RESET_NOTICE_INTERVAL)) {
-			printk(KERN_NOTICE "megasas: waiting for"
+			dev_notice(&instance->pdev->dev, "waiting for"
 				"controller reset to finish\n");
 		}
 
@@ -6285,8 +6281,8 @@ static int megasas_mgmt_ioctl_aen(struct file *file, unsigned long arg)
 	spin_lock_irqsave(&instance->hba_lock, flags);
 	if (instance->adprecovery != MEGASAS_HBA_OPERATIONAL) {
 		spin_unlock_irqrestore(&instance->hba_lock, flags);
-		printk(KERN_ERR "megaraid_sas: timed out while waiting"
-				"for HBA to recover.\n");
+		dev_err(&instance->pdev->dev, "timed out while waiting"
+				"for HBA to recover\n");
 		return -ENODEV;
 	}
 	spin_unlock_irqrestore(&instance->hba_lock, flags);
@@ -6502,7 +6498,7 @@ megasas_aen_polling(struct work_struct *work)
 		if (instance->adprecovery == MEGASAS_HBA_OPERATIONAL)
 			break;
 		if (!(i % MEGASAS_RESET_NOTICE_INTERVAL)) {
-			printk(KERN_NOTICE "megasas: %s waiting for "
+			dev_notice(&instance->pdev->dev, "%s waiting for "
 			       "controller reset to finish for scsi%d\n",
 			       __func__, instance->host->host_no);
 		}
@@ -6644,13 +6640,13 @@ megasas_aen_polling(struct work_struct *work)
 			break;
 		}
 	} else {
-		printk(KERN_ERR "invalid evt_detail!\n");
+		dev_err(&instance->pdev->dev, "invalid evt_detail!\n");
 		kfree(ev);
 		return;
 	}
 
 	if (doscan) {
-		printk(KERN_INFO "megaraid_sas: scanning for scsi%d...\n",
+		dev_info(&instance->pdev->dev, "scanning for scsi%d...\n",
 		       instance->host->host_no);
 		if (megasas_get_pd_list(instance) == 0) {
 			for (i = 0; i < MEGASAS_MAX_PD_CHANNELS; i++) {
@@ -6722,7 +6718,7 @@ megasas_aen_polling(struct work_struct *work)
 	mutex_unlock(&instance->aen_mutex);
 
 	if (error)
-		printk(KERN_ERR "register aen failed error %x\n", error);
+		dev_err(&instance->pdev->dev, "register aen failed error %x\n", error);
 
 	kfree(ev);
 }
diff --git a/drivers/scsi/megaraid/megaraid_sas_fusion.c b/drivers/scsi/megaraid/megaraid_sas_fusion.c
index 46a0f8f..f0837cc 100644
--- a/drivers/scsi/megaraid/megaraid_sas_fusion.c
+++ b/drivers/scsi/megaraid/megaraid_sas_fusion.c
@@ -221,7 +221,7 @@ static void megasas_teardown_frame_pool_fusion(
 	struct megasas_cmd_fusion *cmd;
 
 	if (!fusion->sg_dma_pool || !fusion->sense_dma_pool) {
-		printk(KERN_ERR "megasas: dma pool is null. SG Pool %p, "
+		dev_err(&instance->pdev->dev, "dma pool is null. SG Pool %p, "
 		       "sense pool : %p\n", fusion->sg_dma_pool,
 		       fusion->sense_dma_pool);
 		return;
@@ -332,8 +332,7 @@ static int megasas_create_frame_pool_fusion(struct megasas_instance *instance)
 					      total_sz_chain_frame, 4,
 					      0);
 	if (!fusion->sg_dma_pool) {
-		printk(KERN_DEBUG "megasas: failed to setup request pool "
-		       "fusion\n");
+		dev_printk(KERN_DEBUG, &instance->pdev->dev, "failed to setup request pool fusion\n");
 		return -ENOMEM;
 	}
 	fusion->sense_dma_pool = pci_pool_create("megasas sense pool fusion",
@@ -341,8 +340,7 @@ static int megasas_create_frame_pool_fusion(struct megasas_instance *instance)
 						 SCSI_SENSE_BUFFERSIZE, 64, 0);
 
 	if (!fusion->sense_dma_pool) {
-		printk(KERN_DEBUG "megasas: failed to setup sense pool "
-		       "fusion\n");
+		dev_printk(KERN_DEBUG, &instance->pdev->dev, "failed to setup sense pool fusion\n");
 		pci_pool_destroy(fusion->sg_dma_pool);
 		fusion->sg_dma_pool = NULL;
 		return -ENOMEM;
@@ -366,7 +364,7 @@ static int megasas_create_frame_pool_fusion(struct megasas_instance *instance)
 		 * whatever has been allocated
 		 */
 		if (!cmd->sg_frame || !cmd->sense) {
-			printk(KERN_DEBUG "megasas: pci_pool_alloc failed\n");
+			dev_printk(KERN_DEBUG, &instance->pdev->dev, "pci_pool_alloc failed\n");
 			megasas_teardown_frame_pool_fusion(instance);
 			return -ENOMEM;
 		}
@@ -412,7 +410,7 @@ megasas_alloc_cmds_fusion(struct megasas_instance *instance)
 				   &fusion->req_frames_desc_phys, GFP_KERNEL);
 
 	if (!fusion->req_frames_desc) {
-		printk(KERN_ERR "megasas; Could not allocate memory for "
+		dev_err(&instance->pdev->dev, "Could not allocate memory for "
 		       "request_frames\n");
 		goto fail_req_desc;
 	}
@@ -423,7 +421,7 @@ megasas_alloc_cmds_fusion(struct megasas_instance *instance)
 				fusion->reply_alloc_sz * count, 16, 0);
 
 	if (!fusion->reply_frames_desc_pool) {
-		printk(KERN_ERR "megasas; Could not allocate memory for "
+		dev_err(&instance->pdev->dev, "Could not allocate memory for "
 		       "reply_frame pool\n");
 		goto fail_reply_desc;
 	}
@@ -432,7 +430,7 @@ megasas_alloc_cmds_fusion(struct megasas_instance *instance)
 		pci_pool_alloc(fusion->reply_frames_desc_pool, GFP_KERNEL,
 			       &fusion->reply_frames_desc_phys);
 	if (!fusion->reply_frames_desc) {
-		printk(KERN_ERR "megasas; Could not allocate memory for "
+		dev_err(&instance->pdev->dev, "Could not allocate memory for "
 		       "reply_frame pool\n");
 		pci_pool_destroy(fusion->reply_frames_desc_pool);
 		goto fail_reply_desc;
@@ -449,7 +447,7 @@ megasas_alloc_cmds_fusion(struct megasas_instance *instance)
 				fusion->io_frames_alloc_sz, 16, 0);
 
 	if (!fusion->io_request_frames_pool) {
-		printk(KERN_ERR "megasas: Could not allocate memory for "
+		dev_err(&instance->pdev->dev, "Could not allocate memory for "
 		       "io_request_frame pool\n");
 		goto fail_io_frames;
 	}
@@ -458,7 +456,7 @@ megasas_alloc_cmds_fusion(struct megasas_instance *instance)
 		pci_pool_alloc(fusion->io_request_frames_pool, GFP_KERNEL,
 			       &fusion->io_request_frames_phys);
 	if (!fusion->io_request_frames) {
-		printk(KERN_ERR "megasas: Could not allocate memory for "
+		dev_err(&instance->pdev->dev, "Could not allocate memory for "
 		       "io_request_frames frames\n");
 		pci_pool_destroy(fusion->io_request_frames_pool);
 		goto fail_io_frames;
@@ -473,7 +471,7 @@ megasas_alloc_cmds_fusion(struct megasas_instance *instance)
 				   * max_cmd, GFP_KERNEL);
 
 	if (!fusion->cmd_list) {
-		printk(KERN_DEBUG "megasas: out of memory. Could not alloc "
+		dev_printk(KERN_DEBUG, &instance->pdev->dev, "out of memory. Could not alloc "
 		       "memory for cmd_list_fusion\n");
 		goto fail_cmd_list;
 	}
@@ -483,7 +481,7 @@ megasas_alloc_cmds_fusion(struct megasas_instance *instance)
 		fusion->cmd_list[i] = kmalloc(sizeof(struct megasas_cmd_fusion),
 					      GFP_KERNEL);
 		if (!fusion->cmd_list[i]) {
-			printk(KERN_ERR "Could not alloc cmd list fusion\n");
+			dev_err(&instance->pdev->dev, "Could not alloc cmd list fusion\n");
 
 			for (j = 0; j < i; j++)
 				kfree(fusion->cmd_list[j]);
@@ -527,7 +525,7 @@ megasas_alloc_cmds_fusion(struct megasas_instance *instance)
 	 * Create a frame pool and assign one frame to each cmd
 	 */
 	if (megasas_create_frame_pool_fusion(instance)) {
-		printk(KERN_DEBUG "megasas: Error creating frame DMA pool\n");
+		dev_printk(KERN_DEBUG, &instance->pdev->dev, "Error creating frame DMA pool\n");
 		megasas_free_cmds_fusion(instance);
 		goto fail_req_desc;
 	}
@@ -613,7 +611,7 @@ megasas_ioc_init_fusion(struct megasas_instance *instance)
 	cmd = megasas_get_cmd(instance);
 
 	if (!cmd) {
-		printk(KERN_ERR "Could not allocate cmd for INIT Frame\n");
+		dev_err(&instance->pdev->dev, "Could not allocate cmd for INIT Frame\n");
 		ret = 1;
 		goto fail_get_cmd;
 	}
@@ -624,7 +622,7 @@ megasas_ioc_init_fusion(struct megasas_instance *instance)
 			     &ioc_init_handle, GFP_KERNEL);
 
 	if (!IOCInitMessage) {
-		printk(KERN_ERR "Could not allocate memory for "
+		dev_err(&instance->pdev->dev, "Could not allocate memory for "
 		       "IOCInitMessage\n");
 		ret = 1;
 		goto fail_fw_init;
@@ -714,7 +712,7 @@ megasas_ioc_init_fusion(struct megasas_instance *instance)
 		ret = 1;
 		goto fail_fw_init;
 	}
-	printk(KERN_ERR "megasas:IOC Init cmd success\n");
+	dev_err(&instance->pdev->dev, "Init cmd success\n");
 
 	ret = 0;
 
@@ -757,7 +755,7 @@ megasas_get_ld_map_info(struct megasas_instance *instance)
 	cmd = megasas_get_cmd(instance);
 
 	if (!cmd) {
-		printk(KERN_DEBUG "megasas: Failed to get cmd for map info.\n");
+		dev_printk(KERN_DEBUG, &instance->pdev->dev, "Failed to get cmd for map info\n");
 		return -ENOMEM;
 	}
 
@@ -776,7 +774,7 @@ megasas_get_ld_map_info(struct megasas_instance *instance)
 	ci_h = fusion->ld_map_phys[(instance->map_id & 1)];
 
 	if (!ci) {
-		printk(KERN_DEBUG "Failed to alloc mem for ld_map_info\n");
+		dev_printk(KERN_DEBUG, &instance->pdev->dev, "Failed to alloc mem for ld_map_info\n");
 		megasas_return_cmd(instance, cmd);
 		return -ENOMEM;
 	}
@@ -851,8 +849,7 @@ megasas_sync_map_info(struct megasas_instance *instance)
 	cmd = megasas_get_cmd(instance);
 
 	if (!cmd) {
-		printk(KERN_DEBUG "megasas: Failed to get cmd for sync"
-		       "info.\n");
+		dev_printk(KERN_DEBUG, &instance->pdev->dev, "Failed to get cmd for sync info\n");
 		return -ENOMEM;
 	}
 
@@ -1097,7 +1094,7 @@ megasas_init_adapter_fusion(struct megasas_instance *instance)
 						       &fusion->ld_map_phys[i],
 						       GFP_KERNEL);
 		if (!fusion->ld_map[i]) {
-			printk(KERN_ERR "megasas: Could not allocate memory "
+			dev_err(&instance->pdev->dev, "Could not allocate memory "
 			       "for map info\n");
 			goto fail_map_info;
 		}
@@ -1162,7 +1159,7 @@ map_cmd_status(struct megasas_cmd_fusion *cmd, u8 status, u8 ext_status)
 		cmd->scmd->result = DID_IMM_RETRY << 16;
 		break;
 	default:
-		printk(KERN_DEBUG "megasas: FW status %#x\n", status);
+		dev_printk(KERN_DEBUG, &cmd->instance->pdev->dev, "FW status %#x\n", status);
 		cmd->scmd->result = DID_ERROR << 16;
 		break;
 	}
@@ -1851,7 +1848,7 @@ megasas_build_io_fusion(struct megasas_instance *instance,
 					&io_request->SGL, cmd);
 
 	if (sge_count > instance->max_num_sge) {
-		printk(KERN_ERR "megasas: Error. sge_count (0x%x) exceeds "
+		dev_err(&instance->pdev->dev, "Error. sge_count (0x%x) exceeds "
 		       "max (0x%x) allowed\n", sge_count,
 		       instance->max_num_sge);
 		return 1;
@@ -1885,7 +1882,7 @@ megasas_get_request_descriptor(struct megasas_instance *instance, u16 index)
 	struct fusion_context *fusion;
 
 	if (index >= instance->max_fw_cmds) {
-		printk(KERN_ERR "megasas: Invalid SMID (0x%x)request for "
+		dev_err(&instance->pdev->dev, "Invalid SMID (0x%x)request for "
 		       "descriptor for scsi%d\n", index,
 			instance->host->host_no);
 		return NULL;
@@ -1927,7 +1924,7 @@ megasas_build_and_issue_cmd_fusion(struct megasas_instance *instance,
 
 	if (megasas_build_io_fusion(instance, scmd, cmd)) {
 		megasas_return_cmd_fusion(instance, cmd);
-		printk(KERN_ERR "megasas: Error building command.\n");
+		dev_err(&instance->pdev->dev, "Error building command\n");
 		cmd->request_desc = NULL;
 		return 1;
 	}
@@ -1937,7 +1934,7 @@ megasas_build_and_issue_cmd_fusion(struct megasas_instance *instance,
 
 	if (cmd->io_request->ChainOffset != 0 &&
 	    cmd->io_request->ChainOffset != 0xF)
-		printk(KERN_ERR "megasas: The chain offset value is not "
+		dev_err(&instance->pdev->dev, "The chain offset value is not "
 		       "correct : %x\n", cmd->io_request->ChainOffset);
 
 	/*
@@ -2025,7 +2022,7 @@ complete_cmd_fusion(struct megasas_instance *instance, u32 MSIxIndex)
 			if (reply_descript_type ==
 			    MPI2_RPY_DESCRIPT_FLAGS_SCSI_IO_SUCCESS) {
 				if (megasas_dbg_lvl == 5)
-					printk(KERN_ERR "\nmegasas: FAST Path "
+					dev_err(&instance->pdev->dev, "\nFAST Path "
 					       "IO Success\n");
 			}
 			/* Fall thru and complete IO */
@@ -2186,7 +2183,7 @@ irqreturn_t megasas_isr_fusion(int irq, void *devp)
 			else if (fw_state == MFI_STATE_FAULT)
 				schedule_work(&instance->work_init);
 		} else if (fw_state == MFI_STATE_FAULT) {
-			printk(KERN_WARNING "megaraid_sas: Iop2SysDoorbellInt"
+			dev_warn(&instance->pdev->dev, "Iop2SysDoorbellInt"
 			       "for scsi%d\n", instance->host->host_no);
 			schedule_work(&instance->work_init);
 		}
@@ -2269,7 +2266,7 @@ build_mpt_cmd(struct megasas_instance *instance, struct megasas_cmd *cmd)
 	u16 index;
 
 	if (build_mpt_mfi_pass_thru(instance, cmd)) {
-		printk(KERN_ERR "Couldn't build MFI pass thru cmd\n");
+		dev_err(&instance->pdev->dev, "Couldn't build MFI pass thru cmd\n");
 		return NULL;
 	}
 
@@ -2303,7 +2300,7 @@ megasas_issue_dcmd_fusion(struct megasas_instance *instance,
 
 	req_desc = build_mpt_cmd(instance, cmd);
 	if (!req_desc) {
-		printk(KERN_ERR "Couldn't issue MFI pass thru cmd\n");
+		dev_err(&instance->pdev->dev, "Couldn't issue MFI pass thru cmd\n");
 		return;
 	}
 	megasas_fire_cmd_fusion(instance, req_desc);
@@ -2413,7 +2410,7 @@ int megasas_wait_for_outstanding_fusion(struct megasas_instance *instance,
 		fw_state = instance->instancet->read_fw_status_reg(
 			instance->reg_set) & MFI_STATE_MASK;
 		if (fw_state == MFI_STATE_FAULT) {
-			printk(KERN_WARNING "megasas: Found FW in FAULT state,"
+			dev_warn(&instance->pdev->dev, "Found FW in FAULT state,"
 			       " will reset adapter scsi%d.\n",
 				instance->host->host_no);
 			retval = 1;
@@ -2436,7 +2433,7 @@ int megasas_wait_for_outstanding_fusion(struct megasas_instance *instance,
 				hb_seconds_missed++;
 				if (hb_seconds_missed ==
 				    (MEGASAS_SRIOV_HEARTBEAT_INTERVAL_VF/HZ)) {
-					printk(KERN_WARNING "megasas: SR-IOV:"
+					dev_warn(&instance->pdev->dev, "SR-IOV:"
 					       " Heartbeat never completed "
 					       " while polling during I/O "
 					       " timeout handling for "
@@ -2454,7 +2451,7 @@ int megasas_wait_for_outstanding_fusion(struct megasas_instance *instance,
 			goto out;
 
 		if (!(i % MEGASAS_RESET_NOTICE_INTERVAL)) {
-			printk(KERN_NOTICE "megasas: [%2d]waiting for %d "
+			dev_notice(&instance->pdev->dev, "[%2d]waiting for %d "
 			       "commands to complete for scsi%d\n", i,
 			       outstanding, instance->host->host_no);
 			megasas_complete_cmd_dpc_fusion(
@@ -2464,7 +2461,7 @@ int megasas_wait_for_outstanding_fusion(struct megasas_instance *instance,
 	}
 
 	if (atomic_read(&instance->fw_outstanding)) {
-		printk("megaraid_sas: pending commands remain after waiting, "
+		dev_err(&instance->pdev->dev, "pending commands remain after waiting, "
 		       "will reset adapter scsi%d.\n",
 		       instance->host->host_no);
 		retval = 1;
@@ -2564,7 +2561,7 @@ int megasas_reset_fusion(struct Scsi_Host *shost, int iotimeout)
 	mutex_lock(&instance->reset_mutex);
 
 	if (instance->adprecovery == MEGASAS_HW_CRITICAL_ERROR) {
-		printk(KERN_WARNING "megaraid_sas: Hardware critical error, "
+		dev_warn(&instance->pdev->dev, "Hardware critical error, "
 		       "returning FAILED for scsi%d.\n",
 			instance->host->host_no);
 		mutex_unlock(&instance->reset_mutex);
@@ -2618,7 +2615,7 @@ int megasas_reset_fusion(struct Scsi_Host *shost, int iotimeout)
 	if (megasas_wait_for_outstanding_fusion(instance, iotimeout,
 						&convert)) {
 		instance->adprecovery = MEGASAS_ADPRESET_SM_INFAULT;
-		printk(KERN_WARNING "megaraid_sas: resetting fusion "
+		dev_warn(&instance->pdev->dev, "resetting fusion "
 		       "adapter scsi%d.\n", instance->host->host_no);
 		if (convert)
 			iotimeout = 0;
@@ -2645,7 +2642,7 @@ int megasas_reset_fusion(struct Scsi_Host *shost, int iotimeout)
 		if (instance->disableOnlineCtrlReset ||
 		    (abs_state == MFI_STATE_FAULT && !reset_adapter)) {
 			/* Reset not supported, kill adapter */
-			printk(KERN_WARNING "megaraid_sas: Reset not supported"
+			dev_warn(&instance->pdev->dev, "Reset not supported"
 			       ", killing adapter scsi%d.\n",
 				instance->host->host_no);
 			megaraid_sas_kill_hba(instance);
@@ -2663,7 +2660,7 @@ int megasas_reset_fusion(struct Scsi_Host *shost, int iotimeout)
 			     instance->hb_host_mem->HB.driverCounter)) {
 					instance->hb_host_mem->HB.driverCounter =
 						instance->hb_host_mem->HB.fwCounter;
-					printk(KERN_WARNING "megasas: SR-IOV:"
+					dev_warn(&instance->pdev->dev, "SR-IOV:"
 					       "Late FW heartbeat update for "
 					       "scsi%d.\n",
 					       instance->host->host_no);
@@ -2679,8 +2676,8 @@ int megasas_reset_fusion(struct Scsi_Host *shost, int iotimeout)
 					abs_state = status_reg &
 						MFI_STATE_MASK;
 					if (abs_state == MFI_STATE_READY) {
-						printk(KERN_WARNING "megasas"
-						       ": SR-IOV: FW was found"
+						dev_warn(&instance->pdev->dev,
+						       "SR-IOV: FW was found"
 						       "to be in ready state "
 						       "for scsi%d.\n",
 						       instance->host->host_no);
@@ -2689,7 +2686,7 @@ int megasas_reset_fusion(struct Scsi_Host *shost, int iotimeout)
 					msleep(20);
 				}
 				if (abs_state != MFI_STATE_READY) {
-					printk(KERN_WARNING "megasas: SR-IOV: "
+					dev_warn(&instance->pdev->dev, "SR-IOV: "
 					       "FW not in ready state after %d"
 					       " seconds for scsi%d, status_reg = "
 					       "0x%x.\n",
@@ -2731,7 +2728,7 @@ int megasas_reset_fusion(struct Scsi_Host *shost, int iotimeout)
 				host_diag =
 				readl(&instance->reg_set->fusion_host_diag);
 				if (retry++ == 100) {
-					printk(KERN_WARNING "megaraid_sas: "
+					dev_warn(&instance->pdev->dev,
 					       "Host diag unlock failed! "
 					       "for scsi%d\n",
 						instance->host->host_no);
@@ -2754,7 +2751,7 @@ int megasas_reset_fusion(struct Scsi_Host *shost, int iotimeout)
 				host_diag =
 				readl(&instance->reg_set->fusion_host_diag);
 				if (retry++ == 1000) {
-					printk(KERN_WARNING "megaraid_sas: "
+					dev_warn(&instance->pdev->dev,
 					       "Diag reset adapter never "
 					       "cleared for scsi%d!\n",
 						instance->host->host_no);
@@ -2777,7 +2774,7 @@ int megasas_reset_fusion(struct Scsi_Host *shost, int iotimeout)
 					instance->reg_set) & MFI_STATE_MASK;
 			}
 			if (abs_state <= MFI_STATE_FW_INIT) {
-				printk(KERN_WARNING "megaraid_sas: firmware "
+				dev_warn(&instance->pdev->dev, "firmware "
 				       "state < MFI_STATE_FW_INIT, state = "
 				       "0x%x for scsi%d\n", abs_state,
 					instance->host->host_no);
@@ -2786,7 +2783,7 @@ int megasas_reset_fusion(struct Scsi_Host *shost, int iotimeout)
 
 			/* Wait for FW to become ready */
 			if (megasas_transition_to_ready(instance, 1)) {
-				printk(KERN_WARNING "megaraid_sas: Failed to "
+				dev_warn(&instance->pdev->dev, "Failed to "
 				       "transition controller to ready "
 				       "for scsi%d.\n",
 				       instance->host->host_no);
@@ -2795,7 +2792,7 @@ int megasas_reset_fusion(struct Scsi_Host *shost, int iotimeout)
 
 			megasas_reset_reply_desc(instance);
 			if (megasas_ioc_init_fusion(instance)) {
-				printk(KERN_WARNING "megaraid_sas: "
+				dev_warn(&instance->pdev->dev,
 				       "megasas_ioc_init_fusion() failed!"
 				       " for scsi%d\n",
 				       instance->host->host_no);
@@ -2836,7 +2833,7 @@ int megasas_reset_fusion(struct Scsi_Host *shost, int iotimeout)
 			}
 
 			/* Adapter reset completed successfully */
-			printk(KERN_WARNING "megaraid_sas: Reset "
+			dev_warn(&instance->pdev->dev, "Reset "
 			       "successful for scsi%d.\n",
 				instance->host->host_no);
 
@@ -2852,7 +2849,7 @@ int megasas_reset_fusion(struct Scsi_Host *shost, int iotimeout)
 			goto out;
 		}
 		/* Reset failed, kill the adapter */
-		printk(KERN_WARNING "megaraid_sas: Reset failed, killing "
+		dev_warn(&instance->pdev->dev, "Reset failed, killing "
 		       "adapter scsi%d.\n", instance->host->host_no);
 		megaraid_sas_kill_hba(instance);
 		instance->skip_heartbeat_timer_del = 1;


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH v3 3/3] megaraid_sas : fix whitespace errors
  2015-07-07 20:52 [PATCH v3 0/3] megaraid: use dev_printk() when possible Bjorn Helgaas
  2015-07-07 20:52 ` [PATCH v3 1/3] megaraid : use dev_printk " Bjorn Helgaas
  2015-07-07 20:52 ` [PATCH v3 2/3] megaraid_sas " Bjorn Helgaas
@ 2015-07-07 20:52 ` Bjorn Helgaas
  2015-07-08  9:13   ` Sumit Saxena
                     ` (2 more replies)
  2 siblings, 3 replies; 12+ messages in thread
From: Bjorn Helgaas @ 2015-07-07 20:52 UTC (permalink / raw)
  To: Kashyap Desai, Uday Lingala, Sumit Saxena
  Cc: megaraidlinux.pdl, linux-scsi, James E.J. Bottomley,
	linux-kernel, Joe Perches, Christoph Hellwig

Fix whitespace and indentation errors.  No code change.

Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
---
 drivers/scsi/megaraid/megaraid_sas_base.c |  244 ++++++++++++++---------------
 1 file changed, 118 insertions(+), 126 deletions(-)

diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c
index a9bd592..5156faa 100644
--- a/drivers/scsi/megaraid/megaraid_sas_base.c
+++ b/drivers/scsi/megaraid/megaraid_sas_base.c
@@ -273,6 +273,7 @@ static inline void
 megasas_enable_intr_xscale(struct megasas_instance *instance)
 {
 	struct megasas_register_set __iomem *regs;
+
 	regs = instance->reg_set;
 	writel(0, &(regs)->outbound_intr_mask);
 
@@ -289,6 +290,7 @@ megasas_disable_intr_xscale(struct megasas_instance *instance)
 {
 	struct megasas_register_set __iomem *regs;
 	u32 mask = 0x1f;
+
 	regs = instance->reg_set;
 	writel(mask, &regs->outbound_intr_mask);
 	/* Dummy readl to force pci flush */
@@ -313,6 +315,7 @@ megasas_clear_intr_xscale(struct megasas_register_set __iomem * regs)
 {
 	u32 status;
 	u32 mfiStatus = 0;
+
 	/*
 	 * Check if it is our interrupt
 	 */
@@ -348,6 +351,7 @@ megasas_fire_cmd_xscale(struct megasas_instance *instance,
 		struct megasas_register_set __iomem *regs)
 {
 	unsigned long flags;
+
 	spin_lock_irqsave(&instance->hba_lock, flags);
 	writel((frame_phys_addr >> 3)|(frame_count),
 	       &(regs)->inbound_queue_port);
@@ -364,6 +368,7 @@ megasas_adp_reset_xscale(struct megasas_instance *instance,
 {
 	u32 i;
 	u32 pcidata;
+
 	writel(MFI_ADP_RESET, &regs->inbound_doorbell);
 
 	for (i = 0; i < 3; i++)
@@ -402,7 +407,6 @@ static int
 megasas_check_reset_xscale(struct megasas_instance *instance,
 		struct megasas_register_set __iomem *regs)
 {
-
 	if ((instance->adprecovery != MEGASAS_HBA_OPERATIONAL) &&
 	    (le32_to_cpu(*instance->consumer) ==
 		MEGASAS_ADPRESET_INPROG_SIGN))
@@ -433,7 +437,7 @@ static struct megasas_instance_template megasas_instance_template_xscale = {
 
 /**
 *	The following functions are defined for ppc (deviceid : 0x60)
-* 	controllers
+*	controllers
 */
 
 /**
@@ -444,6 +448,7 @@ static inline void
 megasas_enable_intr_ppc(struct megasas_instance *instance)
 {
 	struct megasas_register_set __iomem *regs;
+
 	regs = instance->reg_set;
 	writel(0xFFFFFFFF, &(regs)->outbound_doorbell_clear);
 
@@ -462,6 +467,7 @@ megasas_disable_intr_ppc(struct megasas_instance *instance)
 {
 	struct megasas_register_set __iomem *regs;
 	u32 mask = 0xFFFFFFFF;
+
 	regs = instance->reg_set;
 	writel(mask, &regs->outbound_intr_mask);
 	/* Dummy readl to force pci flush */
@@ -522,6 +528,7 @@ megasas_fire_cmd_ppc(struct megasas_instance *instance,
 		struct megasas_register_set __iomem *regs)
 {
 	unsigned long flags;
+
 	spin_lock_irqsave(&instance->hba_lock, flags);
 	writel((frame_phys_addr | (frame_count<<1))|1,
 			&(regs)->inbound_queue_port);
@@ -566,6 +573,7 @@ static inline void
 megasas_enable_intr_skinny(struct megasas_instance *instance)
 {
 	struct megasas_register_set __iomem *regs;
+
 	regs = instance->reg_set;
 	writel(0xFFFFFFFF, &(regs)->outbound_intr_mask);
 
@@ -584,6 +592,7 @@ megasas_disable_intr_skinny(struct megasas_instance *instance)
 {
 	struct megasas_register_set __iomem *regs;
 	u32 mask = 0xFFFFFFFF;
+
 	regs = instance->reg_set;
 	writel(mask, &regs->outbound_intr_mask);
 	/* Dummy readl to force pci flush */
@@ -634,8 +643,8 @@ megasas_clear_intr_skinny(struct megasas_register_set __iomem *regs)
 	writel(status, &regs->outbound_intr_status);
 
 	/*
-	* dummy read to flush PCI
-	*/
+	 * dummy read to flush PCI
+	 */
 	readl(&regs->outbound_intr_status);
 
 	return mfiStatus;
@@ -654,6 +663,7 @@ megasas_fire_cmd_skinny(struct megasas_instance *instance,
 			struct megasas_register_set __iomem *regs)
 {
 	unsigned long flags;
+
 	spin_lock_irqsave(&instance->hba_lock, flags);
 	writel(upper_32_bits(frame_phys_addr),
 	       &(regs)->inbound_high_queue_port);
@@ -706,6 +716,7 @@ static inline void
 megasas_enable_intr_gen2(struct megasas_instance *instance)
 {
 	struct megasas_register_set __iomem *regs;
+
 	regs = instance->reg_set;
 	writel(0xFFFFFFFF, &(regs)->outbound_doorbell_clear);
 
@@ -725,6 +736,7 @@ megasas_disable_intr_gen2(struct megasas_instance *instance)
 {
 	struct megasas_register_set __iomem *regs;
 	u32 mask = 0xFFFFFFFF;
+
 	regs = instance->reg_set;
 	writel(mask, &regs->outbound_intr_mask);
 	/* Dummy readl to force pci flush */
@@ -750,6 +762,7 @@ megasas_clear_intr_gen2(struct megasas_register_set __iomem *regs)
 {
 	u32 status;
 	u32 mfiStatus = 0;
+
 	/*
 	 * Check if it is our interrupt
 	 */
@@ -786,6 +799,7 @@ megasas_fire_cmd_gen2(struct megasas_instance *instance,
 			struct megasas_register_set __iomem *regs)
 {
 	unsigned long flags;
+
 	spin_lock_irqsave(&instance->hba_lock, flags);
 	writel((frame_phys_addr | (frame_count<<1))|1,
 			&(regs)->inbound_queue_port);
@@ -800,10 +814,10 @@ static int
 megasas_adp_reset_gen2(struct megasas_instance *instance,
 			struct megasas_register_set __iomem *reg_set)
 {
-	u32			retry = 0 ;
-	u32			HostDiag;
-	u32 __iomem		*seq_offset = &reg_set->seq_offset;
-	u32 __iomem		*hostdiag_offset = &reg_set->host_diag;
+	u32 retry = 0 ;
+	u32 HostDiag;
+	u32 __iomem *seq_offset = &reg_set->seq_offset;
+	u32 __iomem *hostdiag_offset = &reg_set->host_diag;
 
 	if (instance->instancet == &megasas_instance_template_skinny) {
 		seq_offset = &reg_set->fusion_seq_offset;
@@ -821,7 +835,7 @@ megasas_adp_reset_gen2(struct megasas_instance *instance,
 
 	HostDiag = (u32)readl(hostdiag_offset);
 
-	while ( !( HostDiag & DIAG_WRITE_ENABLE) ) {
+	while (!(HostDiag & DIAG_WRITE_ENABLE)) {
 		msleep(100);
 		HostDiag = (u32)readl(hostdiag_offset);
 		dev_notice(&instance->pdev->dev, "RESETGEN2: retry=%x, hostdiag=%x\n",
@@ -839,7 +853,7 @@ megasas_adp_reset_gen2(struct megasas_instance *instance,
 	ssleep(10);
 
 	HostDiag = (u32)readl(hostdiag_offset);
-	while ( ( HostDiag & DIAG_RESET_ADAPTER) ) {
+	while (HostDiag & DIAG_RESET_ADAPTER) {
 		msleep(100);
 		HostDiag = (u32)readl(hostdiag_offset);
 		dev_notice(&instance->pdev->dev, "RESET_GEN2: retry=%x, hostdiag=%x\n",
@@ -904,7 +918,6 @@ int
 megasas_issue_polled(struct megasas_instance *instance, struct megasas_cmd *cmd)
 {
 	int seconds;
-
 	struct megasas_header *frame_hdr = &cmd->frame->hdr;
 
 	frame_hdr->cmd_status = MFI_CMD_STATUS_POLL_MODE;
@@ -940,6 +953,7 @@ megasas_issue_blocked_cmd(struct megasas_instance *instance,
 			  struct megasas_cmd *cmd, int timeout)
 {
 	int ret = 0;
+
 	cmd->cmd_status_drv = MFI_STAT_INVALID_STATUS;
 
 	instance->instancet->issue_dcmd(instance, cmd);
@@ -1120,7 +1134,7 @@ static u32 megasas_get_frame_count(struct megasas_instance *instance,
 	int num_cnt;
 	int sge_bytes;
 	u32 sge_sz;
-	u32 frame_count=0;
+	u32 frame_count = 0;
 
 	sge_sz = (IS_DMA64) ? sizeof(struct megasas_sge64) :
 	    sizeof(struct megasas_sge32);
@@ -1151,14 +1165,14 @@ static u32 megasas_get_frame_count(struct megasas_instance *instance,
 			num_cnt = sge_count - 3;
 	}
 
-	if(num_cnt>0){
+	if (num_cnt > 0) {
 		sge_bytes = sge_sz * num_cnt;
 
 		frame_count = (sge_bytes / MEGAMFI_FRAME_SIZE) +
 		    ((sge_bytes % MEGAMFI_FRAME_SIZE) ? 1 : 0) ;
 	}
 	/* Main frame */
-	frame_count +=1;
+	frame_count += 1;
 
 	if (frame_count > 7)
 		frame_count = 8;
@@ -1215,9 +1229,9 @@ megasas_build_dcdb(struct megasas_instance *instance, struct scsi_cmnd *scp,
 	memcpy(pthru->cdb, scp->cmnd, scp->cmd_len);
 
 	/*
-	* If the command is for the tape device, set the
-	* pthru timeout to the os layer timeout value.
-	*/
+	 * If the command is for the tape device, set the
+	 * pthru timeout to the os layer timeout value.
+	 */
 	if (scp->device->type == TYPE_TAPE) {
 		if ((scp->request->timeout / HZ) > 0xFFFF)
 			pthru->timeout = cpu_to_le16(0xFFFF);
@@ -1435,7 +1449,7 @@ inline int megasas_cmd_type(struct scsi_cmnd *cmd)
 
  /**
  * megasas_dump_pending_frames -	Dumps the frame address of all pending cmds
- *                              	in FW
+ *					in FW
  * @instance:				Adapter soft state
  */
 static inline void
@@ -1459,7 +1473,7 @@ megasas_dump_pending_frames(struct megasas_instance *instance)
 	dev_err(&instance->pdev->dev, "[%d]: Pending OS cmds in FW : \n",instance->host->host_no);
 	for (i = 0; i < max_cmd; i++) {
 		cmd = instance->cmd_list[i];
-		if(!cmd->scmd)
+		if (!cmd->scmd)
 			continue;
 		dev_err(&instance->pdev->dev, "[%d]: Frame addr :0x%08lx : ",instance->host->host_no,(unsigned long)cmd->frame_phys_addr);
 		if (megasas_cmd_type(cmd->scmd) == READ_WRITE_LDIO) {
@@ -1471,8 +1485,7 @@ megasas_dump_pending_frames(struct megasas_instance *instance)
 			instance->host->host_no, cmd->frame_count, ldio->cmd, ldio->target_id,
 			le32_to_cpu(ldio->start_lba_lo), le32_to_cpu(ldio->start_lba_hi),
 			le32_to_cpu(ldio->sense_buf_phys_addr_lo), sgcount);
-		}
-		else {
+		} else {
 			pthru = (struct megasas_pthru_frame *) cmd->frame;
 			mfi_sgl = &pthru->sgl;
 			sgcount = pthru->sge_count;
@@ -1482,16 +1495,16 @@ megasas_dump_pending_frames(struct megasas_instance *instance)
 			pthru->lun, pthru->cdb_len, le32_to_cpu(pthru->data_xfer_len),
 			le32_to_cpu(pthru->sense_buf_phys_addr_lo), sgcount);
 		}
-	if(megasas_dbg_lvl & MEGASAS_DBG_LVL){
-		for (n = 0; n < sgcount; n++){
-			if (IS_DMA64)
-				dev_err(&instance->pdev->dev, "sgl len : 0x%x, sgl addr : 0x%llx\n",
-					le32_to_cpu(mfi_sgl->sge64[n].length),
-					le64_to_cpu(mfi_sgl->sge64[n].phys_addr));
-			else
-				dev_err(&instance->pdev->dev, "sgl len : 0x%x, sgl addr : 0x%x\n",
-					le32_to_cpu(mfi_sgl->sge32[n].length),
-					le32_to_cpu(mfi_sgl->sge32[n].phys_addr));
+		if (megasas_dbg_lvl & MEGASAS_DBG_LVL) {
+			for (n = 0; n < sgcount; n++) {
+				if (IS_DMA64)
+					dev_err(&instance->pdev->dev, "sgl len : 0x%x, sgl addr : 0x%llx\n",
+						le32_to_cpu(mfi_sgl->sge64[n].length),
+						le64_to_cpu(mfi_sgl->sge64[n].phys_addr));
+				else
+					dev_err(&instance->pdev->dev, "sgl len : 0x%x, sgl addr : 0x%x\n",
+						le32_to_cpu(mfi_sgl->sge32[n].length),
+						le32_to_cpu(mfi_sgl->sge32[n].phys_addr));
 			}
 		}
 	} /*for max_cmd*/
@@ -1500,9 +1513,8 @@ megasas_dump_pending_frames(struct megasas_instance *instance)
 
 		cmd = instance->cmd_list[i];
 
-		if(cmd->sync_cmd == 1){
+		if (cmd->sync_cmd == 1)
 			dev_err(&instance->pdev->dev, "0x%08lx : ", (unsigned long)cmd->frame_phys_addr);
-		}
 	}
 	dev_err(&instance->pdev->dev, "[%d]: Dumping Done\n\n",instance->host->host_no);
 }
@@ -1650,8 +1662,8 @@ static struct megasas_instance *megasas_lookup_instance(u16 host_no)
 static int megasas_slave_configure(struct scsi_device *sdev)
 {
 	/*
-	* The RAID firmware may require extended timeouts.
-	*/
+	 * The RAID firmware may require extended timeouts.
+	 */
 	blk_queue_rq_timeout(sdev->request_queue,
 		MEGASAS_DEFAULT_CMD_TIMEOUT * HZ);
 
@@ -1660,8 +1672,9 @@ static int megasas_slave_configure(struct scsi_device *sdev)
 
 static int megasas_slave_alloc(struct scsi_device *sdev)
 {
-	u16             pd_index = 0;
+	u16 pd_index = 0;
 	struct megasas_instance *instance ;
+
 	instance = megasas_lookup_instance(sdev->host->host_no);
 	if (sdev->channel < MEGASAS_MAX_PD_CHANNELS) {
 		/*
@@ -1727,8 +1740,7 @@ void megaraid_sas_kill_hba(struct megasas_instance *instance)
 		(instance->pdev->device == PCI_DEVICE_ID_LSI_PLASMA) ||
 		(instance->pdev->device == PCI_DEVICE_ID_LSI_INVADER) ||
 		(instance->pdev->device == PCI_DEVICE_ID_LSI_FURY)) {
-		writel(MFI_STOP_ADP,
-			&instance->reg_set->doorbell);
+		writel(MFI_STOP_ADP, &instance->reg_set->doorbell);
 		/* Flush */
 		readl(&instance->reg_set->doorbell);
 		if (instance->mpio && instance->requestorId)
@@ -1782,7 +1794,7 @@ static void megasas_complete_cmd_dpc(unsigned long instance_addr)
 	unsigned long flags;
 
 	/* If we have already declared adapter dead, donot complete cmds */
-	if (instance->adprecovery == MEGASAS_HW_CRITICAL_ERROR )
+	if (instance->adprecovery == MEGASAS_HW_CRITICAL_ERROR)
 		return;
 
 	spin_lock_irqsave(&instance->completion_lock, flags);
@@ -2285,14 +2297,14 @@ static int megasas_wait_for_outstanding(struct megasas_instance *instance)
 		if (adprecovery != MEGASAS_HBA_OPERATIONAL) {
 			dev_notice(&instance->pdev->dev, "reset: Stopping HBA.\n");
 			spin_lock_irqsave(&instance->hba_lock, flags);
-			instance->adprecovery	= MEGASAS_HW_CRITICAL_ERROR;
+			instance->adprecovery = MEGASAS_HW_CRITICAL_ERROR;
 			spin_unlock_irqrestore(&instance->hba_lock, flags);
 			return FAILED;
 		}
 
-		reset_index	= 0;
+		reset_index = 0;
 		while (!list_empty(&clist_local)) {
-			reset_cmd	= list_entry((&clist_local)->next,
+			reset_cmd = list_entry((&clist_local)->next,
 						struct megasas_cmd, list);
 			list_del_init(&reset_cmd->list);
 			if (reset_cmd->scmd) {
@@ -2324,7 +2336,6 @@ static int megasas_wait_for_outstanding(struct megasas_instance *instance)
 	}
 
 	for (i = 0; i < resetwaittime; i++) {
-
 		int outstanding = atomic_read(&instance->fw_outstanding);
 
 		if (!outstanding)
@@ -2363,10 +2374,8 @@ static int megasas_wait_for_outstanding(struct megasas_instance *instance)
 		i++;
 	} while (i <= 3);
 
-	if (atomic_read(&instance->fw_outstanding) &&
-					!kill_adapter_flag) {
+	if (atomic_read(&instance->fw_outstanding) && !kill_adapter_flag) {
 		if (instance->disableOnlineCtrlReset == 0) {
-
 			megasas_do_ocr(instance);
 
 			/* wait for 5 secs to let FW finish the pending cmds */
@@ -2384,9 +2393,9 @@ static int megasas_wait_for_outstanding(struct megasas_instance *instance)
 					(kill_adapter_flag == 2)) {
 		dev_notice(&instance->pdev->dev, "pending cmds after reset\n");
 		/*
-		* Send signal to FW to stop processing any pending cmds.
-		* The controller will be taken offline by the OS now.
-		*/
+		 * Send signal to FW to stop processing any pending cmds.
+		 * The controller will be taken offline by the OS now.
+		 */
 		if ((instance->pdev->device ==
 			PCI_DEVICE_ID_LSI_SAS0073SKINNY) ||
 			(instance->pdev->device ==
@@ -2399,7 +2408,7 @@ static int megasas_wait_for_outstanding(struct megasas_instance *instance)
 		}
 		megasas_dump_pending_frames(instance);
 		spin_lock_irqsave(&instance->hba_lock, flags);
-		instance->adprecovery	= MEGASAS_HW_CRITICAL_ERROR;
+		instance->adprecovery = MEGASAS_HW_CRITICAL_ERROR;
 		spin_unlock_irqrestore(&instance->hba_lock, flags);
 		return FAILED;
 	}
@@ -2478,14 +2487,10 @@ blk_eh_timer_return megasas_reset_timer(struct scsi_cmnd *scmd)
  */
 static int megasas_reset_device(struct scsi_cmnd *scmd)
 {
-	int ret;
-
 	/*
 	 * First wait for all commands to complete
 	 */
-	ret = megasas_generic_reset(scmd);
-
-	return ret;
+	return megasas_generic_reset(scmd);
 }
 
 /**
@@ -2495,6 +2500,7 @@ static int megasas_reset_bus_host(struct scsi_cmnd *scmd)
 {
 	int ret;
 	struct megasas_instance *instance;
+
 	instance = (struct megasas_instance *)scmd->device->host->hostdata;
 
 	/*
@@ -2513,7 +2519,7 @@ static int megasas_reset_bus_host(struct scsi_cmnd *scmd)
 
 /**
  * megasas_bios_param - Returns disk geometry for a disk
- * @sdev: 		device handle
+ * @sdev:		device handle
  * @bdev:		block device
  * @capacity:		drive capacity
  * @geom:		geometry parameters
@@ -2526,6 +2532,7 @@ megasas_bios_param(struct scsi_device *sdev, struct block_device *bdev,
 	int sectors;
 	sector_t cylinders;
 	unsigned long tmp;
+
 	/* Default heads (64) & sectors (32) */
 	heads = 64;
 	sectors = 32;
@@ -2572,6 +2579,7 @@ static void
 megasas_service_aen(struct megasas_instance *instance, struct megasas_cmd *cmd)
 {
 	unsigned long flags;
+
 	/*
 	 * Don't signal app if it is just an aborted previously registered aen
 	 */
@@ -2592,6 +2600,7 @@ megasas_service_aen(struct megasas_instance *instance, struct megasas_cmd *cmd)
 	if ((instance->unload == 0) &&
 		((instance->issuepend_done == 1))) {
 		struct megasas_aen_event *ev;
+
 		ev = kzalloc(sizeof(*ev), GFP_ATOMIC);
 		if (!ev) {
 			dev_err(&instance->pdev->dev, "megasas_service_aen: out of memory\n");
@@ -2651,8 +2660,7 @@ megasas_fw_crash_buffer_show(struct device *cdev,
 
 	buff_addr = (unsigned long) buf;
 
-	if (buff_offset >
-		(instance->fw_crash_buffer_size * dmachunk)) {
+	if (buff_offset > (instance->fw_crash_buffer_size * dmachunk)) {
 		dev_err(&instance->pdev->dev,
 			"Firmware crash dump offset is out of range\n");
 		spin_unlock_irqrestore(&instance->crashdump_lock, flags);
@@ -2664,7 +2672,7 @@ megasas_fw_crash_buffer_show(struct device *cdev,
 
 	src_addr = (unsigned long)instance->crash_buf[buff_offset / dmachunk] +
 		(buff_offset % dmachunk);
-	memcpy(buf, (void *)src_addr,  size);
+	memcpy(buf, (void *)src_addr, size);
 	spin_unlock_irqrestore(&instance->crashdump_lock, flags);
 
 	return size;
@@ -2724,6 +2732,7 @@ megasas_fw_crash_state_show(struct device *cdev,
 	struct Scsi_Host *shost = class_to_shost(cdev);
 	struct megasas_instance *instance =
 		(struct megasas_instance *) shost->hostdata;
+
 	return snprintf(buf, PAGE_SIZE, "%d\n", instance->fw_crash_state);
 }
 
@@ -2808,8 +2817,6 @@ megasas_complete_abort(struct megasas_instance *instance,
 		cmd->cmd_status_drv = 0;
 		wake_up(&instance->abort_cmd_wait_q);
 	}
-
-	return;
 }
 
 /**
@@ -2817,10 +2824,10 @@ megasas_complete_abort(struct megasas_instance *instance,
  * @instance:			Adapter soft state
  * @cmd:			Command to be completed
  * @alt_status:			If non-zero, use this value as status to
- * 				SCSI mid-layer instead of the value returned
- * 				by the FW. This should be used if caller wants
- * 				an alternate status (as in the case of aborted
- * 				commands)
+ *				SCSI mid-layer instead of the value returned
+ *				by the FW. This should be used if caller wants
+ *				an alternate status (as in the case of aborted
+ *				commands)
  */
 void
 megasas_complete_cmd(struct megasas_instance *instance, struct megasas_cmd *cmd,
@@ -3001,7 +3008,7 @@ megasas_complete_cmd(struct megasas_instance *instance, struct megasas_cmd *cmd,
 
 /**
  * megasas_issue_pending_cmds_again -	issue all pending cmds
- *                              	in FW again because of the fw reset
+ *					in FW again because of the fw reset
  * @instance:				Adapter soft state
  */
 static inline void
@@ -3019,7 +3026,7 @@ megasas_issue_pending_cmds_again(struct megasas_instance *instance)
 	spin_unlock_irqrestore(&instance->hba_lock, flags);
 
 	while (!list_empty(&clist_local)) {
-		cmd	= list_entry((&clist_local)->next,
+		cmd = list_entry((&clist_local)->next,
 					struct megasas_cmd, list);
 		list_del_init(&cmd->list);
 
@@ -3052,7 +3059,7 @@ megasas_issue_pending_cmds_again(struct megasas_instance *instance)
 						"issue it again.\n", cmd);
 			cmd->cmd_status_drv = MFI_STAT_INVALID_STATUS;
 			instance->instancet->fire_cmd(instance,
-							cmd->frame_phys_addr ,
+							cmd->frame_phys_addr,
 							0, instance->reg_set);
 		} else if (cmd->scmd) {
 			dev_notice(&instance->pdev->dev, "%p scsi cmd [%02x]"
@@ -3074,12 +3081,12 @@ megasas_issue_pending_cmds_again(struct megasas_instance *instance)
 		dev_notice(&instance->pdev->dev, "aen_cmd in def process\n");
 		megasas_return_cmd(instance, instance->aen_cmd);
 
-		instance->aen_cmd	= NULL;
+		instance->aen_cmd = NULL;
 	}
 
 	/*
-	* Initiate AEN (Asynchronous Event Notification)
-	*/
+	 * Initiate AEN (Asynchronous Event Notification)
+	 */
 	seq_num = instance->last_seq_num;
 	class_locale.members.reserved = 0;
 	class_locale.members.locale = MR_EVT_LOCALE_ALL;
@@ -3106,7 +3113,7 @@ megasas_internal_reset_defer_cmds(struct megasas_instance *instance)
 	u32 defer_index;
 	unsigned long flags;
 
-	defer_index     = 0;
+	defer_index = 0;
 	spin_lock_irqsave(&instance->mfi_pool_lock, flags);
 	for (i = 0; i < max_cmd; i++) {
 		cmd = instance->cmd_list[i];
@@ -3155,7 +3162,7 @@ process_fw_state_change_wq(struct work_struct *work)
 
 		atomic_set(&instance->fw_reset_no_pci_access, 1);
 		instance->instancet->adp_reset(instance, instance->reg_set);
-		atomic_set(&instance->fw_reset_no_pci_access, 0 );
+		atomic_set(&instance->fw_reset_no_pci_access, 0);
 
 		dev_notice(&instance->pdev->dev, "FW restarted successfully,"
 					"initiating next stage...\n");
@@ -3163,7 +3170,7 @@ process_fw_state_change_wq(struct work_struct *work)
 		dev_notice(&instance->pdev->dev, "HBA recovery state machine,"
 					"state 2 starting...\n");
 
-		/*waitting for about 20 second before start the second init*/
+		/* waiting for about 20 second before start the second init */
 		for (wait = 0; wait < 30; wait++) {
 			msleep(1000);
 		}
@@ -3196,15 +3203,14 @@ process_fw_state_change_wq(struct work_struct *work)
 		megasas_issue_pending_cmds_again(instance);
 		instance->issuepend_done = 1;
 	}
-	return ;
 }
 
 /**
  * megasas_deplete_reply_queue -	Processes all completed commands
  * @instance:				Adapter soft state
  * @alt_status:				Alternate status to be returned to
- * 					SCSI mid-layer instead of the status
- * 					returned by the FW
+ *					SCSI mid-layer instead of the status
+ *					returned by the FW
  * Note: this must be called with hba lock held
  */
 static int
@@ -3284,13 +3290,13 @@ static irqreturn_t megasas_isr(int irq, void *devp)
 	struct megasas_irq_context *irq_context = devp;
 	struct megasas_instance *instance = irq_context->instance;
 	unsigned long flags;
-	irqreturn_t	rc;
+	irqreturn_t rc;
 
 	if (atomic_read(&instance->fw_reset_no_pci_access))
 		return IRQ_HANDLED;
 
 	spin_lock_irqsave(&instance->hba_lock, flags);
-	rc =  megasas_deplete_reply_queue(instance, DID_OK);
+	rc = megasas_deplete_reply_queue(instance, DID_OK);
 	spin_unlock_irqrestore(&instance->hba_lock, flags);
 
 	return rc;
@@ -3566,9 +3572,8 @@ static int megasas_create_frame_pool(struct megasas_instance *instance)
 	sge_sz = (IS_DMA64) ? sizeof(struct megasas_sge64) :
 	    sizeof(struct megasas_sge32);
 
-	if (instance->flag_ieee) {
+	if (instance->flag_ieee)
 		sge_sz = sizeof(struct megasas_sge_skinny);
-	}
 
 	/*
 	 * For MFI controllers.
@@ -3652,6 +3657,7 @@ static int megasas_create_frame_pool(struct megasas_instance *instance)
 void megasas_free_cmds(struct megasas_instance *instance)
 {
 	int i;
+
 	/* First free the MFI frame pool */
 	megasas_teardown_frame_pool(instance);
 
@@ -3807,12 +3813,12 @@ megasas_get_pd_list(struct megasas_instance *instance)
 		ret = megasas_issue_polled(instance, cmd);
 
 	/*
-	* the following function will get the instance PD LIST.
-	*/
+	 * the following function will get the instance PD LIST.
+	 */
 
 	pd_addr = ci->addr;
 
-	if ( ret == 0 &&
+	if (ret == 0 &&
 	     (le32_to_cpu(ci->count) <
 		  (MEGASAS_MAX_PD_CHANNELS * MEGASAS_MAX_DEV_PER_CHANNEL))) {
 
@@ -4048,11 +4054,11 @@ static void megasas_update_ext_vd_details(struct megasas_instance *instance)
 		instance->supportmax256vd ? "Extended VD(240 VD)firmware" :
 		"Legacy(64 VD) firmware");
 
-	old_map_sz =  sizeof(struct MR_FW_RAID_MAP) +
+	old_map_sz = sizeof(struct MR_FW_RAID_MAP) +
 				(sizeof(struct MR_LD_SPAN_MAP) *
 				(instance->fw_supported_vd_count - 1));
-	new_map_sz =  sizeof(struct MR_FW_RAID_MAP_EXT);
-	fusion->drv_map_sz =  sizeof(struct MR_DRV_RAID_MAP) +
+	new_map_sz = sizeof(struct MR_FW_RAID_MAP_EXT);
+	fusion->drv_map_sz = sizeof(struct MR_DRV_RAID_MAP) +
 				(sizeof(struct MR_LD_SPAN_MAP) *
 				(instance->drv_supported_vd_count - 1));
 
@@ -4063,7 +4069,6 @@ static void megasas_update_ext_vd_details(struct megasas_instance *instance)
 		fusion->current_map_sz = new_map_sz;
 	else
 		fusion->current_map_sz = old_map_sz;
-
 }
 
 /**
@@ -4210,9 +4215,7 @@ static int
 megasas_issue_init_mfi(struct megasas_instance *instance)
 {
 	__le32 context;
-
 	struct megasas_cmd *cmd;
-
 	struct megasas_init_frame *init_frame;
 	struct megasas_init_queue_info *initq_info;
 	dma_addr_t init_frame_h;
@@ -4651,10 +4654,9 @@ static int megasas_init_fw(struct megasas_instance *instance)
 	dev_err(&instance->pdev->dev, "INIT adapter done\n");
 
 	/** for passthrough
-	* the following function will get the PD LIST.
-	*/
-
-	memset(instance->pd_list, 0 ,
+	 * the following function will get the PD LIST.
+	 */
+	memset(instance->pd_list, 0,
 		(MEGASAS_MAX_PD * sizeof(struct megasas_pd_list)));
 	if (megasas_get_pd_list(instance) < 0) {
 		dev_err(&instance->pdev->dev, "failed to get PD list\n");
@@ -4682,7 +4684,7 @@ static int megasas_init_fw(struct megasas_instance *instance)
 		le16_to_cpu(ctrl_info->max_strips_per_io);
 	max_sectors_2 = le32_to_cpu(ctrl_info->max_request_size);
 
-	tmp_sectors = min_t(u32, max_sectors_1 , max_sectors_2);
+	tmp_sectors = min_t(u32, max_sectors_1, max_sectors_2);
 
 	instance->disableOnlineCtrlReset =
 	ctrl_info->properties.OnOffProperties.disableOnlineCtrlReset;
@@ -5047,7 +5049,7 @@ static int megasas_start_aen(struct megasas_instance *instance)
 static int megasas_io_attach(struct megasas_instance *instance)
 {
 	struct Scsi_Host *host = instance->host;
-	u32		error;
+	u32 error;
 
 	/*
 	 * Export parameters required by SCSI mid-layer
@@ -5122,7 +5124,7 @@ static int
 megasas_set_dma_mask(struct pci_dev *pdev)
 {
 	/*
-	 * All our contollers are capable of performing 64-bit DMA
+	 * All our controllers are capable of performing 64-bit DMA
 	 */
 	if (IS_DMA64) {
 		if (pci_set_dma_mask(pdev, DMA_BIT_MASK(64)) != 0) {
@@ -5208,7 +5210,7 @@ static int megasas_probe_one(struct pci_dev *pdev,
 
 	instance = (struct megasas_instance *)host->hostdata;
 	memset(instance, 0, sizeof(*instance));
-	atomic_set( &instance->fw_reset_no_pci_access, 0 );
+	atomic_set(&instance->fw_reset_no_pci_access, 0);
 	instance->pdev = pdev;
 
 	switch (instance->pdev->device) {
@@ -5405,8 +5407,8 @@ static int megasas_probe_one(struct pci_dev *pdev,
 
 	return 0;
 
-      fail_start_aen:
-      fail_io_attach:
+fail_start_aen:
+fail_io_attach:
 	megasas_mgmt_info.count--;
 	megasas_mgmt_info.instance[megasas_mgmt_info.max_index] = NULL;
 	megasas_mgmt_info.max_index--;
@@ -5424,7 +5426,7 @@ static int megasas_probe_one(struct pci_dev *pdev,
 	if (instance->msix_vectors)
 		pci_disable_msix(instance->pdev);
 fail_init_mfi:
-      fail_alloc_dma_buf:
+fail_alloc_dma_buf:
 	if (instance->evt_detail)
 		pci_free_consistent(pdev, sizeof(struct megasas_evt_detail),
 				    instance->evt_detail,
@@ -5438,8 +5440,8 @@ fail_init_mfi:
 				    instance->consumer_h);
 	scsi_host_put(host);
 
-      fail_alloc_instance:
-      fail_set_dma_mask:
+fail_alloc_instance:
+fail_set_dma_mask:
 	pci_disable_device(pdev);
 
 	return -ENODEV;
@@ -5481,8 +5483,6 @@ static void megasas_flush_cache(struct megasas_instance *instance)
 			" from %s\n", __func__);
 
 	megasas_return_cmd(instance, cmd);
-
-	return;
 }
 
 /**
@@ -5528,8 +5528,6 @@ static void megasas_shutdown_controller(struct megasas_instance *instance,
 			"from %s\n", __func__);
 
 	megasas_return_cmd(instance, cmd);
-
-	return;
 }
 
 #ifdef CONFIG_PM
@@ -5835,8 +5833,6 @@ static void megasas_detach_one(struct pci_dev *pdev)
 	scsi_host_put(host);
 
 	pci_disable_device(pdev);
-
-	return;
 }
 
 /**
@@ -5905,11 +5901,11 @@ static unsigned int megasas_mgmt_poll(struct file *file, poll_table *wait)
 {
 	unsigned int mask;
 	unsigned long flags;
+
 	poll_wait(file, &megasas_poll_wait, wait);
 	spin_lock_irqsave(&poll_aen_lock, flags);
 	if (megasas_poll_wait_aen)
-		mask =   (POLLIN | POLLRDNORM);
-
+		mask = (POLLIN | POLLRDNORM);
 	else
 		mask = 0;
 	megasas_poll_wait_aen = 0;
@@ -5923,8 +5919,7 @@ static unsigned int megasas_mgmt_poll(struct file *file, poll_table *wait)
  * @cmd:	MFI command frame
  */
 
-static int megasas_set_crash_dump_params_ioctl(
-	struct megasas_cmd *cmd)
+static int megasas_set_crash_dump_params_ioctl(struct megasas_cmd *cmd)
 {
 	struct megasas_instance *local_instance;
 	int i, error = 0;
@@ -6120,7 +6115,7 @@ megasas_mgmt_fw_ioctl(struct megasas_instance *instance,
 		error = -EFAULT;
 	}
 
-      out:
+out:
 	if (sense) {
 		dma_free_coherent(&instance->pdev->dev, ioc->sense_len,
 				    sense, sense_handle);
@@ -6220,10 +6215,10 @@ static int megasas_mgmt_ioctl_fw(struct file *file, unsigned long arg)
 	spin_unlock_irqrestore(&instance->hba_lock, flags);
 
 	error = megasas_mgmt_fw_ioctl(instance, user_ioc, ioc);
-      out_up:
+out_up:
 	up(&instance->ioctl_sem);
 
-      out_kfree_ioc:
+out_kfree_ioc:
 	kfree(ioc);
 	return error;
 }
@@ -6458,7 +6453,8 @@ static ssize_t
 megasas_sysfs_set_dbg_lvl(struct device_driver *dd, const char *buf, size_t count)
 {
 	int retval = count;
-	if(sscanf(buf,"%u",&megasas_dbg_lvl)<1){
+
+	if (sscanf(buf,"%u",&megasas_dbg_lvl) < 1) {
 		printk(KERN_ERR "megasas: could not set dbg_lvl\n");
 		retval = -EINVAL;
 	}
@@ -6520,14 +6516,12 @@ megasas_aen_polling(struct work_struct *work)
 				pd_index =
 				(i * MEGASAS_MAX_DEV_PER_CHANNEL) + j;
 
-				sdev1 =
-				scsi_device_lookup(host, i, j, 0);
+				sdev1 = scsi_device_lookup(host, i, j, 0);
 
 				if (instance->pd_list[pd_index].driveState
 						== MR_PD_STATE_SYSTEM) {
-						if (!sdev1) {
+					if (!sdev1)
 						scsi_add_device(host, i, j, 0);
-						}
 
 					if (sdev1)
 						scsi_device_put(sdev1);
@@ -6548,14 +6542,12 @@ megasas_aen_polling(struct work_struct *work)
 				pd_index =
 				(i * MEGASAS_MAX_DEV_PER_CHANNEL) + j;
 
-				sdev1 =
-				scsi_device_lookup(host, i, j, 0);
+				sdev1 = scsi_device_lookup(host, i, j, 0);
 
 				if (instance->pd_list[pd_index].driveState
 					== MR_PD_STATE_SYSTEM) {
-					if (sdev1) {
+					if (sdev1)
 						scsi_device_put(sdev1);
-					}
 				} else {
 					if (sdev1) {
 						scsi_remove_device(sdev1);
@@ -6701,7 +6693,7 @@ megasas_aen_polling(struct work_struct *work)
 		}
 	}
 
-	if ( instance->aen_cmd != NULL ) {
+	if (instance->aen_cmd != NULL) {
 		kfree(ev);
 		return ;
 	}


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* RE: [PATCH v3 1/3] megaraid : use dev_printk when possible
  2015-07-07 20:52 ` [PATCH v3 1/3] megaraid : use dev_printk " Bjorn Helgaas
@ 2015-07-08  6:08   ` Sumit Saxena
  2015-07-08 10:44   ` Hannes Reinecke
  1 sibling, 0 replies; 12+ messages in thread
From: Sumit Saxena @ 2015-07-08  6:08 UTC (permalink / raw)
  To: Bjorn Helgaas, Kashyap Desai, Uday Lingala
  Cc: PDL,MEGARAIDLINUX, linux-scsi, James E.J. Bottomley,
	linux-kernel, Joe Perches, Christoph Hellwig

> -----Original Message-----
> From: Bjorn Helgaas [mailto:bhelgaas@google.com]
> Sent: Wednesday, July 08, 2015 2:22 AM
> To: Kashyap Desai; Uday Lingala; Sumit Saxena
> Cc: megaraidlinux.pdl@avagotech.com; linux-scsi@vger.kernel.org; James
> E.J.
> Bottomley; linux-kernel@vger.kernel.org; Joe Perches; Christoph Hellwig
> Subject: [PATCH v3 1/3] megaraid : use dev_printk when possible
>
> Use dev_printk() when possible to make messages more useful.
>
> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
> ---
>  drivers/scsi/megaraid.c |  140
> ++++++++++++++++++++++-------------------------
>  1 file changed, 66 insertions(+), 74 deletions(-)
>
> diff --git a/drivers/scsi/megaraid.c b/drivers/scsi/megaraid.c index
> bc7b34c..9d05302 100644
> --- a/drivers/scsi/megaraid.c
> +++ b/drivers/scsi/megaraid.c
> @@ -268,8 +268,8 @@ mega_query_adapter(adapter_t *adapter)
>  		raw_mbox[2] = NC_SUBOP_PRODUCT_INFO;	/* i.e. 0x0E */
>
>  		if ((retval = issue_scb_block(adapter, raw_mbox)))
> -			printk(KERN_WARNING
> -			"megaraid: Product_info cmd failed with error: %d\n",
> +			dev_warn(&adapter->dev->dev,
> +				"Product_info cmd failed with error: %d\n",
>  				retval);
>
>  		pci_unmap_single(adapter->dev, prod_info_dma_handle, @@ -
> 334,7 +334,7 @@ mega_query_adapter(adapter_t *adapter)
>  		adapter->bios_version[4] = 0;
>  	}
>
> -	printk(KERN_NOTICE "megaraid: [%s:%s] detected %d logical drives.\n",
> +	dev_notice(&adapter->dev->dev, "[%s:%s] detected %d logical
> drives\n",
>  		adapter->fw_version, adapter->bios_version, adapter-
> >numldrv);
>
>  	/*
> @@ -342,7 +342,7 @@ mega_query_adapter(adapter_t *adapter)
>  	 */
>  	adapter->support_ext_cdb = mega_support_ext_cdb(adapter);
>  	if (adapter->support_ext_cdb)
> -		printk(KERN_NOTICE "megaraid: supports extended CDBs.\n");
> +		dev_notice(&adapter->dev->dev, "supports extended CDBs\n");
>
>
>  	return 0;
> @@ -678,11 +678,11 @@ mega_build_cmd(adapter_t *adapter, Scsi_Cmnd
> *cmd, int *busy)
>
>  			if(!(adapter->flag & (1L << cmd->device->channel))) {
>
> -				printk(KERN_NOTICE
> -					"scsi%d: scanning scsi channel %d ",
> +				dev_notice(&adapter->dev->dev,
> +					"scsi%d: scanning scsi channel %d "
> +					"for logical drives\n",
>  						adapter->host->host_no,
>  						cmd->device->channel);
> -				printk("for logical drives.\n");
>
>  				adapter->flag |= (1L << cmd->device->channel);
>  			}
> @@ -983,11 +983,11 @@ mega_prepare_passthru(adapter_t *adapter, scb_t
> *scb, Scsi_Cmnd *cmd,
>  	case READ_CAPACITY:
>  		if(!(adapter->flag & (1L << cmd->device->channel))) {
>
> -			printk(KERN_NOTICE
> -				"scsi%d: scanning scsi channel %d [P%d] ",
> +			dev_notice(&adapter->dev->dev,
> +				"scsi%d: scanning scsi channel %d [P%d] "
> +				"for physical devices\n",
>  					adapter->host->host_no,
>  					cmd->device->channel, channel);
> -			printk("for physical devices.\n");
>
>  			adapter->flag |= (1L << cmd->device->channel);
>  		}
> @@ -1045,11 +1045,11 @@ mega_prepare_extpassthru(adapter_t *adapter,
> scb_t *scb, Scsi_Cmnd *cmd,
>  	case READ_CAPACITY:
>  		if(!(adapter->flag & (1L << cmd->device->channel))) {
>
> -			printk(KERN_NOTICE
> -				"scsi%d: scanning scsi channel %d [P%d] ",
> +			dev_notice(&adapter->dev->dev,
> +				"scsi%d: scanning scsi channel %d [P%d] "
> +				"for physical devices\n",
>  					adapter->host->host_no,
>  					cmd->device->channel, channel);
> -			printk("for physical devices.\n");
>
>  			adapter->flag |= (1L << cmd->device->channel);
>  		}
> @@ -1241,7 +1241,7 @@ issue_scb_block(adapter_t *adapter, u_char
> *raw_mbox)
>  	return mbox->m_in.status;
>
>  bug_blocked_mailbox:
> -	printk(KERN_WARNING "megaraid: Blocked mailbox......!!\n");
> +	dev_warn(&adapter->dev->dev, "Blocked mailbox......!!\n");
>  	udelay (1000);
>  	return -1;
>  }
> @@ -1454,9 +1454,8 @@ mega_cmd_done(adapter_t *adapter, u8
> completed[], int nstatus, int status)
>  			 * Make sure f/w has completed a valid command
>  			 */
>  			if( !(scb->state & SCB_ISSUED) || scb->cmd == NULL ) {
> -				printk(KERN_CRIT
> -					"megaraid: invalid command ");
> -				printk("Id %d, scb->state:%x, scsi cmd:%p\n",
> +				dev_crit(&adapter->dev->dev, "invalid
> command "
> +					"Id %d, scb->state:%x, scsi cmd:%p\n",
>  					cmdid, scb->state, scb->cmd);
>
>  				continue;
> @@ -1467,8 +1466,8 @@ mega_cmd_done(adapter_t *adapter, u8
> completed[], int nstatus, int status)
>  			 */
>  			if( scb->state & SCB_ABORT ) {
>
> -				printk(KERN_WARNING
> -				"megaraid: aborted cmd [%x] complete.\n",
> +				dev_warn(&adapter->dev->dev,
> +					"aborted cmd [%x] complete\n",
>  					scb->idx);
>
>  				scb->cmd->result = (DID_ABORT << 16); @@ -
> 1486,8 +1485,8 @@ mega_cmd_done(adapter_t *adapter, u8 completed[], int
> nstatus, int status)
>  			 */
>  			if( scb->state & SCB_RESET ) {
>
> -				printk(KERN_WARNING
> -				"megaraid: reset cmd [%x] complete.\n",
> +				dev_warn(&adapter->dev->dev,
> +					"reset cmd [%x] complete\n",
>  					scb->idx);
>
>  				scb->cmd->result = (DID_RESET << 16); @@ -
> 1553,8 +1552,7 @@ mega_cmd_done(adapter_t *adapter, u8 completed[], int
> nstatus, int status)
>  			if( sg_page(sgl) ) {
>  				c = *(unsigned char *) sg_virt(&sgl[0]);
>  			} else {
> -				printk(KERN_WARNING
> -				       "megaraid: invalid sg.\n");
> +				dev_warn(&adapter->dev->dev, "invalid sg\n");
>  				c = 0;
>  			}
>
> @@ -1902,11 +1900,10 @@ megaraid_reset(struct scsi_cmnd *cmd)
>  	mc.opcode = MEGA_RESET_RESERVATIONS;
>
>  	if( mega_internal_command(adapter, &mc, NULL) != 0 ) {
> -		printk(KERN_WARNING
> -				"megaraid: reservation reset failed.\n");
> +		dev_warn(&adapter->dev->dev, "reservation reset failed\n");
>  	}
>  	else {
> -		printk(KERN_INFO "megaraid: reservation reset.\n");
> +		dev_info(&adapter->dev->dev, "reservation reset\n");
>  	}
>  #endif
>
> @@ -1939,7 +1936,7 @@ megaraid_abort_and_reset(adapter_t *adapter,
> Scsi_Cmnd *cmd, int aor)
>  	struct list_head	*pos, *next;
>  	scb_t			*scb;
>
> -	printk(KERN_WARNING "megaraid: %s cmd=%x <c=%d t=%d l=%d>\n",
> +	dev_warn(&adapter->dev->dev, "%s cmd=%x <c=%d t=%d l=%d>\n",
>  	     (aor == SCB_ABORT)? "ABORTING":"RESET",
>  	     cmd->cmnd[0], cmd->device->channel,
>  	     cmd->device->id, (u32)cmd->device->lun); @@ -1963,8 +1960,8 @@
> megaraid_abort_and_reset(adapter_t *adapter, Scsi_Cmnd *cmd, int aor)
>  			 */
>  			if( scb->state & SCB_ISSUED ) {
>
> -				printk(KERN_WARNING
> -					"megaraid: %s[%x], fw owner.\n",
> +				dev_warn(&adapter->dev->dev,
> +					"%s[%x], fw owner\n",
>  					(aor==SCB_ABORT) ?
> "ABORTING":"RESET",
>  					scb->idx);
>
> @@ -1976,8 +1973,8 @@ megaraid_abort_and_reset(adapter_t *adapter,
> Scsi_Cmnd *cmd, int aor)
>  				 * Not yet issued! Remove from the pending
>  				 * list
>  				 */
> -				printk(KERN_WARNING
> -					"megaraid: %s-[%x], driver owner.\n",
> +				dev_warn(&adapter->dev->dev,
> +					"%s-[%x], driver owner\n",
>  					(aor==SCB_ABORT) ?
> "ABORTING":"RESET",
>  					scb->idx);
>
> @@ -2197,7 +2194,7 @@ proc_show_rebuild_rate(struct seq_file *m, void *v)
>
>  	if( mega_adapinq(adapter, dma_handle) != 0 ) {
>  		seq_puts(m, "Adapter inquiry failed.\n");
> -		printk(KERN_WARNING "megaraid: inquiry failed.\n");
> +		dev_warn(&adapter->dev->dev, "inquiry failed\n");
>  		goto free_inquiry;
>  	}
>
> @@ -2241,7 +2238,7 @@ proc_show_battery(struct seq_file *m, void *v)
>
>  	if( mega_adapinq(adapter, dma_handle) != 0 ) {
>  		seq_puts(m, "Adapter inquiry failed.\n");
> -		printk(KERN_WARNING "megaraid: inquiry failed.\n");
> +		dev_warn(&adapter->dev->dev, "inquiry failed\n");
>  		goto free_inquiry;
>  	}
>
> @@ -2350,7 +2347,7 @@ proc_show_pdrv(struct seq_file *m, adapter_t
> *adapter, int channel)
>
>  	if( mega_adapinq(adapter, dma_handle) != 0 ) {
>  		seq_puts(m, "Adapter inquiry failed.\n");
> -		printk(KERN_WARNING "megaraid: inquiry failed.\n");
> +		dev_warn(&adapter->dev->dev, "inquiry failed\n");
>  		goto free_inquiry;
>  	}
>
> @@ -2525,7 +2522,7 @@ proc_show_rdrv(struct seq_file *m, adapter_t
> *adapter, int start, int end )
>
>  	if( mega_adapinq(adapter, dma_handle) != 0 ) {
>  		seq_puts(m, "Adapter inquiry failed.\n");
> -		printk(KERN_WARNING "megaraid: inquiry failed.\n");
> +		dev_warn(&adapter->dev->dev, "inquiry failed\n");
>  		goto free_inquiry;
>  	}
>
> @@ -2799,7 +2796,7 @@ mega_create_proc_entry(int index, struct
> proc_dir_entry *parent)
>  	dir = adapter->controller_proc_dir_entry =
>  		proc_mkdir_data(string, 0, parent, adapter);
>  	if(!dir) {
> -		printk(KERN_WARNING "\nmegaraid: proc_mkdir failed\n");
> +		dev_warn(&adapter->dev->dev, "proc_mkdir failed\n");
>  		return;
>  	}
>
> @@ -2807,7 +2804,7 @@ mega_create_proc_entry(int index, struct
> proc_dir_entry *parent)
>  		de = proc_create_data(f->name, S_IRUSR, dir,
> &mega_proc_fops,
>  				      f->show);
>  		if (!de) {
> -			printk(KERN_WARNING "\nmegaraid: proc_create
> failed\n");
> +			dev_warn(&adapter->dev->dev, "proc_create
> failed\n");
>  			return;
>  		}
>
> @@ -2874,9 +2871,9 @@ megaraid_biosparam(struct scsi_device *sdev, struct
> block_device *bdev,
>  				return rval;
>  		}
>
> -		printk(KERN_INFO
> -		"megaraid: invalid partition on this disk on channel %d\n",
> -				sdev->channel);
> +		dev_info(&adapter->dev->dev,
> +			 "invalid partition on this disk on channel %d\n",
> +			 sdev->channel);
>
>  		/* Default heads (64) & sectors (32) */
>  		heads = 64;
> @@ -2936,7 +2933,7 @@ mega_init_scb(adapter_t *adapter)
>  		scb->sgl = (mega_sglist *)scb->sgl64;
>
>  		if( !scb->sgl ) {
> -			printk(KERN_WARNING "RAID: Can't allocate sglist.\n");
> +			dev_warn(&adapter->dev->dev, "RAID: Can't allocate
> sglist\n");
>  			mega_free_sgl(adapter);
>  			return -1;
>  		}
> @@ -2946,7 +2943,7 @@ mega_init_scb(adapter_t *adapter)
>  				&scb->pthru_dma_addr);
>
>  		if( !scb->pthru ) {
> -			printk(KERN_WARNING "RAID: Can't allocate
> passthru.\n");
> +			dev_warn(&adapter->dev->dev, "RAID: Can't allocate
> passthru\n");
>  			mega_free_sgl(adapter);
>  			return -1;
>  		}
> @@ -2956,8 +2953,8 @@ mega_init_scb(adapter_t *adapter)
>  				&scb->epthru_dma_addr);
>
>  		if( !scb->epthru ) {
> -			printk(KERN_WARNING
> -				"Can't allocate extended passthru.\n");
> +			dev_warn(&adapter->dev->dev,
> +				"Can't allocate extended passthru\n");
>  			mega_free_sgl(adapter);
>  			return -1;
>  		}
> @@ -3154,8 +3151,8 @@ megadev_ioctl(struct file *filep, unsigned int cmd,
> unsigned long arg)
>  			 * Do we support this feature
>  			 */
>  			if( !adapter->support_random_del ) {
> -				printk(KERN_WARNING "megaraid: logdrv ");
> -				printk("delete on non-supporting F/W.\n");
> +				dev_warn(&adapter->dev->dev, "logdrv "
> +					"delete on non-supporting F/W\n");
>
>  				return (-EINVAL);
>  			}
> @@ -3179,7 +3176,7 @@ megadev_ioctl(struct file *filep, unsigned int cmd,
> unsigned long arg)
>  		if( uioc.uioc_rmbox[0] == MEGA_MBOXCMD_PASSTHRU64 ||
>  			uioc.uioc_rmbox[0] == MEGA_MBOXCMD_EXTPTHRU )
> {
>
> -			printk(KERN_WARNING "megaraid: rejected
> passthru.\n");
> +			dev_warn(&adapter->dev->dev, "rejected passthru\n");
>
>  			return (-EINVAL);
>  		}
> @@ -3683,11 +3680,11 @@ mega_enum_raid_scsi(adapter_t *adapter)
>
>  	for( i = 0; i < adapter->product_info.nchannels; i++ ) {
>  		if( (adapter->mega_ch_class >> i) & 0x01 ) {
> -			printk(KERN_INFO "megaraid: channel[%d] is raid.\n",
> +			dev_info(&adapter->dev->dev, "channel[%d] is raid\n",
>  					i);
>  		}
>  		else {
> -			printk(KERN_INFO "megaraid: channel[%d] is scsi.\n",
> +			dev_info(&adapter->dev->dev, "channel[%d] is scsi\n",
>  					i);
>  		}
>  	}
> @@ -3893,7 +3890,7 @@ mega_do_del_logdrv(adapter_t *adapter, int logdrv)
>
>  	/* log this event */
>  	if(rval) {
> -		printk(KERN_WARNING "megaraid: Delete LD-%d failed.",
> logdrv);
> +		dev_warn(&adapter->dev->dev, "Delete LD-%d failed", logdrv);
>  		return rval;
>  	}
>
> @@ -4161,7 +4158,7 @@ mega_internal_command(adapter_t *adapter,
> megacmd_t *mc, mega_passthru *pthru)
>  	 * this information.
>  	 */
>  	if (rval && trace_level) {
> -		printk("megaraid: cmd [%x, %x, %x] status:[%x]\n",
> +		dev_info(&adapter->dev->dev, "cmd [%x, %x, %x]
> status:[%x]\n",
>  			mc->cmd, mc->opcode, mc->subopcode, rval);
>  	}
>
> @@ -4244,11 +4241,8 @@ megaraid_probe_one(struct pci_dev *pdev, const
> struct pci_device_id *id)
>  	subsysvid = pdev->subsystem_vendor;
>  	subsysid = pdev->subsystem_device;
>
> -	printk(KERN_NOTICE "megaraid: found 0x%4.04x:0x%4.04x:bus %d:",
> -		id->vendor, id->device, pci_bus);
> -
> -	printk("slot %d:func %d\n",
> -		PCI_SLOT(pci_dev_func), PCI_FUNC(pci_dev_func));
> +	dev_notice(&pdev->dev, "found 0x%4.04x:0x%4.04x\n",
> +		id->vendor, id->device);
>
>  	/* Read the base port and IRQ from PCI */
>  	mega_baseport = pci_resource_start(pdev, 0); @@ -4259,14 +4253,13
> @@ megaraid_probe_one(struct pci_dev *pdev, const struct pci_device_id
> *id)
>  		flag |= BOARD_MEMMAP;
>
>  		if (!request_mem_region(mega_baseport, 128, "megaraid")) {
> -			printk(KERN_WARNING "megaraid: mem region
> busy!\n");
> +			dev_warn(&pdev->dev, "mem region busy!\n");
>  			goto out_disable_device;
>  		}
>
>  		mega_baseport = (unsigned long)ioremap(mega_baseport,
> 128);
>  		if (!mega_baseport) {
> -			printk(KERN_WARNING
> -			       "megaraid: could not map hba memory\n");
> +			dev_warn(&pdev->dev, "could not map hba
> memory\n");
>  			goto out_release_region;
>  		}
>  	} else {
> @@ -4285,7 +4278,7 @@ megaraid_probe_one(struct pci_dev *pdev, const
> struct pci_device_id *id)
>  	adapter = (adapter_t *)host->hostdata;
>  	memset(adapter, 0, sizeof(adapter_t));
>
> -	printk(KERN_NOTICE
> +	dev_notice(&pdev->dev,
>  		"scsi%d:Found MegaRAID controller at 0x%lx, IRQ:%d\n",
>  		host->host_no, mega_baseport, irq);
>
> @@ -4323,21 +4316,20 @@ megaraid_probe_one(struct pci_dev *pdev, const
> struct pci_device_id *id)
>  	adapter->mega_buffer = pci_alloc_consistent(adapter->dev,
>  		MEGA_BUFFER_SIZE, &adapter->buf_dma_handle);
>  	if (!adapter->mega_buffer) {
> -		printk(KERN_WARNING "megaraid: out of RAM.\n");
> +		dev_warn(&pdev->dev, "out of RAM\n");
>  		goto out_host_put;
>  	}
>
>  	adapter->scb_list = kmalloc(sizeof(scb_t) * MAX_COMMANDS,
> GFP_KERNEL);
>  	if (!adapter->scb_list) {
> -		printk(KERN_WARNING "megaraid: out of RAM.\n");
> +		dev_warn(&pdev->dev, "out of RAM\n");
>  		goto out_free_cmd_buffer;
>  	}
>
>  	if (request_irq(irq, (adapter->flag & BOARD_MEMMAP) ?
>  				megaraid_isr_memmapped :
> megaraid_isr_iomapped,
>  					IRQF_SHARED, "megaraid", adapter)) {
> -		printk(KERN_WARNING
> -			"megaraid: Couldn't register IRQ %d!\n", irq);
> +		dev_warn(&pdev->dev, "Couldn't register IRQ %d!\n", irq);
>  		goto out_free_scb_list;
>  	}
>
> @@ -4357,9 +4349,9 @@ megaraid_probe_one(struct pci_dev *pdev, const
> struct pci_device_id *id)
>  		if (!strcmp(adapter->fw_version, "3.00") ||
>  				!strcmp(adapter->fw_version, "3.01")) {
>
> -			printk( KERN_WARNING
> -				"megaraid: Your  card is a Dell PERC "
> -				"2/SC RAID controller with  "
> +			dev_warn(&pdev->dev,
> +				"Your card is a Dell PERC "
> +				"2/SC RAID controller with "
>  				"firmware\nmegaraid: 3.00 or 3.01.  "
>  				"This driver is known to have "
>  				"corruption issues\nmegaraid: with "
> @@ -4390,12 +4382,12 @@ megaraid_probe_one(struct pci_dev *pdev, const
> struct pci_device_id *id)
>  		if (!strcmp(adapter->fw_version, "H01.07") ||
>  		    !strcmp(adapter->fw_version, "H01.08") ||
>  		    !strcmp(adapter->fw_version, "H01.09") ) {
> -			printk(KERN_WARNING
> -				"megaraid: Firmware H.01.07, "
> +			dev_warn(&pdev->dev,
> +				"Firmware H.01.07, "
>  				"H.01.08, and H.01.09 on 1M/2M "
>  				"controllers\n"
> -				"megaraid: do not support 64 bit "
> -				"addressing.\nmegaraid: DISABLING "
> +				"do not support 64 bit "
> +				"addressing.\nDISABLING "
>  				"64 bit support.\n");
>  			adapter->flag &= ~BOARD_64BIT;
>  		}
> @@ -4503,8 +4495,8 @@ megaraid_probe_one(struct pci_dev *pdev, const
> struct pci_device_id *id)
>  	 */
>  	adapter->has_cluster = mega_support_cluster(adapter);
>  	if (adapter->has_cluster) {
> -		printk(KERN_NOTICE
> -			"megaraid: Cluster driver, initiator id:%d\n",
> +		dev_notice(&pdev->dev,
> +			"Cluster driver, initiator id:%d\n",
>  			adapter->this_id);
>  	}
>  #endif
> @@ -4571,7 +4563,7 @@ __megaraid_shutdown(adapter_t *adapter)
>  	issue_scb_block(adapter, raw_mbox);
>
>  	if (atomic_read(&adapter->pend_cmds) > 0)
> -		printk(KERN_WARNING "megaraid: pending commands!!\n");
> +		dev_warn(&adapter->dev->dev, "pending commands!!\n");
>
>  	/*
>  	 * Have a delibrate delay to make sure all the caches are

Acked-by: Sumit Saxena <sumit.saxena@avagotech.com>

^ permalink raw reply	[flat|nested] 12+ messages in thread

* RE: [PATCH v3 2/3] megaraid_sas : use dev_printk when possible
  2015-07-07 20:52 ` [PATCH v3 2/3] megaraid_sas " Bjorn Helgaas
@ 2015-07-08  9:13   ` Sumit Saxena
  2015-07-08 10:47   ` Hannes Reinecke
  1 sibling, 0 replies; 12+ messages in thread
From: Sumit Saxena @ 2015-07-08  9:13 UTC (permalink / raw)
  To: Bjorn Helgaas, Kashyap Desai, Uday Lingala
  Cc: PDL,MEGARAIDLINUX, linux-scsi, James E.J. Bottomley,
	linux-kernel, Joe Perches, Christoph Hellwig

> -----Original Message-----
> From: Bjorn Helgaas [mailto:bhelgaas@google.com]
> Sent: Wednesday, July 08, 2015 2:23 AM
> To: Kashyap Desai; Uday Lingala; Sumit Saxena
> Cc: megaraidlinux.pdl@avagotech.com; linux-scsi@vger.kernel.org; James
> E.J.
> Bottomley; linux-kernel@vger.kernel.org; Joe Perches; Christoph Hellwig
> Subject: [PATCH v3 2/3] megaraid_sas : use dev_printk when possible
>
> Use dev_printk() when possible to make messages more useful.
>
> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
> ---
>  drivers/scsi/megaraid/megaraid_sas_base.c   |  304
> +++++++++++++--------------
>  drivers/scsi/megaraid/megaraid_sas_fusion.c |   95 ++++----
>  2 files changed, 196 insertions(+), 203 deletions(-)
>
> diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c
> b/drivers/scsi/megaraid/megaraid_sas_base.c
> index 71b884d..a9bd592 100644
> --- a/drivers/scsi/megaraid/megaraid_sas_base.c
> +++ b/drivers/scsi/megaraid/megaraid_sas_base.c
> @@ -216,7 +216,7 @@ struct megasas_cmd *megasas_get_cmd(struct
> megasas_instance
>  				 struct megasas_cmd, list);
>  		list_del_init(&cmd->list);
>  	} else {
> -		printk(KERN_ERR "megasas: Command pool empty!\n");
> +		dev_err(&instance->pdev->dev, "Command pool empty!\n");
>  	}
>
>  	spin_unlock_irqrestore(&instance->mfi_pool_lock, flags);
> @@ -370,9 +370,9 @@ megasas_adp_reset_xscale(struct megasas_instance
> *instance,
>  		msleep(1000); /* sleep for 3 secs */
>  	pcidata  = 0;
>  	pci_read_config_dword(instance->pdev, MFI_1068_PCSR_OFFSET,
> &pcidata);
> -	printk(KERN_NOTICE "pcidata = %x\n", pcidata);
> +	dev_notice(&instance->pdev->dev, "pcidata = %x\n", pcidata);
>  	if (pcidata & 0x2) {
> -		printk(KERN_NOTICE "mfi 1068 offset read=%x\n", pcidata);
> +		dev_notice(&instance->pdev->dev, "mfi 1068 offset
> read=%x\n", pcidata);
>  		pcidata &= ~0x2;
>  		pci_write_config_dword(instance->pdev,
>  				MFI_1068_PCSR_OFFSET, pcidata);
> @@ -383,9 +383,9 @@ megasas_adp_reset_xscale(struct megasas_instance
> *instance,
>  		pcidata  = 0;
>  		pci_read_config_dword(instance->pdev,
>  				MFI_1068_FW_HANDSHAKE_OFFSET,
> &pcidata);
> -		printk(KERN_NOTICE "1068 offset handshake read=%x\n",
> pcidata);
> +		dev_notice(&instance->pdev->dev, "1068 offset handshake
> read=%x\n", pcidata);
>  		if ((pcidata & 0xffff0000) == MFI_1068_FW_READY) {
> -			printk(KERN_NOTICE "1068 offset pcidt=%x\n",
> pcidata);
> +			dev_notice(&instance->pdev->dev, "1068 offset
> pcidt=%x\n", pcidata);
>  			pcidata = 0;
>  			pci_write_config_dword(instance->pdev,
>  				MFI_1068_FW_HANDSHAKE_OFFSET, pcidata);
> @@ -824,7 +824,7 @@ megasas_adp_reset_gen2(struct megasas_instance
> *instance,
>  	while ( !( HostDiag & DIAG_WRITE_ENABLE) ) {
>  		msleep(100);
>  		HostDiag = (u32)readl(hostdiag_offset);
> -		printk(KERN_NOTICE "RESETGEN2: retry=%x, hostdiag=%x\n",
> +		dev_notice(&instance->pdev->dev, "RESETGEN2: retry=%x,
> hostdiag=%x\n",
>  					retry, HostDiag);
>
>  		if (retry++ >= 100)
> @@ -832,7 +832,7 @@ megasas_adp_reset_gen2(struct megasas_instance
> *instance,
>
>  	}
>
> -	printk(KERN_NOTICE "ADP_RESET_GEN2: HostDiag=%x\n", HostDiag);
> +	dev_notice(&instance->pdev->dev, "ADP_RESET_GEN2:
> HostDiag=%x\n", HostDiag);
>
>  	writel((HostDiag | DIAG_RESET_ADAPTER), hostdiag_offset);
>
> @@ -842,7 +842,7 @@ megasas_adp_reset_gen2(struct megasas_instance
> *instance,
>  	while ( ( HostDiag & DIAG_RESET_ADAPTER) ) {
>  		msleep(100);
>  		HostDiag = (u32)readl(hostdiag_offset);
> -		printk(KERN_NOTICE "RESET_GEN2: retry=%x, hostdiag=%x\n",
> +		dev_notice(&instance->pdev->dev, "RESET_GEN2: retry=%x,
> hostdiag=%x\n",
>  				retry, HostDiag);
>
>  		if (retry++ >= 1000)
> @@ -1241,7 +1241,7 @@ megasas_build_dcdb(struct megasas_instance
> *instance, struct scsi_cmnd *scp,
>  						      &pthru->sgl);
>
>  	if (pthru->sge_count > instance->max_num_sge) {
> -		printk(KERN_ERR "megasas: DCDB two many SGE NUM=%x\n",
> +		dev_err(&instance->pdev->dev, "DCDB too many SGE
> NUM=%x\n",
>  			pthru->sge_count);
>  		return 0;
>  	}
> @@ -1382,7 +1382,7 @@ megasas_build_ldio(struct megasas_instance
> *instance, struct scsi_cmnd *scp,
>  		ldio->sge_count = megasas_make_sgl32(instance, scp, &ldio-
> >sgl);
>
>  	if (ldio->sge_count > instance->max_num_sge) {
> -		printk(KERN_ERR "megasas: build_ld_io: sge_count = %x\n",
> +		dev_err(&instance->pdev->dev, "build_ld_io: sge_count =
> %x\n",
>  			ldio->sge_count);
>  		return 0;
>  	}
> @@ -1449,24 +1449,24 @@ megasas_dump_pending_frames(struct
> megasas_instance *instance)
>  	u32 sgcount;
>  	u32 max_cmd = instance->max_fw_cmds;
>
> -	printk(KERN_ERR "\nmegasas[%d]: Dumping Frame Phys Address of all
> pending cmds in FW\n",instance->host->host_no);
> -	printk(KERN_ERR "megasas[%d]: Total OS Pending cmds :
> %d\n",instance->host->host_no,atomic_read(&instance->fw_outstanding));
> +	dev_err(&instance->pdev->dev, "[%d]: Dumping Frame Phys Address of
> all pending cmds in FW\n",instance->host->host_no);
> +	dev_err(&instance->pdev->dev, "[%d]: Total OS Pending cmds :
> %d\n",instance->host->host_no,atomic_read(&instance->fw_outstanding));
>  	if (IS_DMA64)
> -		printk(KERN_ERR "\nmegasas[%d]: 64 bit SGLs were sent to
> FW\n",instance->host->host_no);
> +		dev_err(&instance->pdev->dev, "[%d]: 64 bit SGLs were sent to
> FW\n",instance->host->host_no);
>  	else
> -		printk(KERN_ERR "\nmegasas[%d]: 32 bit SGLs were sent to
> FW\n",instance->host->host_no);
> +		dev_err(&instance->pdev->dev, "[%d]: 32 bit SGLs were sent to
> FW\n",instance->host->host_no);
>
> -	printk(KERN_ERR "megasas[%d]: Pending OS cmds in FW : \n",instance-
> >host->host_no);
> +	dev_err(&instance->pdev->dev, "[%d]: Pending OS cmds in FW :
> \n",instance->host->host_no);
>  	for (i = 0; i < max_cmd; i++) {
>  		cmd = instance->cmd_list[i];
>  		if(!cmd->scmd)
>  			continue;
> -		printk(KERN_ERR "megasas[%d]: Frame addr :0x%08lx :
> ",instance->host->host_no,(unsigned long)cmd->frame_phys_addr);
> +		dev_err(&instance->pdev->dev, "[%d]: Frame addr :0x%08lx :
> ",instance->host->host_no,(unsigned long)cmd->frame_phys_addr);
>  		if (megasas_cmd_type(cmd->scmd) == READ_WRITE_LDIO) {
>  			ldio = (struct megasas_io_frame *)cmd->frame;
>  			mfi_sgl = &ldio->sgl;
>  			sgcount = ldio->sge_count;
> -			printk(KERN_ERR "megasas[%d]: frame count : 0x%x,
> Cmd : 0x%x, Tgt id : 0x%x,"
> +			dev_err(&instance->pdev->dev, "[%d]: frame count :
> 0x%x, Cmd : 0x%x, Tgt id : 0x%x,"
>  			" lba lo : 0x%x, lba_hi : 0x%x, sense_buf addr : 0x%x,sge
> count : 0x%x\n",
>  			instance->host->host_no, cmd->frame_count, ldio-
> >cmd, ldio->target_id,
>  			le32_to_cpu(ldio->start_lba_lo), le32_to_cpu(ldio-
> >start_lba_hi),
> @@ -1476,7 +1476,7 @@ megasas_dump_pending_frames(struct
> megasas_instance *instance)
>  			pthru = (struct megasas_pthru_frame *) cmd->frame;
>  			mfi_sgl = &pthru->sgl;
>  			sgcount = pthru->sge_count;
> -			printk(KERN_ERR "megasas[%d]: frame count : 0x%x,
> Cmd : 0x%x, Tgt id : 0x%x, "
> +			dev_err(&instance->pdev->dev, "[%d]: frame count :
> 0x%x, Cmd : 0x%x, Tgt id : 0x%x, "
>  			"lun : 0x%x, cdb_len : 0x%x, data xfer len : 0x%x,
> sense_buf addr : 0x%x,sge count : 0x%x\n",
>  			instance->host->host_no, cmd->frame_count, pthru-
> >cmd, pthru->target_id,
>  			pthru->lun, pthru->cdb_len, le32_to_cpu(pthru-
> >data_xfer_len),
> @@ -1485,27 +1485,26 @@ megasas_dump_pending_frames(struct
> megasas_instance *instance)
>  	if(megasas_dbg_lvl & MEGASAS_DBG_LVL){
>  		for (n = 0; n < sgcount; n++){
>  			if (IS_DMA64)
> -				printk(KERN_ERR "megasas: sgl len : 0x%x, sgl
> addr : 0x%llx ",
> +				dev_err(&instance->pdev->dev, "sgl len : 0x%x,
> sgl addr : 0x%llx\n",
>  					le32_to_cpu(mfi_sgl-
> >sge64[n].length),
>  					le64_to_cpu(mfi_sgl-
> >sge64[n].phys_addr));
>  			else
> -				printk(KERN_ERR "megasas: sgl len : 0x%x, sgl
> addr : 0x%x ",
> +				dev_err(&instance->pdev->dev, "sgl len : 0x%x,
> sgl addr : 0x%x\n",
>  					le32_to_cpu(mfi_sgl-
> >sge32[n].length),
>  					le32_to_cpu(mfi_sgl-
> >sge32[n].phys_addr));
>  			}
>  		}
> -		printk(KERN_ERR "\n");
>  	} /*for max_cmd*/
> -	printk(KERN_ERR "\nmegasas[%d]: Pending Internal cmds in FW :
> \n",instance->host->host_no);
> +	dev_err(&instance->pdev->dev, "[%d]: Pending Internal cmds in FW :
> \n",instance->host->host_no);
>  	for (i = 0; i < max_cmd; i++) {
>
>  		cmd = instance->cmd_list[i];
>
>  		if(cmd->sync_cmd == 1){
> -			printk(KERN_ERR "0x%08lx : ", (unsigned long)cmd-
> >frame_phys_addr);
> +			dev_err(&instance->pdev->dev, "0x%08lx : ", (unsigned
> long)cmd->frame_phys_addr);
>  		}
>  	}
> -	printk(KERN_ERR "megasas[%d]: Dumping Done.\n\n",instance->host-
> >host_no);
> +	dev_err(&instance->pdev->dev, "[%d]: Dumping Done\n\n",instance-
> >host->host_no);
>  }
>
>  u32
> @@ -1623,7 +1622,7 @@ megasas_queue_command(struct Scsi_Host *shost,
> struct scsi_cmnd *scmd)
>  	}
>
>  	if (instance->instancet->build_and_issue_cmd(instance, scmd)) {
> -		printk(KERN_ERR "megasas: Err returned from
> build_and_issue_cmd\n");
> +		dev_err(&instance->pdev->dev, "Err returned from
> build_and_issue_cmd\n");
>  		return SCSI_MLQUEUE_HOST_BUSY;
>  	}
>
> @@ -1794,7 +1793,7 @@ static void megasas_complete_cmd_dpc(unsigned
> long instance_addr)
>  	while (consumer != producer) {
>  		context = le32_to_cpu(instance->reply_queue[consumer]);
>  		if (context >= instance->max_fw_cmds) {
> -			printk(KERN_ERR "Unexpected context value %x\n",
> +			dev_err(&instance->pdev->dev, "Unexpected context
> value %x\n",
>  				context);
>  			BUG();
>  		}
> @@ -1873,8 +1872,8 @@ static int megasas_get_ld_vf_affiliation_111(struct
> megasas_instance *instance,
>  	cmd = megasas_get_cmd(instance);
>
>  	if (!cmd) {
> -		printk(KERN_DEBUG "megasas:
> megasas_get_ld_vf_affiliation_111:"
> -		       "Failed to get cmd for scsi%d.\n",
> +		dev_printk(KERN_DEBUG, &instance->pdev->dev,
> "megasas_get_ld_vf_affiliation_111:"
> +		       "Failed to get cmd for scsi%d\n",
>  			instance->host->host_no);
>  		return -ENOMEM;
>  	}
> @@ -1882,8 +1881,8 @@ static int megasas_get_ld_vf_affiliation_111(struct
> megasas_instance *instance,
>  	dcmd = &cmd->frame->dcmd;
>
>  	if (!instance->vf_affiliation_111) {
> -		printk(KERN_WARNING "megasas: SR-IOV: Couldn't get LD/VF "
> -		       "affiliation for scsi%d.\n", instance->host->host_no);
> +		dev_warn(&instance->pdev->dev, "SR-IOV: Couldn't get LD/VF "
> +		       "affiliation for scsi%d\n", instance->host->host_no);
>  		megasas_return_cmd(instance, cmd);
>  		return -ENOMEM;
>  	}
> @@ -1897,8 +1896,8 @@ static int megasas_get_ld_vf_affiliation_111(struct
> megasas_instance *instance,
>  					     sizeof(struct
> MR_LD_VF_AFFILIATION_111),
>  					     &new_affiliation_111_h);
>  		if (!new_affiliation_111) {
> -			printk(KERN_DEBUG "megasas: SR-IOV: Couldn't
> allocate "
> -			       "memory for new affiliation for scsi%d.\n",
> +			dev_printk(KERN_DEBUG, &instance->pdev->dev, "SR-
> IOV: Couldn't allocate "
> +			       "memory for new affiliation for scsi%d\n",
>  			       instance->host->host_no);
>  			megasas_return_cmd(instance, cmd);
>  			return -ENOMEM;
> @@ -1929,14 +1928,14 @@ static int
> megasas_get_ld_vf_affiliation_111(struct
> megasas_instance *instance,
>  	dcmd->sgl.sge32[0].length = cpu_to_le32(
>  		sizeof(struct MR_LD_VF_AFFILIATION_111));
>
> -	printk(KERN_WARNING "megasas: SR-IOV: Getting LD/VF affiliation for
> "
> +	dev_warn(&instance->pdev->dev, "SR-IOV: Getting LD/VF affiliation for
> "
>  	       "scsi%d\n", instance->host->host_no);
>
>  	megasas_issue_blocked_cmd(instance, cmd, 0);
>
>  	if (dcmd->cmd_status) {
> -		printk(KERN_WARNING "megasas: SR-IOV: LD/VF affiliation
> DCMD"
> -		       " failed with status 0x%x for scsi%d.\n",
> +		dev_warn(&instance->pdev->dev, "SR-IOV: LD/VF affiliation
> DCMD"
> +		       " failed with status 0x%x for scsi%d\n",
>  		       dcmd->cmd_status, instance->host->host_no);
>  		retval = 1; /* Do a scan if we couldn't get affiliation */
>  		goto out;
> @@ -1947,9 +1946,8 @@ static int megasas_get_ld_vf_affiliation_111(struct
> megasas_instance *instance,
>  		for (ld = 0 ; ld < new_affiliation_111->vdCount; ld++)
>  			if (instance->vf_affiliation_111->map[ld].policy[thisVf]
> !=
>  			    new_affiliation_111->map[ld].policy[thisVf]) {
> -				printk(KERN_WARNING "megasas: SR-IOV: "
> -				       "Got new LD/VF affiliation "
> -				       "for scsi%d.\n",
> +				dev_warn(&instance->pdev->dev, "SR-IOV: "
> +				       "Got new LD/VF affiliation for scsi%d\n",
>  				       instance->host->host_no);
>  				memcpy(instance->vf_affiliation_111,
>  				       new_affiliation_111,
> @@ -1985,8 +1983,8 @@ static int megasas_get_ld_vf_affiliation_12(struct
> megasas_instance *instance,
>  	cmd = megasas_get_cmd(instance);
>
>  	if (!cmd) {
> -		printk(KERN_DEBUG "megasas:
> megasas_get_ld_vf_affiliation12: "
> -		       "Failed to get cmd for scsi%d.\n",
> +		dev_printk(KERN_DEBUG, &instance->pdev->dev,
> "megasas_get_ld_vf_affiliation12: "
> +		       "Failed to get cmd for scsi%d\n",
>  		       instance->host->host_no);
>  		return -ENOMEM;
>  	}
> @@ -1994,8 +1992,8 @@ static int megasas_get_ld_vf_affiliation_12(struct
> megasas_instance *instance,
>  	dcmd = &cmd->frame->dcmd;
>
>  	if (!instance->vf_affiliation) {
> -		printk(KERN_WARNING "megasas: SR-IOV: Couldn't get LD/VF "
> -		       "affiliation for scsi%d.\n", instance->host->host_no);
> +		dev_warn(&instance->pdev->dev, "SR-IOV: Couldn't get LD/VF "
> +		       "affiliation for scsi%d\n", instance->host->host_no);
>  		megasas_return_cmd(instance, cmd);
>  		return -ENOMEM;
>  	}
> @@ -2010,8 +2008,8 @@ static int megasas_get_ld_vf_affiliation_12(struct
> megasas_instance *instance,
>  					     sizeof(struct
> MR_LD_VF_AFFILIATION),
>  					     &new_affiliation_h);
>  		if (!new_affiliation) {
> -			printk(KERN_DEBUG "megasas: SR-IOV: Couldn't
> allocate "
> -			       "memory for new affiliation for scsi%d.\n",
> +			dev_printk(KERN_DEBUG, &instance->pdev->dev, "SR-
> IOV: Couldn't allocate "
> +			       "memory for new affiliation for scsi%d\n",
>  			       instance->host->host_no);
>  			megasas_return_cmd(instance, cmd);
>  			return -ENOMEM;
> @@ -2042,14 +2040,14 @@ static int megasas_get_ld_vf_affiliation_12(struct
> megasas_instance *instance,
>  	dcmd->sgl.sge32[0].length = cpu_to_le32((MAX_LOGICAL_DRIVES + 1) *
>  		sizeof(struct MR_LD_VF_AFFILIATION));
>
> -	printk(KERN_WARNING "megasas: SR-IOV: Getting LD/VF affiliation for
> "
> +	dev_warn(&instance->pdev->dev, "SR-IOV: Getting LD/VF affiliation for
> "
>  	       "scsi%d\n", instance->host->host_no);
>
>  	megasas_issue_blocked_cmd(instance, cmd, 0);
>
>  	if (dcmd->cmd_status) {
> -		printk(KERN_WARNING "megasas: SR-IOV: LD/VF affiliation
> DCMD"
> -		       " failed with status 0x%x for scsi%d.\n",
> +		dev_warn(&instance->pdev->dev, "SR-IOV: LD/VF affiliation
> DCMD"
> +		       " failed with status 0x%x for scsi%d\n",
>  		       dcmd->cmd_status, instance->host->host_no);
>  		retval = 1; /* Do a scan if we couldn't get affiliation */
>  		goto out;
> @@ -2057,8 +2055,8 @@ static int megasas_get_ld_vf_affiliation_12(struct
> megasas_instance *instance,
>
>  	if (!initial) {
>  		if (!new_affiliation->ldCount) {
> -			printk(KERN_WARNING "megasas: SR-IOV: Got new
> LD/VF "
> -			       "affiliation for passive path for scsi%d.\n",
> +			dev_warn(&instance->pdev->dev, "SR-IOV: Got new
> LD/VF "
> +			       "affiliation for passive path for scsi%d\n",
>  			       instance->host->host_no);
>  			retval = 1;
>  			goto out;
> @@ -2123,8 +2121,8 @@ static int megasas_get_ld_vf_affiliation_12(struct
> megasas_instance *instance,
>  	}
>  out:
>  	if (doscan) {
> -		printk(KERN_WARNING "megasas: SR-IOV: Got new LD/VF "
> -		       "affiliation for scsi%d.\n", instance->host->host_no);
> +		dev_warn(&instance->pdev->dev, "SR-IOV: Got new LD/VF "
> +		       "affiliation for scsi%d\n", instance->host->host_no);
>  		memcpy(instance->vf_affiliation, new_affiliation,
>  		       new_affiliation->size);
>  		retval = 1;
> @@ -2164,8 +2162,8 @@ int megasas_sriov_start_heartbeat(struct
> megasas_instance *instance,
>  	cmd = megasas_get_cmd(instance);
>
>  	if (!cmd) {
> -		printk(KERN_DEBUG "megasas:
> megasas_sriov_start_heartbeat: "
> -		       "Failed to get cmd for scsi%d.\n",
> +		dev_printk(KERN_DEBUG, &instance->pdev->dev,
> "megasas_sriov_start_heartbeat: "
> +		       "Failed to get cmd for scsi%d\n",
>  		       instance->host->host_no);
>  		return -ENOMEM;
>  	}
> @@ -2178,9 +2176,9 @@ int megasas_sriov_start_heartbeat(struct
> megasas_instance *instance,
>  					      sizeof(struct
> MR_CTRL_HB_HOST_MEM),
>  					      &instance->hb_host_mem_h);
>  		if (!instance->hb_host_mem) {
> -			printk(KERN_DEBUG "megasas: SR-IOV: Couldn't
> allocate"
> -			       " memory for heartbeat host memory for "
> -			       "scsi%d.\n", instance->host->host_no);
> +			dev_printk(KERN_DEBUG, &instance->pdev->dev, "SR-
> IOV: Couldn't allocate"
> +			       " memory for heartbeat host memory for
> scsi%d\n",
> +			       instance->host->host_no);
>  			retval = -ENOMEM;
>  			goto out;
>  		}
> @@ -2200,7 +2198,7 @@ int megasas_sriov_start_heartbeat(struct
> megasas_instance *instance,
>  	dcmd->sgl.sge32[0].phys_addr = cpu_to_le32(instance-
> >hb_host_mem_h);
>  	dcmd->sgl.sge32[0].length = cpu_to_le32(sizeof(struct
> MR_CTRL_HB_HOST_MEM));
>
> -	printk(KERN_WARNING "megasas: SR-IOV: Starting heartbeat for
> scsi%d\n",
> +	dev_warn(&instance->pdev->dev, "SR-IOV: Starting heartbeat for
> scsi%d\n",
>  	       instance->host->host_no);
>
>  	if (instance->ctrl_context && !instance->mask_interrupts)
> @@ -2236,7 +2234,7 @@ void megasas_sriov_heartbeat_handler(unsigned
> long instance_addr)
>  		mod_timer(&instance->sriov_heartbeat_timer,
>  			  jiffies + MEGASAS_SRIOV_HEARTBEAT_INTERVAL_VF);
>  	} else {
> -		printk(KERN_WARNING "megasas: SR-IOV: Heartbeat never "
> +		dev_warn(&instance->pdev->dev, "SR-IOV: Heartbeat never "
>  		       "completed for scsi%d\n", instance->host->host_no);
>  		schedule_work(&instance->work_init);
>  	}
> @@ -2274,7 +2272,7 @@ static int megasas_wait_for_outstanding(struct
> megasas_instance *instance)
>  				&clist_local);
>  		spin_unlock_irqrestore(&instance->hba_lock, flags);
>
> -		printk(KERN_NOTICE "megasas: HBA reset wait ...\n");
> +		dev_notice(&instance->pdev->dev, "HBA reset wait ...\n");
>  		for (i = 0; i < wait_time; i++) {
>  			msleep(1000);
>  			spin_lock_irqsave(&instance->hba_lock, flags);
> @@ -2285,7 +2283,7 @@ static int megasas_wait_for_outstanding(struct
> megasas_instance *instance)
>  		}
>
>  		if (adprecovery != MEGASAS_HBA_OPERATIONAL) {
> -			printk(KERN_NOTICE "megasas: reset: Stopping
> HBA.\n");
> +			dev_notice(&instance->pdev->dev, "reset: Stopping
> HBA.\n");
>  			spin_lock_irqsave(&instance->hba_lock, flags);
>  			instance->adprecovery	=
> MEGASAS_HW_CRITICAL_ERROR;
>  			spin_unlock_irqrestore(&instance->hba_lock, flags);
> @@ -2299,14 +2297,14 @@ static int megasas_wait_for_outstanding(struct
> megasas_instance *instance)
>  			list_del_init(&reset_cmd->list);
>  			if (reset_cmd->scmd) {
>  				reset_cmd->scmd->result = DID_RESET << 16;
> -				printk(KERN_NOTICE "%d:%p reset [%02x]\n",
> +				dev_notice(&instance->pdev->dev, "%d:%p
> reset [%02x]\n",
>  					reset_index, reset_cmd,
>  					reset_cmd->scmd->cmnd[0]);
>
>  				reset_cmd->scmd->scsi_done(reset_cmd-
> >scmd);
>  				megasas_return_cmd(instance, reset_cmd);
>  			} else if (reset_cmd->sync_cmd) {
> -				printk(KERN_NOTICE "megasas:%p synch
> cmds"
> +				dev_notice(&instance->pdev->dev, "%p synch
> cmds"
>  						"reset queue\n",
>  						reset_cmd);
>
> @@ -2315,7 +2313,7 @@ static int megasas_wait_for_outstanding(struct
> megasas_instance *instance)
>  						reset_cmd->frame_phys_addr,
>  						0, instance->reg_set);
>  			} else {
> -				printk(KERN_NOTICE "megasas: %p
> unexpected"
> +				dev_notice(&instance->pdev->dev, "%p
> unexpected"
>  					"cmds lst\n",
>  					reset_cmd);
>  			}
> @@ -2333,7 +2331,7 @@ static int megasas_wait_for_outstanding(struct
> megasas_instance *instance)
>  			break;
>
>  		if (!(i % MEGASAS_RESET_NOTICE_INTERVAL)) {
> -			printk(KERN_NOTICE "megasas: [%2d]waiting for %d "
> +			dev_notice(&instance->pdev->dev, "[%2d]waiting for
> %d "
>  			       "commands to complete\n",i,outstanding);
>  			/*
>  			 * Call cmd completion routine. Cmd to be
> @@ -2384,7 +2382,7 @@ static int megasas_wait_for_outstanding(struct
> megasas_instance *instance)
>
>  	if (atomic_read(&instance->fw_outstanding) ||
>  					(kill_adapter_flag == 2)) {
> -		printk(KERN_NOTICE "megaraid_sas: pending cmds after
> reset\n");
> +		dev_notice(&instance->pdev->dev, "pending cmds after
> reset\n");
>  		/*
>  		* Send signal to FW to stop processing any pending cmds.
>  		* The controller will be taken offline by the OS now.
> @@ -2406,7 +2404,7 @@ static int megasas_wait_for_outstanding(struct
> megasas_instance *instance)
>  		return FAILED;
>  	}
>
> -	printk(KERN_NOTICE "megaraid_sas: no pending cmds after reset\n");
> +	dev_notice(&instance->pdev->dev, "no pending cmds after reset\n");
>
>  	return SUCCESS;
>  }
> @@ -2430,16 +2428,15 @@ static int megasas_generic_reset(struct scsi_cmnd
> *scmd)
>  		 scmd->cmnd[0], scmd->retries);
>
>  	if (instance->adprecovery == MEGASAS_HW_CRITICAL_ERROR) {
> -		printk(KERN_ERR "megasas: cannot recover from previous reset
> "
> -		       "failures\n");
> +		dev_err(&instance->pdev->dev, "cannot recover from previous
> reset failures\n");
>  		return FAILED;
>  	}
>
>  	ret_val = megasas_wait_for_outstanding(instance);
>  	if (ret_val == SUCCESS)
> -		printk(KERN_NOTICE "megasas: reset successful \n");
> +		dev_notice(&instance->pdev->dev, "reset successful\n");
>  	else
> -		printk(KERN_ERR "megasas: failed to do reset\n");
> +		dev_err(&instance->pdev->dev, "failed to do reset\n");
>
>  	return ret_val;
>  }
> @@ -2597,7 +2594,7 @@ megasas_service_aen(struct megasas_instance
> *instance, struct megasas_cmd *cmd)
>  		struct megasas_aen_event *ev;
>  		ev = kzalloc(sizeof(*ev), GFP_ATOMIC);
>  		if (!ev) {
> -			printk(KERN_ERR "megasas_service_aen: out of
> memory\n");
> +			dev_err(&instance->pdev->dev, "megasas_service_aen:
> out of memory\n");
>  		} else {
>  			ev->instance = instance;
>  			instance->ev = ev;
> @@ -2847,10 +2844,10 @@ megasas_complete_cmd(struct megasas_instance
> *instance, struct megasas_cmd *cmd,
>  		   MR_DCMD_CTRL_EVENT_GET_INFO left over from the main
> kernel
>  		   when booting the kdump kernel.  Ignore this command to
>  		   prevent a kernel panic on shutdown of the kdump kernel. */
> -		printk(KERN_WARNING "megaraid_sas: MFI_CMD_INVALID
> command "
> -		       "completed.\n");
> -		printk(KERN_WARNING "megaraid_sas: If you have a controller
> "
> -		       "other than PERC5, please upgrade your firmware.\n");
> +		dev_warn(&instance->pdev->dev, "MFI_CMD_INVALID
> command "
> +		       "completed\n");
> +		dev_warn(&instance->pdev->dev, "If you have a controller "
> +		       "other than PERC5, please upgrade your firmware\n");
>  		break;
>  	case MFI_CMD_PD_SCSI_IO:
>  	case MFI_CMD_LD_SCSI_IO:
> @@ -2918,7 +2915,7 @@ megasas_complete_cmd(struct megasas_instance
> *instance, struct megasas_cmd *cmd,
>  			break;
>
>  		default:
> -			printk(KERN_DEBUG "megasas: MFI FW status %#x\n",
> +			dev_printk(KERN_DEBUG, &instance->pdev->dev, "MFI
> FW status %#x\n",
>  			       hdr->cmd_status);
>  			cmd->scmd->result = DID_ERROR << 16;
>  			break;
> @@ -2944,8 +2941,7 @@ megasas_complete_cmd(struct megasas_instance
> *instance, struct megasas_cmd *cmd,
>  			if (cmd->frame->hdr.cmd_status != 0) {
>  				if (cmd->frame->hdr.cmd_status !=
>  				    MFI_STAT_NOT_FOUND)
> -					printk(KERN_WARNING "megasas: map
> sync"
> -					       "failed, status = 0x%x.\n",
> +					dev_warn(&instance->pdev->dev,
> "map syncfailed, status = 0x%x\n",
>  					       cmd->frame->hdr.cmd_status);
>  				else {
>  					megasas_return_cmd(instance, cmd);
> @@ -2997,7 +2993,7 @@ megasas_complete_cmd(struct megasas_instance
> *instance, struct megasas_cmd *cmd,
>  		break;
>
>  	default:
> -		printk("megasas: Unknown command completed! [0x%X]\n",
> +		dev_info(&instance->pdev->dev, "Unknown command
> completed! [0x%X]\n",
>  		       hdr->cmd);
>  		break;
>  	}
> @@ -3028,14 +3024,14 @@ megasas_issue_pending_cmds_again(struct
> megasas_instance *instance)
>  		list_del_init(&cmd->list);
>
>  		if (cmd->sync_cmd || cmd->scmd) {
> -			printk(KERN_NOTICE "megaraid_sas: command %p,
> %p:%d"
> -				"detected to be pending while HBA reset.\n",
> +			dev_notice(&instance->pdev->dev, "command %p,
> %p:%d"
> +				"detected to be pending while HBA reset\n",
>  					cmd, cmd->scmd, cmd->sync_cmd);
>
>  			cmd->retry_for_fw_reset++;
>
>  			if (cmd->retry_for_fw_reset == 3) {
> -				printk(KERN_NOTICE "megaraid_sas: cmd %p,
> %p:%d"
> +				dev_notice(&instance->pdev->dev, "cmd %p,
> %p:%d"
>  					"was tried multiple times during reset."
>  					"Shutting down the HBA\n",
>  					cmd, cmd->scmd, cmd->sync_cmd);
> @@ -3048,10 +3044,10 @@ megasas_issue_pending_cmds_again(struct
> megasas_instance *instance)
>
>  		if (cmd->sync_cmd == 1) {
>  			if (cmd->scmd) {
> -				printk(KERN_NOTICE "megaraid_sas:
> unexpected"
> +				dev_notice(&instance->pdev->dev,
> "unexpected"
>  					"cmd attached to internal
> command!\n");
>  			}
> -			printk(KERN_NOTICE "megasas: %p synchronous cmd"
> +			dev_notice(&instance->pdev->dev, "%p synchronous
> cmd"
>  						"on the internal reset queue,"
>  						"issue it again.\n", cmd);
>  			cmd->cmd_status_drv = MFI_STAT_INVALID_STATUS;
> @@ -3059,7 +3055,7 @@ megasas_issue_pending_cmds_again(struct
> megasas_instance *instance)
>  							cmd-
> >frame_phys_addr ,
>  							0, instance->reg_set);
>  		} else if (cmd->scmd) {
> -			printk(KERN_NOTICE "megasas: %p scsi cmd [%02x]"
> +			dev_notice(&instance->pdev->dev, "%p scsi cmd
> [%02x]"
>  			"detected on the internal queue, issue again.\n",
>  			cmd, cmd->scmd->cmnd[0]);
>
> @@ -3068,14 +3064,14 @@ megasas_issue_pending_cmds_again(struct
> megasas_instance *instance)
>  					cmd->frame_phys_addr,
>  					cmd->frame_count-1, instance-
> >reg_set);
>  		} else {
> -			printk(KERN_NOTICE "megasas: %p unexpected cmd on
> the"
> +			dev_notice(&instance->pdev->dev, "%p unexpected
> cmd on the"
>  				"internal reset defer list while re-issue!!\n",
>  				cmd);
>  		}
>  	}
>
>  	if (instance->aen_cmd) {
> -		printk(KERN_NOTICE "megaraid_sas: aen_cmd in def
> process\n");
> +		dev_notice(&instance->pdev->dev, "aen_cmd in def
> process\n");
>  		megasas_return_cmd(instance, instance->aen_cmd);
>
>  		instance->aen_cmd	= NULL;
> @@ -3115,12 +3111,12 @@ megasas_internal_reset_defer_cmds(struct
> megasas_instance *instance)
>  	for (i = 0; i < max_cmd; i++) {
>  		cmd = instance->cmd_list[i];
>  		if (cmd->sync_cmd == 1 || cmd->scmd) {
> -			printk(KERN_NOTICE "megasas: moving
> cmd[%d]:%p:%d:%p"
> +			dev_notice(&instance->pdev->dev, "moving
> cmd[%d]:%p:%d:%p"
>  					"on the defer queue as internal\n",
>  				defer_index, cmd, cmd->sync_cmd, cmd-
> >scmd);
>
>  			if (!list_empty(&cmd->list)) {
> -				printk(KERN_NOTICE "megaraid_sas: ERROR
> while"
> +				dev_notice(&instance->pdev->dev, "ERROR
> while"
>  					" moving this cmd:%p, %d %p, it was"
>  					"discovered on some list?\n",
>  					cmd, cmd->sync_cmd, cmd->scmd);
> @@ -3145,13 +3141,13 @@ process_fw_state_change_wq(struct work_struct
> *work)
>  	unsigned long flags;
>
>  	if (instance->adprecovery != MEGASAS_ADPRESET_SM_INFAULT) {
> -		printk(KERN_NOTICE "megaraid_sas: error, recovery st %x \n",
> +		dev_notice(&instance->pdev->dev, "error, recovery st %x\n",
>  				instance->adprecovery);
>  		return ;
>  	}
>
>  	if (instance->adprecovery == MEGASAS_ADPRESET_SM_INFAULT) {
> -		printk(KERN_NOTICE "megaraid_sas: FW detected to be in
> fault"
> +		dev_notice(&instance->pdev->dev, "FW detected to be in fault"
>  					"state, restarting it...\n");
>
>  		instance->instancet->disable_intr(instance);
> @@ -3161,10 +3157,10 @@ process_fw_state_change_wq(struct work_struct
> *work)
>  		instance->instancet->adp_reset(instance, instance->reg_set);
>  		atomic_set(&instance->fw_reset_no_pci_access, 0 );
>
> -		printk(KERN_NOTICE "megaraid_sas: FW restarted
> successfully,"
> +		dev_notice(&instance->pdev->dev, "FW restarted successfully,"
>  					"initiating next stage...\n");
>
> -		printk(KERN_NOTICE "megaraid_sas: HBA recovery state
> machine,"
> +		dev_notice(&instance->pdev->dev, "HBA recovery state
> machine,"
>  					"state 2 starting...\n");
>
>  		/*waitting for about 20 second before start the second init*/
> @@ -3173,7 +3169,7 @@ process_fw_state_change_wq(struct work_struct
> *work)
>  		}
>
>  		if (megasas_transition_to_ready(instance, 1)) {
> -			printk(KERN_NOTICE "megaraid_sas:adapter not
> ready\n");
> +			dev_notice(&instance->pdev->dev, "adapter not
> ready\n");
>
>  			atomic_set(&instance->fw_reset_no_pci_access, 1);
>  			megaraid_sas_kill_hba(instance);
> @@ -3238,13 +3234,13 @@ megasas_deplete_reply_queue(struct
> megasas_instance *instance,
>  				instance->reg_set) & MFI_STATE_MASK;
>
>  		if (fw_state != MFI_STATE_FAULT) {
> -			printk(KERN_NOTICE "megaraid_sas: fw state:%x\n",
> +			dev_notice(&instance->pdev->dev, "fw state:%x\n",
>  						fw_state);
>  		}
>
>  		if ((fw_state == MFI_STATE_FAULT) &&
>  				(instance->disableOnlineCtrlReset == 0)) {
> -			printk(KERN_NOTICE "megaraid_sas: wait adp
> restart\n");
> +			dev_notice(&instance->pdev->dev, "wait adp
> restart\n");
>
>  			if ((instance->pdev->device ==
>  					PCI_DEVICE_ID_LSI_SAS1064R) ||
> @@ -3265,14 +3261,14 @@ megasas_deplete_reply_queue(struct
> megasas_instance *instance,
>  			atomic_set(&instance->fw_outstanding, 0);
>  			megasas_internal_reset_defer_cmds(instance);
>
> -			printk(KERN_NOTICE "megasas: fwState=%x,
> stage:%d\n",
> +			dev_notice(&instance->pdev->dev, "fwState=%x,
> stage:%d\n",
>  					fw_state, instance->adprecovery);
>
>  			schedule_work(&instance->work_init);
>  			return IRQ_HANDLED;
>
>  		} else {
> -			printk(KERN_NOTICE "megasas: fwstate:%x,
> dis_OCR=%x\n",
> +			dev_notice(&instance->pdev->dev, "fwstate:%x,
> dis_OCR=%x\n",
>  				fw_state, instance->disableOnlineCtrlReset);
>  		}
>  	}
> @@ -3322,7 +3318,7 @@ megasas_transition_to_ready(struct
> megasas_instance *instance, int ocr)
>  	fw_state = abs_state & MFI_STATE_MASK;
>
>  	if (fw_state != MFI_STATE_READY)
> -		printk(KERN_INFO "megasas: Waiting for FW to come to ready"
> +		dev_info(&instance->pdev->dev, "Waiting for FW to come to
> ready"
>  		       " state\n");
>
>  	while (fw_state != MFI_STATE_READY) {
> @@ -3330,7 +3326,7 @@ megasas_transition_to_ready(struct
> megasas_instance *instance, int ocr)
>  		switch (fw_state) {
>
>  		case MFI_STATE_FAULT:
> -			printk(KERN_DEBUG "megasas: FW in FAULT
> state!!\n");
> +			dev_printk(KERN_DEBUG, &instance->pdev->dev, "FW
> in FAULT state!!\n");
>  			if (ocr) {
>  				max_wait = MEGASAS_RESET_WAIT_TIME;
>  				cur_state = MFI_STATE_FAULT;
> @@ -3469,7 +3465,7 @@ megasas_transition_to_ready(struct
> megasas_instance *instance, int ocr)
>  			break;
>
>  		default:
> -			printk(KERN_DEBUG "megasas: Unknown state
> 0x%x\n",
> +			dev_printk(KERN_DEBUG, &instance->pdev->dev,
> "Unknown state 0x%x\n",
>  			       fw_state);
>  			return -ENODEV;
>  		}
> @@ -3491,7 +3487,7 @@ megasas_transition_to_ready(struct
> megasas_instance *instance, int ocr)
>  		 * Return error if fw_state hasn't changed after max_wait
>  		 */
>  		if (curr_abs_state == abs_state) {
> -			printk(KERN_DEBUG "FW state [%d] hasn't changed "
> +			dev_printk(KERN_DEBUG, &instance->pdev->dev, "FW
> state [%d] hasn't changed "
>  			       "in %d secs\n", fw_state, max_wait);
>  			return -ENODEV;
>  		}
> @@ -3499,7 +3495,7 @@ megasas_transition_to_ready(struct
> megasas_instance *instance, int ocr)
>  		abs_state = curr_abs_state;
>  		fw_state = curr_abs_state & MFI_STATE_MASK;
>  	}
> -	printk(KERN_INFO "megasas: FW now in Ready state\n");
> +	dev_info(&instance->pdev->dev, "FW now in Ready state\n");
>
>  	return 0;
>  }
> @@ -3594,7 +3590,7 @@ static int megasas_create_frame_pool(struct
> megasas_instance *instance)
>  					instance->pdev, total_sz, 256, 0);
>
>  	if (!instance->frame_dma_pool) {
> -		printk(KERN_DEBUG "megasas: failed to setup frame pool\n");
> +		dev_printk(KERN_DEBUG, &instance->pdev->dev, "failed to
> setup frame pool\n");
>  		return -ENOMEM;
>  	}
>
> @@ -3602,7 +3598,7 @@ static int megasas_create_frame_pool(struct
> megasas_instance *instance)
>  						   instance->pdev, 128, 4, 0);
>
>  	if (!instance->sense_dma_pool) {
> -		printk(KERN_DEBUG "megasas: failed to setup sense pool\n");
> +		dev_printk(KERN_DEBUG, &instance->pdev->dev, "failed to
> setup sense pool\n");
>
>  		pci_pool_destroy(instance->frame_dma_pool);
>  		instance->frame_dma_pool = NULL;
> @@ -3630,7 +3626,7 @@ static int megasas_create_frame_pool(struct
> megasas_instance *instance)
>  		 * whatever has been allocated
>  		 */
>  		if (!cmd->frame || !cmd->sense) {
> -			printk(KERN_DEBUG "megasas: pci_pool_alloc failed
> \n");
> +			dev_printk(KERN_DEBUG, &instance->pdev->dev,
> "pci_pool_alloc failed\n");
>  			megasas_teardown_frame_pool(instance);
>  			return -ENOMEM;
>  		}
> @@ -3708,7 +3704,7 @@ int megasas_alloc_cmds(struct megasas_instance
> *instance)
>  	instance->cmd_list = kcalloc(max_cmd, sizeof(struct megasas_cmd*),
> GFP_KERNEL);
>
>  	if (!instance->cmd_list) {
> -		printk(KERN_DEBUG "megasas: out of memory\n");
> +		dev_printk(KERN_DEBUG, &instance->pdev->dev, "out of
> memory\n");
>  		return -ENOMEM;
>  	}
>
> @@ -3744,7 +3740,7 @@ int megasas_alloc_cmds(struct megasas_instance
> *instance)
>  	 * Create a frame pool and assign one frame to each cmd
>  	 */
>  	if (megasas_create_frame_pool(instance)) {
> -		printk(KERN_DEBUG "megasas: Error creating frame DMA
> pool\n");
> +		dev_printk(KERN_DEBUG, &instance->pdev->dev, "Error
> creating frame DMA pool\n");
>  		megasas_free_cmds(instance);
>  	}
>
> @@ -3773,7 +3769,7 @@ megasas_get_pd_list(struct megasas_instance
> *instance)
>  	cmd = megasas_get_cmd(instance);
>
>  	if (!cmd) {
> -		printk(KERN_DEBUG "megasas (get_pd_list): Failed to get
> cmd\n");
> +		dev_printk(KERN_DEBUG, &instance->pdev->dev,
> "(get_pd_list): Failed to get cmd\n");
>  		return -ENOMEM;
>  	}
>
> @@ -3783,7 +3779,7 @@ megasas_get_pd_list(struct megasas_instance
> *instance)
>  		  MEGASAS_MAX_PD * sizeof(struct MR_PD_LIST), &ci_h);
>
>  	if (!ci) {
> -		printk(KERN_DEBUG "Failed to alloc mem for pd_list\n");
> +		dev_printk(KERN_DEBUG, &instance->pdev->dev, "Failed to
> alloc mem for pd_list\n");
>  		megasas_return_cmd(instance, cmd);
>  		return -ENOMEM;
>  	}
> @@ -3868,7 +3864,7 @@ megasas_get_ld_list(struct megasas_instance
> *instance)
>  	cmd = megasas_get_cmd(instance);
>
>  	if (!cmd) {
> -		printk(KERN_DEBUG "megasas_get_ld_list: Failed to get
> cmd\n");
> +		dev_printk(KERN_DEBUG, &instance->pdev->dev,
> "megasas_get_ld_list: Failed to get cmd\n");
>  		return -ENOMEM;
>  	}
>
> @@ -3879,7 +3875,7 @@ megasas_get_ld_list(struct megasas_instance
> *instance)
>  				&ci_h);
>
>  	if (!ci) {
> -		printk(KERN_DEBUG "Failed to alloc mem in get_ld_list\n");
> +		dev_printk(KERN_DEBUG, &instance->pdev->dev, "Failed to
> alloc mem in get_ld_list\n");
>  		megasas_return_cmd(instance, cmd);
>  		return -ENOMEM;
>  	}
> @@ -3954,8 +3950,8 @@ megasas_ld_list_query(struct megasas_instance
> *instance, u8 query_type)
>  	cmd = megasas_get_cmd(instance);
>
>  	if (!cmd) {
> -		printk(KERN_WARNING
> -		       "megasas:(megasas_ld_list_query): Failed to get cmd\n");
> +		dev_warn(&instance->pdev->dev,
> +		         "megasas_ld_list_query: Failed to get cmd\n");
>  		return -ENOMEM;
>  	}
>
> @@ -3965,8 +3961,8 @@ megasas_ld_list_query(struct megasas_instance
> *instance, u8 query_type)
>  				  sizeof(struct MR_LD_TARGETID_LIST), &ci_h);
>
>  	if (!ci) {
> -		printk(KERN_WARNING
> -		       "megasas: Failed to alloc mem for ld_list_query\n");
> +		dev_warn(&instance->pdev->dev,
> +		         "Failed to alloc mem for ld_list_query\n");
>  		megasas_return_cmd(instance, cmd);
>  		return -ENOMEM;
>  	}
> @@ -4093,7 +4089,7 @@ megasas_get_ctrl_info(struct megasas_instance
> *instance)
>  	cmd = megasas_get_cmd(instance);
>
>  	if (!cmd) {
> -		printk(KERN_DEBUG "megasas: Failed to get a free cmd\n");
> +		dev_printk(KERN_DEBUG, &instance->pdev->dev, "Failed to get
> a free cmd\n");
>  		return -ENOMEM;
>  	}
>
> @@ -4103,7 +4099,7 @@ megasas_get_ctrl_info(struct megasas_instance
> *instance)
>  				  sizeof(struct megasas_ctrl_info), &ci_h);
>
>  	if (!ci) {
> -		printk(KERN_DEBUG "Failed to alloc mem for ctrl info\n");
> +		dev_printk(KERN_DEBUG, &instance->pdev->dev, "Failed to
> alloc mem for ctrl info\n");
>  		megasas_return_cmd(instance, cmd);
>  		return -ENOMEM;
>  	}
> @@ -4269,7 +4265,7 @@ megasas_issue_init_mfi(struct megasas_instance
> *instance)
>  	 */
>
>  	if (megasas_issue_polled(instance, cmd)) {
> -		printk(KERN_ERR "megasas: Failed to init firmware\n");
> +		dev_err(&instance->pdev->dev, "Failed to init firmware\n");
>  		megasas_return_cmd(instance, cmd);
>  		goto fail_fw_init;
>  	}
> @@ -4342,7 +4338,7 @@ megasas_init_adapter_mfi(struct megasas_instance
> *instance)
>  						     &instance->reply_queue_h);
>
>  	if (!instance->reply_queue) {
> -		printk(KERN_DEBUG "megasas: Out of DMA mem for reply
> queue\n");
> +		dev_printk(KERN_DEBUG, &instance->pdev->dev, "Out of DMA
> mem for reply queue\n");
>  		goto fail_reply_queue;
>  	}
>
> @@ -4361,7 +4357,7 @@ megasas_init_adapter_mfi(struct megasas_instance
> *instance)
>  		(instance->instancet->read_fw_status_reg(reg_set) &
>  		0x04000000);
>
> -	printk(KERN_NOTICE "megasas_init_mfi: fw_support_ieee=%d",
> +	dev_notice(&instance->pdev->dev, "megasas_init_mfi:
> fw_support_ieee=%d",
>  			instance->fw_support_ieee);
>
>  	if (instance->fw_support_ieee)
> @@ -4505,7 +4501,7 @@ static int megasas_init_fw(struct megasas_instance
> *instance)
>  	instance->bar = find_first_bit(&bar_list, sizeof(unsigned long));
>  	if (pci_request_selected_regions(instance->pdev, instance->bar,
>  					 "megasas: LSI")) {
> -		printk(KERN_DEBUG "megasas: IO memory region busy!\n");
> +		dev_printk(KERN_DEBUG, &instance->pdev->dev, "IO memory
> region busy!\n");
>  		return -EBUSY;
>  	}
>
> @@ -4513,7 +4509,7 @@ static int megasas_init_fw(struct megasas_instance
> *instance)
>  	instance->reg_set = ioremap_nocache(base_addr, 8192);
>
>  	if (!instance->reg_set) {
> -		printk(KERN_DEBUG "megasas: Failed to map IO mem\n");
> +		dev_printk(KERN_DEBUG, &instance->pdev->dev, "Failed to
> map IO mem\n");
>  		goto fail_ioremap;
>  	}
>
> @@ -4551,7 +4547,7 @@ static int megasas_init_fw(struct megasas_instance
> *instance)
>  			(instance, instance->reg_set);
>  		atomic_set(&instance->fw_reset_no_pci_access, 0);
>  		dev_info(&instance->pdev->dev,
> -			"megasas: FW restarted successfully from %s!\n",
> +			"FW restarted successfully from %s!\n",
>  			__func__);
>
>  		/*waitting for about 30 second before retry*/
> @@ -4652,7 +4648,7 @@ static int megasas_init_fw(struct megasas_instance
> *instance)
>
>  	instance->instancet->enable_intr(instance);
>
> -	printk(KERN_ERR "megasas: INIT adapter done\n");
> +	dev_err(&instance->pdev->dev, "INIT adapter done\n");
>
>  	/** for passthrough
>  	* the following function will get the PD LIST.
> @@ -4661,7 +4657,7 @@ static int megasas_init_fw(struct megasas_instance
> *instance)
>  	memset(instance->pd_list, 0 ,
>  		(MEGASAS_MAX_PD * sizeof(struct megasas_pd_list)));
>  	if (megasas_get_pd_list(instance) < 0) {
> -		printk(KERN_ERR "megasas: failed to get PD list\n");
> +		dev_err(&instance->pdev->dev, "failed to get PD list\n");
>  		goto fail_get_pd_list;
>  	}
>
> @@ -4960,7 +4956,7 @@ megasas_register_aen(struct megasas_instance
> *instance, u32 seq_num,
>  								  aen_cmd,
> 30);
>
>  			if (ret_val) {
> -				printk(KERN_DEBUG "megasas: Failed to abort
> "
> +				dev_printk(KERN_DEBUG, &instance->pdev-
> >dev, "Failed to abort "
>  				       "previous AEN command\n");
>  				return ret_val;
>  			}
> @@ -5079,7 +5075,7 @@ static int megasas_io_attach(struct
> megasas_instance *instance)
>  				(max_sectors <= MEGASAS_MAX_SECTORS)) {
>  				instance->max_sectors_per_req =
> max_sectors;
>  			} else {
> -			printk(KERN_INFO "megasas: max_sectors should be >
> 0"
> +			dev_info(&instance->pdev->dev, "max_sectors should
> be > 0"
>  				"and <= %d (or < 1MB for GEN2 controller)\n",
>  				instance->max_sectors_per_req);
>  			}
> @@ -5206,7 +5202,7 @@ static int megasas_probe_one(struct pci_dev *pdev,
>  			       sizeof(struct megasas_instance));
>
>  	if (!host) {
> -		printk(KERN_DEBUG "megasas: scsi_host_alloc failed\n");
> +		dev_printk(KERN_DEBUG, &pdev->dev, "scsi_host_alloc
> failed\n");
>  		goto fail_alloc_instance;
>  	}
>
> @@ -5226,7 +5222,7 @@ static int megasas_probe_one(struct pci_dev *pdev,
>  		instance->ctrl_context = (void
> *)__get_free_pages(GFP_KERNEL,
>  				instance->ctrl_context_pages);
>  		if (!instance->ctrl_context) {
> -			printk(KERN_DEBUG "megasas: Failed to allocate "
> +			dev_printk(KERN_DEBUG, &pdev->dev, "Failed to
> allocate "
>  			       "memory for Fusion context info\n");
>  			goto fail_alloc_dma_buf;
>  		}
> @@ -5245,7 +5241,7 @@ static int megasas_probe_one(struct pci_dev *pdev,
>  					     &instance->consumer_h);
>
>  		if (!instance->producer || !instance->consumer) {
> -			printk(KERN_DEBUG "megasas: Failed to allocate"
> +			dev_printk(KERN_DEBUG, &pdev->dev, "Failed to
> allocate"
>  			       "memory for producer, consumer\n");
>  			goto fail_alloc_dma_buf;
>  		}
> @@ -5276,7 +5272,7 @@ static int megasas_probe_one(struct pci_dev *pdev,
>  						CRASH_DMA_BUF_SIZE,
>  						&instance->crash_dump_h);
>  	if (!instance->crash_dump_buf)
> -		dev_err(&instance->pdev->dev, "Can't allocate Firmware "
> +		dev_err(&pdev->dev, "Can't allocate Firmware "
>  			"crash dump DMA buffer\n");
>
>  	megasas_poll_wait_aen = 0;
> @@ -5292,7 +5288,7 @@ static int megasas_probe_one(struct pci_dev *pdev,
>  						    &instance->evt_detail_h);
>
>  	if (!instance->evt_detail) {
> -		printk(KERN_DEBUG "megasas: Failed to allocate memory for "
> +		dev_printk(KERN_DEBUG, &pdev->dev, "Failed to allocate
> memory for "
>  		       "event detail structure\n");
>  		goto fail_alloc_dma_buf;
>  	}
> @@ -5356,7 +5352,7 @@ static int megasas_probe_one(struct pci_dev *pdev,
>  				pci_alloc_consistent(pdev, sizeof(struct
> MR_LD_VF_AFFILIATION_111),
>  						     &instance-
> >vf_affiliation_111_h);
>  			if (!instance->vf_affiliation_111)
> -				printk(KERN_WARNING "megasas: Can't
> allocate "
> +				dev_warn(&pdev->dev, "Can't allocate "
>  				       "memory for VF affiliation buffer\n");
>  		} else {
>  			instance->vf_affiliation =
> @@ -5365,7 +5361,7 @@ static int megasas_probe_one(struct pci_dev *pdev,
>  						     sizeof(struct
> MR_LD_VF_AFFILIATION),
>  						     &instance-
> >vf_affiliation_h);
>  			if (!instance->vf_affiliation)
> -				printk(KERN_WARNING "megasas: Can't
> allocate "
> +				dev_warn(&pdev->dev, "Can't allocate "
>  				       "memory for VF affiliation buffer\n");
>  		}
>  	}
> @@ -5399,7 +5395,7 @@ static int megasas_probe_one(struct pci_dev *pdev,
>  	 * Initiate AEN (Asynchronous Event Notification)
>  	 */
>  	if (megasas_start_aen(instance)) {
> -		printk(KERN_DEBUG "megasas: start aen failed\n");
> +		dev_printk(KERN_DEBUG, &pdev->dev, "start aen failed\n");
>  		goto fail_start_aen;
>  	}
>
> @@ -5607,7 +5603,7 @@ megasas_resume(struct pci_dev *pdev)
>  	rval = pci_enable_device_mem(pdev);
>
>  	if (rval) {
> -		printk(KERN_ERR "megasas: Enable device failed\n");
> +		dev_err(&pdev->dev, "Enable device failed\n");
>  		return rval;
>  	}
>
> @@ -5686,7 +5682,7 @@ megasas_resume(struct pci_dev *pdev)
>  	 * Initiate AEN (Asynchronous Event Notification)
>  	 */
>  	if (megasas_start_aen(instance))
> -		printk(KERN_ERR "megasas: Start AEN failed\n");
> +		dev_err(&instance->pdev->dev, "Start AEN failed\n");
>
>  	return 0;
>
> @@ -5982,14 +5978,14 @@ megasas_mgmt_fw_ioctl(struct megasas_instance
> *instance,
>  	memset(kbuff_arr, 0, sizeof(kbuff_arr));
>
>  	if (ioc->sge_count > MAX_IOCTL_SGE) {
> -		printk(KERN_DEBUG "megasas: SGE count [%d] >  max limit
> [%d]\n",
> +		dev_printk(KERN_DEBUG, &instance->pdev->dev, "SGE count
> [%d] >  max limit [%d]\n",
>  		       ioc->sge_count, MAX_IOCTL_SGE);
>  		return -EINVAL;
>  	}
>
>  	cmd = megasas_get_cmd(instance);
>  	if (!cmd) {
> -		printk(KERN_DEBUG "megasas: Failed to get a cmd packet\n");
> +		dev_printk(KERN_DEBUG, &instance->pdev->dev, "Failed to get
> a cmd packet\n");
>  		return -ENOMEM;
>  	}
>
> @@ -6034,8 +6030,8 @@ megasas_mgmt_fw_ioctl(struct megasas_instance
> *instance,
>  						    ioc->sgl[i].iov_len,
>  						    &buf_handle, GFP_KERNEL);
>  		if (!kbuff_arr[i]) {
> -			printk(KERN_DEBUG "megasas: Failed to alloc "
> -			       "kernel SGL buffer for IOCTL \n");
> +			dev_printk(KERN_DEBUG, &instance->pdev->dev,
> "Failed to alloc "
> +			       "kernel SGL buffer for IOCTL\n");
>  			error = -ENOMEM;
>  			goto out;
>  		}
> @@ -6108,7 +6104,7 @@ megasas_mgmt_fw_ioctl(struct megasas_instance
> *instance,
>
>  		if (copy_to_user((void __user *)((unsigned long)(*sense_ptr)),
>  				 sense, ioc->sense_len)) {
> -			printk(KERN_ERR "megasas: Failed to copy out to user "
> +			dev_err(&instance->pdev->dev, "Failed to copy out to
> user "
>  					"sense data\n");
>  			error = -EFAULT;
>  			goto out;
> @@ -6120,7 +6116,7 @@ megasas_mgmt_fw_ioctl(struct megasas_instance
> *instance,
>  	 */
>  	if (copy_to_user(&user_ioc->frame.hdr.cmd_status,
>  			 &cmd->frame->hdr.cmd_status, sizeof(u8))) {
> -		printk(KERN_DEBUG "megasas: Error copying out
> cmd_status\n");
> +		dev_printk(KERN_DEBUG, &instance->pdev->dev, "Error
> copying out cmd_status\n");
>  		error = -EFAULT;
>  	}
>
> @@ -6180,7 +6176,7 @@ static int megasas_mgmt_ioctl_fw(struct file *file,
> unsigned long arg)
>  	}
>
>  	if (instance->adprecovery == MEGASAS_HW_CRITICAL_ERROR) {
> -		printk(KERN_ERR "Controller in crit error\n");
> +		dev_err(&instance->pdev->dev, "Controller in crit error\n");
>  		error = -ENODEV;
>  		goto out_kfree_ioc;
>  	}
> @@ -6205,7 +6201,7 @@ static int megasas_mgmt_ioctl_fw(struct file *file,
> unsigned long arg)
>  		spin_unlock_irqrestore(&instance->hba_lock, flags);
>
>  		if (!(i % MEGASAS_RESET_NOTICE_INTERVAL)) {
> -			printk(KERN_NOTICE "megasas: waiting"
> +			dev_notice(&instance->pdev->dev, "waiting"
>  				"for controller reset to finish\n");
>  		}
>
> @@ -6216,7 +6212,7 @@ static int megasas_mgmt_ioctl_fw(struct file *file,
> unsigned long arg)
>  	if (instance->adprecovery != MEGASAS_HBA_OPERATIONAL) {
>  		spin_unlock_irqrestore(&instance->hba_lock, flags);
>
> -		printk(KERN_ERR "megaraid_sas: timed out while"
> +		dev_err(&instance->pdev->dev, "timed out while"
>  			"waiting for HBA to recover\n");
>  		error = -ENODEV;
>  		goto out_up;
> @@ -6275,7 +6271,7 @@ static int megasas_mgmt_ioctl_aen(struct file *file,
> unsigned long arg)
>  		spin_unlock_irqrestore(&instance->hba_lock, flags);
>
>  		if (!(i % MEGASAS_RESET_NOTICE_INTERVAL)) {
> -			printk(KERN_NOTICE "megasas: waiting for"
> +			dev_notice(&instance->pdev->dev, "waiting for"
>  				"controller reset to finish\n");
>  		}
>
> @@ -6285,8 +6281,8 @@ static int megasas_mgmt_ioctl_aen(struct file *file,
> unsigned long arg)
>  	spin_lock_irqsave(&instance->hba_lock, flags);
>  	if (instance->adprecovery != MEGASAS_HBA_OPERATIONAL) {
>  		spin_unlock_irqrestore(&instance->hba_lock, flags);
> -		printk(KERN_ERR "megaraid_sas: timed out while waiting"
> -				"for HBA to recover.\n");
> +		dev_err(&instance->pdev->dev, "timed out while waiting"
> +				"for HBA to recover\n");
>  		return -ENODEV;
>  	}
>  	spin_unlock_irqrestore(&instance->hba_lock, flags);
> @@ -6502,7 +6498,7 @@ megasas_aen_polling(struct work_struct *work)
>  		if (instance->adprecovery == MEGASAS_HBA_OPERATIONAL)
>  			break;
>  		if (!(i % MEGASAS_RESET_NOTICE_INTERVAL)) {
> -			printk(KERN_NOTICE "megasas: %s waiting for "
> +			dev_notice(&instance->pdev->dev, "%s waiting for "
>  			       "controller reset to finish for scsi%d\n",
>  			       __func__, instance->host->host_no);
>  		}
> @@ -6644,13 +6640,13 @@ megasas_aen_polling(struct work_struct *work)
>  			break;
>  		}
>  	} else {
> -		printk(KERN_ERR "invalid evt_detail!\n");
> +		dev_err(&instance->pdev->dev, "invalid evt_detail!\n");
>  		kfree(ev);
>  		return;
>  	}
>
>  	if (doscan) {
> -		printk(KERN_INFO "megaraid_sas: scanning for scsi%d...\n",
> +		dev_info(&instance->pdev->dev, "scanning for scsi%d...\n",
>  		       instance->host->host_no);
>  		if (megasas_get_pd_list(instance) == 0) {
>  			for (i = 0; i < MEGASAS_MAX_PD_CHANNELS; i++) {
> @@ -6722,7 +6718,7 @@ megasas_aen_polling(struct work_struct *work)
>  	mutex_unlock(&instance->aen_mutex);
>
>  	if (error)
> -		printk(KERN_ERR "register aen failed error %x\n", error);
> +		dev_err(&instance->pdev->dev, "register aen failed error %x\n",
> error);
>
>  	kfree(ev);
>  }
> diff --git a/drivers/scsi/megaraid/megaraid_sas_fusion.c
> b/drivers/scsi/megaraid/megaraid_sas_fusion.c
> index 46a0f8f..f0837cc 100644
> --- a/drivers/scsi/megaraid/megaraid_sas_fusion.c
> +++ b/drivers/scsi/megaraid/megaraid_sas_fusion.c
> @@ -221,7 +221,7 @@ static void megasas_teardown_frame_pool_fusion(
>  	struct megasas_cmd_fusion *cmd;
>
>  	if (!fusion->sg_dma_pool || !fusion->sense_dma_pool) {
> -		printk(KERN_ERR "megasas: dma pool is null. SG Pool %p, "
> +		dev_err(&instance->pdev->dev, "dma pool is null. SG Pool %p, "
>  		       "sense pool : %p\n", fusion->sg_dma_pool,
>  		       fusion->sense_dma_pool);
>  		return;
> @@ -332,8 +332,7 @@ static int megasas_create_frame_pool_fusion(struct
> megasas_instance *instance)
>  					      total_sz_chain_frame, 4,
>  					      0);
>  	if (!fusion->sg_dma_pool) {
> -		printk(KERN_DEBUG "megasas: failed to setup request pool "
> -		       "fusion\n");
> +		dev_printk(KERN_DEBUG, &instance->pdev->dev, "failed to
> setup request pool fusion\n");
>  		return -ENOMEM;
>  	}
>  	fusion->sense_dma_pool = pci_pool_create("megasas sense pool
> fusion",
> @@ -341,8 +340,7 @@ static int megasas_create_frame_pool_fusion(struct
> megasas_instance *instance)
>  						 SCSI_SENSE_BUFFERSIZE, 64,
> 0);
>
>  	if (!fusion->sense_dma_pool) {
> -		printk(KERN_DEBUG "megasas: failed to setup sense pool "
> -		       "fusion\n");
> +		dev_printk(KERN_DEBUG, &instance->pdev->dev, "failed to
> setup sense pool fusion\n");
>  		pci_pool_destroy(fusion->sg_dma_pool);
>  		fusion->sg_dma_pool = NULL;
>  		return -ENOMEM;
> @@ -366,7 +364,7 @@ static int megasas_create_frame_pool_fusion(struct
> megasas_instance *instance)
>  		 * whatever has been allocated
>  		 */
>  		if (!cmd->sg_frame || !cmd->sense) {
> -			printk(KERN_DEBUG "megasas: pci_pool_alloc
> failed\n");
> +			dev_printk(KERN_DEBUG, &instance->pdev->dev,
> "pci_pool_alloc failed\n");
>  			megasas_teardown_frame_pool_fusion(instance);
>  			return -ENOMEM;
>  		}
> @@ -412,7 +410,7 @@ megasas_alloc_cmds_fusion(struct megasas_instance
> *instance)
>  				   &fusion->req_frames_desc_phys,
> GFP_KERNEL);
>
>  	if (!fusion->req_frames_desc) {
> -		printk(KERN_ERR "megasas; Could not allocate memory for "
> +		dev_err(&instance->pdev->dev, "Could not allocate memory for
> "
>  		       "request_frames\n");
>  		goto fail_req_desc;
>  	}
> @@ -423,7 +421,7 @@ megasas_alloc_cmds_fusion(struct megasas_instance
> *instance)
>  				fusion->reply_alloc_sz * count, 16, 0);
>
>  	if (!fusion->reply_frames_desc_pool) {
> -		printk(KERN_ERR "megasas; Could not allocate memory for "
> +		dev_err(&instance->pdev->dev, "Could not allocate memory for
> "
>  		       "reply_frame pool\n");
>  		goto fail_reply_desc;
>  	}
> @@ -432,7 +430,7 @@ megasas_alloc_cmds_fusion(struct megasas_instance
> *instance)
>  		pci_pool_alloc(fusion->reply_frames_desc_pool, GFP_KERNEL,
>  			       &fusion->reply_frames_desc_phys);
>  	if (!fusion->reply_frames_desc) {
> -		printk(KERN_ERR "megasas; Could not allocate memory for "
> +		dev_err(&instance->pdev->dev, "Could not allocate memory for
> "
>  		       "reply_frame pool\n");
>  		pci_pool_destroy(fusion->reply_frames_desc_pool);
>  		goto fail_reply_desc;
> @@ -449,7 +447,7 @@ megasas_alloc_cmds_fusion(struct megasas_instance
> *instance)
>  				fusion->io_frames_alloc_sz, 16, 0);
>
>  	if (!fusion->io_request_frames_pool) {
> -		printk(KERN_ERR "megasas: Could not allocate memory for "
> +		dev_err(&instance->pdev->dev, "Could not allocate memory for
> "
>  		       "io_request_frame pool\n");
>  		goto fail_io_frames;
>  	}
> @@ -458,7 +456,7 @@ megasas_alloc_cmds_fusion(struct megasas_instance
> *instance)
>  		pci_pool_alloc(fusion->io_request_frames_pool, GFP_KERNEL,
>  			       &fusion->io_request_frames_phys);
>  	if (!fusion->io_request_frames) {
> -		printk(KERN_ERR "megasas: Could not allocate memory for "
> +		dev_err(&instance->pdev->dev, "Could not allocate memory for
> "
>  		       "io_request_frames frames\n");
>  		pci_pool_destroy(fusion->io_request_frames_pool);
>  		goto fail_io_frames;
> @@ -473,7 +471,7 @@ megasas_alloc_cmds_fusion(struct megasas_instance
> *instance)
>  				   * max_cmd, GFP_KERNEL);
>
>  	if (!fusion->cmd_list) {
> -		printk(KERN_DEBUG "megasas: out of memory. Could not alloc
> "
> +		dev_printk(KERN_DEBUG, &instance->pdev->dev, "out of
> memory. Could not alloc "
>  		       "memory for cmd_list_fusion\n");
>  		goto fail_cmd_list;
>  	}
> @@ -483,7 +481,7 @@ megasas_alloc_cmds_fusion(struct megasas_instance
> *instance)
>  		fusion->cmd_list[i] = kmalloc(sizeof(struct
> megasas_cmd_fusion),
>  					      GFP_KERNEL);
>  		if (!fusion->cmd_list[i]) {
> -			printk(KERN_ERR "Could not alloc cmd list fusion\n");
> +			dev_err(&instance->pdev->dev, "Could not alloc cmd
> list fusion\n");
>
>  			for (j = 0; j < i; j++)
>  				kfree(fusion->cmd_list[j]);
> @@ -527,7 +525,7 @@ megasas_alloc_cmds_fusion(struct megasas_instance
> *instance)
>  	 * Create a frame pool and assign one frame to each cmd
>  	 */
>  	if (megasas_create_frame_pool_fusion(instance)) {
> -		printk(KERN_DEBUG "megasas: Error creating frame DMA
> pool\n");
> +		dev_printk(KERN_DEBUG, &instance->pdev->dev, "Error
> creating frame DMA pool\n");
>  		megasas_free_cmds_fusion(instance);
>  		goto fail_req_desc;
>  	}
> @@ -613,7 +611,7 @@ megasas_ioc_init_fusion(struct megasas_instance
> *instance)
>  	cmd = megasas_get_cmd(instance);
>
>  	if (!cmd) {
> -		printk(KERN_ERR "Could not allocate cmd for INIT Frame\n");
> +		dev_err(&instance->pdev->dev, "Could not allocate cmd for
> INIT Frame\n");
>  		ret = 1;
>  		goto fail_get_cmd;
>  	}
> @@ -624,7 +622,7 @@ megasas_ioc_init_fusion(struct megasas_instance
> *instance)
>  			     &ioc_init_handle, GFP_KERNEL);
>
>  	if (!IOCInitMessage) {
> -		printk(KERN_ERR "Could not allocate memory for "
> +		dev_err(&instance->pdev->dev, "Could not allocate memory for
> "
>  		       "IOCInitMessage\n");
>  		ret = 1;
>  		goto fail_fw_init;
> @@ -714,7 +712,7 @@ megasas_ioc_init_fusion(struct megasas_instance
> *instance)
>  		ret = 1;
>  		goto fail_fw_init;
>  	}
> -	printk(KERN_ERR "megasas:IOC Init cmd success\n");
> +	dev_err(&instance->pdev->dev, "Init cmd success\n");
>
>  	ret = 0;
>
> @@ -757,7 +755,7 @@ megasas_get_ld_map_info(struct megasas_instance
> *instance)
>  	cmd = megasas_get_cmd(instance);
>
>  	if (!cmd) {
> -		printk(KERN_DEBUG "megasas: Failed to get cmd for map
> info.\n");
> +		dev_printk(KERN_DEBUG, &instance->pdev->dev, "Failed to get
> cmd for map info\n");
>  		return -ENOMEM;
>  	}
>
> @@ -776,7 +774,7 @@ megasas_get_ld_map_info(struct megasas_instance
> *instance)
>  	ci_h = fusion->ld_map_phys[(instance->map_id & 1)];
>
>  	if (!ci) {
> -		printk(KERN_DEBUG "Failed to alloc mem for ld_map_info\n");
> +		dev_printk(KERN_DEBUG, &instance->pdev->dev, "Failed to
> alloc mem for ld_map_info\n");
>  		megasas_return_cmd(instance, cmd);
>  		return -ENOMEM;
>  	}
> @@ -851,8 +849,7 @@ megasas_sync_map_info(struct megasas_instance
> *instance)
>  	cmd = megasas_get_cmd(instance);
>
>  	if (!cmd) {
> -		printk(KERN_DEBUG "megasas: Failed to get cmd for sync"
> -		       "info.\n");
> +		dev_printk(KERN_DEBUG, &instance->pdev->dev, "Failed to get
> cmd for sync info\n");
>  		return -ENOMEM;
>  	}
>
> @@ -1097,7 +1094,7 @@ megasas_init_adapter_fusion(struct
> megasas_instance *instance)
>  						       &fusion->ld_map_phys[i],
>  						       GFP_KERNEL);
>  		if (!fusion->ld_map[i]) {
> -			printk(KERN_ERR "megasas: Could not allocate memory
> "
> +			dev_err(&instance->pdev->dev, "Could not allocate
> memory "
>  			       "for map info\n");
>  			goto fail_map_info;
>  		}
> @@ -1162,7 +1159,7 @@ map_cmd_status(struct megasas_cmd_fusion *cmd,
> u8 status, u8 ext_status)
>  		cmd->scmd->result = DID_IMM_RETRY << 16;
>  		break;
>  	default:
> -		printk(KERN_DEBUG "megasas: FW status %#x\n", status);
> +		dev_printk(KERN_DEBUG, &cmd->instance->pdev->dev, "FW
> status %#x\n", status);
>  		cmd->scmd->result = DID_ERROR << 16;
>  		break;
>  	}
> @@ -1851,7 +1848,7 @@ megasas_build_io_fusion(struct megasas_instance
> *instance,
>  					&io_request->SGL, cmd);
>
>  	if (sge_count > instance->max_num_sge) {
> -		printk(KERN_ERR "megasas: Error. sge_count (0x%x) exceeds "
> +		dev_err(&instance->pdev->dev, "Error. sge_count (0x%x)
> exceeds "
>  		       "max (0x%x) allowed\n", sge_count,
>  		       instance->max_num_sge);
>  		return 1;
> @@ -1885,7 +1882,7 @@ megasas_get_request_descriptor(struct
> megasas_instance *instance, u16 index)
>  	struct fusion_context *fusion;
>
>  	if (index >= instance->max_fw_cmds) {
> -		printk(KERN_ERR "megasas: Invalid SMID (0x%x)request for "
> +		dev_err(&instance->pdev->dev, "Invalid SMID (0x%x)request for
> "
>  		       "descriptor for scsi%d\n", index,
>  			instance->host->host_no);
>  		return NULL;
> @@ -1927,7 +1924,7 @@ megasas_build_and_issue_cmd_fusion(struct
> megasas_instance *instance,
>
>  	if (megasas_build_io_fusion(instance, scmd, cmd)) {
>  		megasas_return_cmd_fusion(instance, cmd);
> -		printk(KERN_ERR "megasas: Error building command.\n");
> +		dev_err(&instance->pdev->dev, "Error building command\n");
>  		cmd->request_desc = NULL;
>  		return 1;
>  	}
> @@ -1937,7 +1934,7 @@ megasas_build_and_issue_cmd_fusion(struct
> megasas_instance *instance,
>
>  	if (cmd->io_request->ChainOffset != 0 &&
>  	    cmd->io_request->ChainOffset != 0xF)
> -		printk(KERN_ERR "megasas: The chain offset value is not "
> +		dev_err(&instance->pdev->dev, "The chain offset value is not "
>  		       "correct : %x\n", cmd->io_request->ChainOffset);
>
>  	/*
> @@ -2025,7 +2022,7 @@ complete_cmd_fusion(struct megasas_instance
> *instance, u32 MSIxIndex)
>  			if (reply_descript_type ==
>  			    MPI2_RPY_DESCRIPT_FLAGS_SCSI_IO_SUCCESS) {
>  				if (megasas_dbg_lvl == 5)
> -					printk(KERN_ERR "\nmegasas: FAST
> Path "
> +					dev_err(&instance->pdev->dev,
> "\nFAST Path "
>  					       "IO Success\n");
>  			}
>  			/* Fall thru and complete IO */
> @@ -2186,7 +2183,7 @@ irqreturn_t megasas_isr_fusion(int irq, void *devp)
>  			else if (fw_state == MFI_STATE_FAULT)
>  				schedule_work(&instance->work_init);
>  		} else if (fw_state == MFI_STATE_FAULT) {
> -			printk(KERN_WARNING "megaraid_sas:
> Iop2SysDoorbellInt"
> +			dev_warn(&instance->pdev->dev, "Iop2SysDoorbellInt"
>  			       "for scsi%d\n", instance->host->host_no);
>  			schedule_work(&instance->work_init);
>  		}
> @@ -2269,7 +2266,7 @@ build_mpt_cmd(struct megasas_instance *instance,
> struct megasas_cmd *cmd)
>  	u16 index;
>
>  	if (build_mpt_mfi_pass_thru(instance, cmd)) {
> -		printk(KERN_ERR "Couldn't build MFI pass thru cmd\n");
> +		dev_err(&instance->pdev->dev, "Couldn't build MFI pass thru
> cmd\n");
>  		return NULL;
>  	}
>
> @@ -2303,7 +2300,7 @@ megasas_issue_dcmd_fusion(struct
> megasas_instance *instance,
>
>  	req_desc = build_mpt_cmd(instance, cmd);
>  	if (!req_desc) {
> -		printk(KERN_ERR "Couldn't issue MFI pass thru cmd\n");
> +		dev_err(&instance->pdev->dev, "Couldn't issue MFI pass thru
> cmd\n");
>  		return;
>  	}
>  	megasas_fire_cmd_fusion(instance, req_desc);
> @@ -2413,7 +2410,7 @@ int megasas_wait_for_outstanding_fusion(struct
> megasas_instance *instance,
>  		fw_state = instance->instancet->read_fw_status_reg(
>  			instance->reg_set) & MFI_STATE_MASK;
>  		if (fw_state == MFI_STATE_FAULT) {
> -			printk(KERN_WARNING "megasas: Found FW in FAULT
> state,"
> +			dev_warn(&instance->pdev->dev, "Found FW in FAULT
> state,"
>  			       " will reset adapter scsi%d.\n",
>  				instance->host->host_no);
>  			retval = 1;
> @@ -2436,7 +2433,7 @@ int megasas_wait_for_outstanding_fusion(struct
> megasas_instance *instance,
>  				hb_seconds_missed++;
>  				if (hb_seconds_missed ==
>
> (MEGASAS_SRIOV_HEARTBEAT_INTERVAL_VF/HZ)) {
> -					printk(KERN_WARNING "megasas: SR-
> IOV:"
> +					dev_warn(&instance->pdev->dev, "SR-
> IOV:"
>  					       " Heartbeat never completed "
>  					       " while polling during I/O "
>  					       " timeout handling for "
> @@ -2454,7 +2451,7 @@ int megasas_wait_for_outstanding_fusion(struct
> megasas_instance *instance,
>  			goto out;
>
>  		if (!(i % MEGASAS_RESET_NOTICE_INTERVAL)) {
> -			printk(KERN_NOTICE "megasas: [%2d]waiting for %d "
> +			dev_notice(&instance->pdev->dev, "[%2d]waiting for
> %d "
>  			       "commands to complete for scsi%d\n", i,
>  			       outstanding, instance->host->host_no);
>  			megasas_complete_cmd_dpc_fusion(
> @@ -2464,7 +2461,7 @@ int megasas_wait_for_outstanding_fusion(struct
> megasas_instance *instance,
>  	}
>
>  	if (atomic_read(&instance->fw_outstanding)) {
> -		printk("megaraid_sas: pending commands remain after waiting,
> "
> +		dev_err(&instance->pdev->dev, "pending commands remain
> after waiting, "
>  		       "will reset adapter scsi%d.\n",
>  		       instance->host->host_no);
>  		retval = 1;
> @@ -2564,7 +2561,7 @@ int megasas_reset_fusion(struct Scsi_Host *shost,
> int
> iotimeout)
>  	mutex_lock(&instance->reset_mutex);
>
>  	if (instance->adprecovery == MEGASAS_HW_CRITICAL_ERROR) {
> -		printk(KERN_WARNING "megaraid_sas: Hardware critical error,
> "
> +		dev_warn(&instance->pdev->dev, "Hardware critical error, "
>  		       "returning FAILED for scsi%d.\n",
>  			instance->host->host_no);
>  		mutex_unlock(&instance->reset_mutex);
> @@ -2618,7 +2615,7 @@ int megasas_reset_fusion(struct Scsi_Host *shost,
> int
> iotimeout)
>  	if (megasas_wait_for_outstanding_fusion(instance, iotimeout,
>  						&convert)) {
>  		instance->adprecovery = MEGASAS_ADPRESET_SM_INFAULT;
> -		printk(KERN_WARNING "megaraid_sas: resetting fusion "
> +		dev_warn(&instance->pdev->dev, "resetting fusion "
>  		       "adapter scsi%d.\n", instance->host->host_no);
>  		if (convert)
>  			iotimeout = 0;
> @@ -2645,7 +2642,7 @@ int megasas_reset_fusion(struct Scsi_Host *shost,
> int
> iotimeout)
>  		if (instance->disableOnlineCtrlReset ||
>  		    (abs_state == MFI_STATE_FAULT && !reset_adapter)) {
>  			/* Reset not supported, kill adapter */
> -			printk(KERN_WARNING "megaraid_sas: Reset not
> supported"
> +			dev_warn(&instance->pdev->dev, "Reset not
> supported"
>  			       ", killing adapter scsi%d.\n",
>  				instance->host->host_no);
>  			megaraid_sas_kill_hba(instance);
> @@ -2663,7 +2660,7 @@ int megasas_reset_fusion(struct Scsi_Host *shost,
> int
> iotimeout)
>  			     instance->hb_host_mem->HB.driverCounter)) {
>  					instance->hb_host_mem-
> >HB.driverCounter =
>  						instance->hb_host_mem-
> >HB.fwCounter;
> -					printk(KERN_WARNING "megasas: SR-
> IOV:"
> +					dev_warn(&instance->pdev->dev, "SR-
> IOV:"
>  					       "Late FW heartbeat update for "
>  					       "scsi%d.\n",
>  					       instance->host->host_no);
> @@ -2679,8 +2676,8 @@ int megasas_reset_fusion(struct Scsi_Host *shost,
> int
> iotimeout)
>  					abs_state = status_reg &
>  						MFI_STATE_MASK;
>  					if (abs_state == MFI_STATE_READY) {
> -						printk(KERN_WARNING
> "megasas"
> -						       ": SR-IOV: FW was found"
> +						dev_warn(&instance->pdev-
> >dev,
> +						       "SR-IOV: FW was found"
>  						       "to be in ready state "
>  						       "for scsi%d.\n",
>  						       instance->host->host_no);
> @@ -2689,7 +2686,7 @@ int megasas_reset_fusion(struct Scsi_Host *shost,
> int
> iotimeout)
>  					msleep(20);
>  				}
>  				if (abs_state != MFI_STATE_READY) {
> -					printk(KERN_WARNING "megasas: SR-
> IOV: "
> +					dev_warn(&instance->pdev->dev, "SR-
> IOV: "
>  					       "FW not in ready state after %d"
>  					       " seconds for scsi%d, status_reg = "
>  					       "0x%x.\n",
> @@ -2731,7 +2728,7 @@ int megasas_reset_fusion(struct Scsi_Host *shost,
> int
> iotimeout)
>  				host_diag =
>  				readl(&instance->reg_set->fusion_host_diag);
>  				if (retry++ == 100) {
> -					printk(KERN_WARNING
> "megaraid_sas: "
> +					dev_warn(&instance->pdev->dev,
>  					       "Host diag unlock failed! "
>  					       "for scsi%d\n",
>  						instance->host->host_no);
> @@ -2754,7 +2751,7 @@ int megasas_reset_fusion(struct Scsi_Host *shost,
> int
> iotimeout)
>  				host_diag =
>  				readl(&instance->reg_set->fusion_host_diag);
>  				if (retry++ == 1000) {
> -					printk(KERN_WARNING
> "megaraid_sas: "
> +					dev_warn(&instance->pdev->dev,
>  					       "Diag reset adapter never "
>  					       "cleared for scsi%d!\n",
>  						instance->host->host_no);
> @@ -2777,7 +2774,7 @@ int megasas_reset_fusion(struct Scsi_Host *shost,
> int
> iotimeout)
>  					instance->reg_set) &
> MFI_STATE_MASK;
>  			}
>  			if (abs_state <= MFI_STATE_FW_INIT) {
> -				printk(KERN_WARNING "megaraid_sas:
> firmware "
> +				dev_warn(&instance->pdev->dev, "firmware "
>  				       "state < MFI_STATE_FW_INIT, state = "
>  				       "0x%x for scsi%d\n", abs_state,
>  					instance->host->host_no);
> @@ -2786,7 +2783,7 @@ int megasas_reset_fusion(struct Scsi_Host *shost,
> int
> iotimeout)
>
>  			/* Wait for FW to become ready */
>  			if (megasas_transition_to_ready(instance, 1)) {
> -				printk(KERN_WARNING "megaraid_sas: Failed
> to "
> +				dev_warn(&instance->pdev->dev, "Failed to "
>  				       "transition controller to ready "
>  				       "for scsi%d.\n",
>  				       instance->host->host_no);
> @@ -2795,7 +2792,7 @@ int megasas_reset_fusion(struct Scsi_Host *shost,
> int
> iotimeout)
>
>  			megasas_reset_reply_desc(instance);
>  			if (megasas_ioc_init_fusion(instance)) {
> -				printk(KERN_WARNING "megaraid_sas: "
> +				dev_warn(&instance->pdev->dev,
>  				       "megasas_ioc_init_fusion() failed!"
>  				       " for scsi%d\n",
>  				       instance->host->host_no);
> @@ -2836,7 +2833,7 @@ int megasas_reset_fusion(struct Scsi_Host *shost,
> int
> iotimeout)
>  			}
>
>  			/* Adapter reset completed successfully */
> -			printk(KERN_WARNING "megaraid_sas: Reset "
> +			dev_warn(&instance->pdev->dev, "Reset "
>  			       "successful for scsi%d.\n",
>  				instance->host->host_no);
>
> @@ -2852,7 +2849,7 @@ int megasas_reset_fusion(struct Scsi_Host *shost,
> int
> iotimeout)
>  			goto out;
>  		}
>  		/* Reset failed, kill the adapter */
> -		printk(KERN_WARNING "megaraid_sas: Reset failed, killing "
> +		dev_warn(&instance->pdev->dev, "Reset failed, killing "
>  		       "adapter scsi%d.\n", instance->host->host_no);
>  		megaraid_sas_kill_hba(instance);
>  		instance->skip_heartbeat_timer_del = 1;
Acked-by: Sumit Saxena <sumit.saxena@avagotech.com>

^ permalink raw reply	[flat|nested] 12+ messages in thread

* RE: [PATCH v3 3/3] megaraid_sas : fix whitespace errors
  2015-07-07 20:52 ` [PATCH v3 3/3] megaraid_sas : fix whitespace errors Bjorn Helgaas
@ 2015-07-08  9:13   ` Sumit Saxena
  2015-07-08 10:48   ` Hannes Reinecke
  2015-08-26 14:36   ` James Bottomley
  2 siblings, 0 replies; 12+ messages in thread
From: Sumit Saxena @ 2015-07-08  9:13 UTC (permalink / raw)
  To: Bjorn Helgaas, Kashyap Desai, Uday Lingala
  Cc: PDL,MEGARAIDLINUX, linux-scsi, James E.J. Bottomley,
	linux-kernel, Joe Perches, Christoph Hellwig

> -----Original Message-----
> From: Bjorn Helgaas [mailto:bhelgaas@google.com]
> Sent: Wednesday, July 08, 2015 2:23 AM
> To: Kashyap Desai; Uday Lingala; Sumit Saxena
> Cc: megaraidlinux.pdl@avagotech.com; linux-scsi@vger.kernel.org; James
> E.J.
> Bottomley; linux-kernel@vger.kernel.org; Joe Perches; Christoph Hellwig
> Subject: [PATCH v3 3/3] megaraid_sas : fix whitespace errors
>
> Fix whitespace and indentation errors.  No code change.
>
> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
> ---
>  drivers/scsi/megaraid/megaraid_sas_base.c |  244
> ++++++++++++++--------------
> -
>  1 file changed, 118 insertions(+), 126 deletions(-)
>
> diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c
> b/drivers/scsi/megaraid/megaraid_sas_base.c
> index a9bd592..5156faa 100644
> --- a/drivers/scsi/megaraid/megaraid_sas_base.c
> +++ b/drivers/scsi/megaraid/megaraid_sas_base.c
> @@ -273,6 +273,7 @@ static inline void
>  megasas_enable_intr_xscale(struct megasas_instance *instance)  {
>  	struct megasas_register_set __iomem *regs;
> +
>  	regs = instance->reg_set;
>  	writel(0, &(regs)->outbound_intr_mask);
>
> @@ -289,6 +290,7 @@ megasas_disable_intr_xscale(struct megasas_instance
> *instance)  {
>  	struct megasas_register_set __iomem *regs;
>  	u32 mask = 0x1f;
> +
>  	regs = instance->reg_set;
>  	writel(mask, &regs->outbound_intr_mask);
>  	/* Dummy readl to force pci flush */
> @@ -313,6 +315,7 @@ megasas_clear_intr_xscale(struct megasas_register_set
> __iomem * regs)  {
>  	u32 status;
>  	u32 mfiStatus = 0;
> +
>  	/*
>  	 * Check if it is our interrupt
>  	 */
> @@ -348,6 +351,7 @@ megasas_fire_cmd_xscale(struct megasas_instance
> *instance,
>  		struct megasas_register_set __iomem *regs)  {
>  	unsigned long flags;
> +
>  	spin_lock_irqsave(&instance->hba_lock, flags);
>  	writel((frame_phys_addr >> 3)|(frame_count),
>  	       &(regs)->inbound_queue_port);
> @@ -364,6 +368,7 @@ megasas_adp_reset_xscale(struct megasas_instance
> *instance,  {
>  	u32 i;
>  	u32 pcidata;
> +
>  	writel(MFI_ADP_RESET, &regs->inbound_doorbell);
>
>  	for (i = 0; i < 3; i++)
> @@ -402,7 +407,6 @@ static int
>  megasas_check_reset_xscale(struct megasas_instance *instance,
>  		struct megasas_register_set __iomem *regs)  {
> -
>  	if ((instance->adprecovery != MEGASAS_HBA_OPERATIONAL) &&
>  	    (le32_to_cpu(*instance->consumer) ==
>  		MEGASAS_ADPRESET_INPROG_SIGN))
> @@ -433,7 +437,7 @@ static struct megasas_instance_template
> megasas_instance_template_xscale = {
>
>  /**
>  *	The following functions are defined for ppc (deviceid : 0x60)
> -* 	controllers
> +*	controllers
>  */
>
>  /**
> @@ -444,6 +448,7 @@ static inline void
>  megasas_enable_intr_ppc(struct megasas_instance *instance)  {
>  	struct megasas_register_set __iomem *regs;
> +
>  	regs = instance->reg_set;
>  	writel(0xFFFFFFFF, &(regs)->outbound_doorbell_clear);
>
> @@ -462,6 +467,7 @@ megasas_disable_intr_ppc(struct megasas_instance
> *instance)  {
>  	struct megasas_register_set __iomem *regs;
>  	u32 mask = 0xFFFFFFFF;
> +
>  	regs = instance->reg_set;
>  	writel(mask, &regs->outbound_intr_mask);
>  	/* Dummy readl to force pci flush */
> @@ -522,6 +528,7 @@ megasas_fire_cmd_ppc(struct megasas_instance
> *instance,
>  		struct megasas_register_set __iomem *regs)  {
>  	unsigned long flags;
> +
>  	spin_lock_irqsave(&instance->hba_lock, flags);
>  	writel((frame_phys_addr | (frame_count<<1))|1,
>  			&(regs)->inbound_queue_port);
> @@ -566,6 +573,7 @@ static inline void
>  megasas_enable_intr_skinny(struct megasas_instance *instance)  {
>  	struct megasas_register_set __iomem *regs;
> +
>  	regs = instance->reg_set;
>  	writel(0xFFFFFFFF, &(regs)->outbound_intr_mask);
>
> @@ -584,6 +592,7 @@ megasas_disable_intr_skinny(struct megasas_instance
> *instance)  {
>  	struct megasas_register_set __iomem *regs;
>  	u32 mask = 0xFFFFFFFF;
> +
>  	regs = instance->reg_set;
>  	writel(mask, &regs->outbound_intr_mask);
>  	/* Dummy readl to force pci flush */
> @@ -634,8 +643,8 @@ megasas_clear_intr_skinny(struct megasas_register_set
> __iomem *regs)
>  	writel(status, &regs->outbound_intr_status);
>
>  	/*
> -	* dummy read to flush PCI
> -	*/
> +	 * dummy read to flush PCI
> +	 */
>  	readl(&regs->outbound_intr_status);
>
>  	return mfiStatus;
> @@ -654,6 +663,7 @@ megasas_fire_cmd_skinny(struct megasas_instance
> *instance,
>  			struct megasas_register_set __iomem *regs)  {
>  	unsigned long flags;
> +
>  	spin_lock_irqsave(&instance->hba_lock, flags);
>  	writel(upper_32_bits(frame_phys_addr),
>  	       &(regs)->inbound_high_queue_port);
> @@ -706,6 +716,7 @@ static inline void
>  megasas_enable_intr_gen2(struct megasas_instance *instance)  {
>  	struct megasas_register_set __iomem *regs;
> +
>  	regs = instance->reg_set;
>  	writel(0xFFFFFFFF, &(regs)->outbound_doorbell_clear);
>
> @@ -725,6 +736,7 @@ megasas_disable_intr_gen2(struct megasas_instance
> *instance)  {
>  	struct megasas_register_set __iomem *regs;
>  	u32 mask = 0xFFFFFFFF;
> +
>  	regs = instance->reg_set;
>  	writel(mask, &regs->outbound_intr_mask);
>  	/* Dummy readl to force pci flush */
> @@ -750,6 +762,7 @@ megasas_clear_intr_gen2(struct megasas_register_set
> __iomem *regs)  {
>  	u32 status;
>  	u32 mfiStatus = 0;
> +
>  	/*
>  	 * Check if it is our interrupt
>  	 */
> @@ -786,6 +799,7 @@ megasas_fire_cmd_gen2(struct megasas_instance
> *instance,
>  			struct megasas_register_set __iomem *regs)  {
>  	unsigned long flags;
> +
>  	spin_lock_irqsave(&instance->hba_lock, flags);
>  	writel((frame_phys_addr | (frame_count<<1))|1,
>  			&(regs)->inbound_queue_port);
> @@ -800,10 +814,10 @@ static int
>  megasas_adp_reset_gen2(struct megasas_instance *instance,
>  			struct megasas_register_set __iomem *reg_set)  {
> -	u32			retry = 0 ;
> -	u32			HostDiag;
> -	u32 __iomem		*seq_offset = &reg_set->seq_offset;
> -	u32 __iomem		*hostdiag_offset = &reg_set->host_diag;
> +	u32 retry = 0 ;
> +	u32 HostDiag;
> +	u32 __iomem *seq_offset = &reg_set->seq_offset;
> +	u32 __iomem *hostdiag_offset = &reg_set->host_diag;
>
>  	if (instance->instancet == &megasas_instance_template_skinny) {
>  		seq_offset = &reg_set->fusion_seq_offset; @@ -821,7 +835,7
> @@ megasas_adp_reset_gen2(struct megasas_instance *instance,
>
>  	HostDiag = (u32)readl(hostdiag_offset);
>
> -	while ( !( HostDiag & DIAG_WRITE_ENABLE) ) {
> +	while (!(HostDiag & DIAG_WRITE_ENABLE)) {
>  		msleep(100);
>  		HostDiag = (u32)readl(hostdiag_offset);
>  		dev_notice(&instance->pdev->dev, "RESETGEN2: retry=%x,
> hostdiag=%x\n", @@ -839,7 +853,7 @@ megasas_adp_reset_gen2(struct
> megasas_instance *instance,
>  	ssleep(10);
>
>  	HostDiag = (u32)readl(hostdiag_offset);
> -	while ( ( HostDiag & DIAG_RESET_ADAPTER) ) {
> +	while (HostDiag & DIAG_RESET_ADAPTER) {
>  		msleep(100);
>  		HostDiag = (u32)readl(hostdiag_offset);
>  		dev_notice(&instance->pdev->dev, "RESET_GEN2: retry=%x,
> hostdiag=%x\n", @@ -904,7 +918,6 @@ int  megasas_issue_polled(struct
> megasas_instance *instance, struct megasas_cmd *cmd)  {
>  	int seconds;
> -
>  	struct megasas_header *frame_hdr = &cmd->frame->hdr;
>
>  	frame_hdr->cmd_status = MFI_CMD_STATUS_POLL_MODE; @@ -940,6
> +953,7 @@ megasas_issue_blocked_cmd(struct megasas_instance *instance,
>  			  struct megasas_cmd *cmd, int timeout)  {
>  	int ret = 0;
> +
>  	cmd->cmd_status_drv = MFI_STAT_INVALID_STATUS;
>
>  	instance->instancet->issue_dcmd(instance, cmd); @@ -1120,7 +1134,7
> @@ static u32 megasas_get_frame_count(struct megasas_instance *instance,
>  	int num_cnt;
>  	int sge_bytes;
>  	u32 sge_sz;
> -	u32 frame_count=0;
> +	u32 frame_count = 0;
>
>  	sge_sz = (IS_DMA64) ? sizeof(struct megasas_sge64) :
>  	    sizeof(struct megasas_sge32);
> @@ -1151,14 +1165,14 @@ static u32 megasas_get_frame_count(struct
> megasas_instance *instance,
>  			num_cnt = sge_count - 3;
>  	}
>
> -	if(num_cnt>0){
> +	if (num_cnt > 0) {
>  		sge_bytes = sge_sz * num_cnt;
>
>  		frame_count = (sge_bytes / MEGAMFI_FRAME_SIZE) +
>  		    ((sge_bytes % MEGAMFI_FRAME_SIZE) ? 1 : 0) ;
>  	}
>  	/* Main frame */
> -	frame_count +=1;
> +	frame_count += 1;
>
>  	if (frame_count > 7)
>  		frame_count = 8;
> @@ -1215,9 +1229,9 @@ megasas_build_dcdb(struct megasas_instance
> *instance, struct scsi_cmnd *scp,
>  	memcpy(pthru->cdb, scp->cmnd, scp->cmd_len);
>
>  	/*
> -	* If the command is for the tape device, set the
> -	* pthru timeout to the os layer timeout value.
> -	*/
> +	 * If the command is for the tape device, set the
> +	 * pthru timeout to the os layer timeout value.
> +	 */
>  	if (scp->device->type == TYPE_TAPE) {
>  		if ((scp->request->timeout / HZ) > 0xFFFF)
>  			pthru->timeout = cpu_to_le16(0xFFFF); @@ -1435,7
> +1449,7 @@ inline int megasas_cmd_type(struct scsi_cmnd *cmd)
>
>   /**
>   * megasas_dump_pending_frames -	Dumps the frame address of all
> pending cmds
> - *                              	in FW
> + *					in FW
>   * @instance:				Adapter soft state
>   */
>  static inline void
> @@ -1459,7 +1473,7 @@ megasas_dump_pending_frames(struct
> megasas_instance *instance)
>  	dev_err(&instance->pdev->dev, "[%d]: Pending OS cmds in FW :
> \n",instance->host->host_no);
>  	for (i = 0; i < max_cmd; i++) {
>  		cmd = instance->cmd_list[i];
> -		if(!cmd->scmd)
> +		if (!cmd->scmd)
>  			continue;
>  		dev_err(&instance->pdev->dev, "[%d]: Frame addr :0x%08lx :
> ",instance->host->host_no,(unsigned long)cmd->frame_phys_addr);
>  		if (megasas_cmd_type(cmd->scmd) == READ_WRITE_LDIO) {
> @@ -1471,8 +1485,7 @@ megasas_dump_pending_frames(struct
> megasas_instance *instance)
>  			instance->host->host_no, cmd->frame_count, ldio-
> >cmd, ldio->target_id,
>  			le32_to_cpu(ldio->start_lba_lo), le32_to_cpu(ldio-
> >start_lba_hi),
>  			le32_to_cpu(ldio->sense_buf_phys_addr_lo), sgcount);
> -		}
> -		else {
> +		} else {
>  			pthru = (struct megasas_pthru_frame *) cmd->frame;
>  			mfi_sgl = &pthru->sgl;
>  			sgcount = pthru->sge_count;
> @@ -1482,16 +1495,16 @@ megasas_dump_pending_frames(struct
> megasas_instance *instance)
>  			pthru->lun, pthru->cdb_len, le32_to_cpu(pthru-
> >data_xfer_len),
>  			le32_to_cpu(pthru->sense_buf_phys_addr_lo),
> sgcount);
>  		}
> -	if(megasas_dbg_lvl & MEGASAS_DBG_LVL){
> -		for (n = 0; n < sgcount; n++){
> -			if (IS_DMA64)
> -				dev_err(&instance->pdev->dev, "sgl len : 0x%x,
> sgl addr : 0x%llx\n",
> -					le32_to_cpu(mfi_sgl-
> >sge64[n].length),
> -					le64_to_cpu(mfi_sgl-
> >sge64[n].phys_addr));
> -			else
> -				dev_err(&instance->pdev->dev, "sgl len : 0x%x,
> sgl addr : 0x%x\n",
> -					le32_to_cpu(mfi_sgl-
> >sge32[n].length),
> -					le32_to_cpu(mfi_sgl-
> >sge32[n].phys_addr));
> +		if (megasas_dbg_lvl & MEGASAS_DBG_LVL) {
> +			for (n = 0; n < sgcount; n++) {
> +				if (IS_DMA64)
> +					dev_err(&instance->pdev->dev, "sgl len
> : 0x%x, sgl addr : 0x%llx\n",
> +						le32_to_cpu(mfi_sgl-
> >sge64[n].length),
> +						le64_to_cpu(mfi_sgl-
> >sge64[n].phys_addr));
> +				else
> +					dev_err(&instance->pdev->dev, "sgl len
> : 0x%x, sgl addr : 0x%x\n",
> +						le32_to_cpu(mfi_sgl-
> >sge32[n].length),
> +						le32_to_cpu(mfi_sgl-
> >sge32[n].phys_addr));
>  			}
>  		}
>  	} /*for max_cmd*/
> @@ -1500,9 +1513,8 @@ megasas_dump_pending_frames(struct
> megasas_instance *instance)
>
>  		cmd = instance->cmd_list[i];
>
> -		if(cmd->sync_cmd == 1){
> +		if (cmd->sync_cmd == 1)
>  			dev_err(&instance->pdev->dev, "0x%08lx : ", (unsigned
> long)cmd->frame_phys_addr);
> -		}
>  	}
>  	dev_err(&instance->pdev->dev, "[%d]: Dumping Done\n\n",instance-
> >host->host_no);
>  }
> @@ -1650,8 +1662,8 @@ static struct megasas_instance
> *megasas_lookup_instance(u16 host_no)  static int
> megasas_slave_configure(struct scsi_device *sdev)  {
>  	/*
> -	* The RAID firmware may require extended timeouts.
> -	*/
> +	 * The RAID firmware may require extended timeouts.
> +	 */
>  	blk_queue_rq_timeout(sdev->request_queue,
>  		MEGASAS_DEFAULT_CMD_TIMEOUT * HZ);
>
> @@ -1660,8 +1672,9 @@ static int megasas_slave_configure(struct
> scsi_device
> *sdev)
>
>  static int megasas_slave_alloc(struct scsi_device *sdev)  {
> -	u16             pd_index = 0;
> +	u16 pd_index = 0;
>  	struct megasas_instance *instance ;
> +
>  	instance = megasas_lookup_instance(sdev->host->host_no);
>  	if (sdev->channel < MEGASAS_MAX_PD_CHANNELS) {
>  		/*
> @@ -1727,8 +1740,7 @@ void megaraid_sas_kill_hba(struct megasas_instance
> *instance)
>  		(instance->pdev->device == PCI_DEVICE_ID_LSI_PLASMA) ||
>  		(instance->pdev->device == PCI_DEVICE_ID_LSI_INVADER) ||
>  		(instance->pdev->device == PCI_DEVICE_ID_LSI_FURY)) {
> -		writel(MFI_STOP_ADP,
> -			&instance->reg_set->doorbell);
> +		writel(MFI_STOP_ADP, &instance->reg_set->doorbell);
>  		/* Flush */
>  		readl(&instance->reg_set->doorbell);
>  		if (instance->mpio && instance->requestorId) @@ -1782,7
> +1794,7 @@ static void megasas_complete_cmd_dpc(unsigned long
> instance_addr)
>  	unsigned long flags;
>
>  	/* If we have already declared adapter dead, donot complete cmds */
> -	if (instance->adprecovery == MEGASAS_HW_CRITICAL_ERROR )
> +	if (instance->adprecovery == MEGASAS_HW_CRITICAL_ERROR)
>  		return;
>
>  	spin_lock_irqsave(&instance->completion_lock, flags); @@ -2285,14
> +2297,14 @@ static int megasas_wait_for_outstanding(struct
> megasas_instance *instance)
>  		if (adprecovery != MEGASAS_HBA_OPERATIONAL) {
>  			dev_notice(&instance->pdev->dev, "reset: Stopping
> HBA.\n");
>  			spin_lock_irqsave(&instance->hba_lock, flags);
> -			instance->adprecovery	=
> MEGASAS_HW_CRITICAL_ERROR;
> +			instance->adprecovery =
> MEGASAS_HW_CRITICAL_ERROR;
>  			spin_unlock_irqrestore(&instance->hba_lock, flags);
>  			return FAILED;
>  		}
>
> -		reset_index	= 0;
> +		reset_index = 0;
>  		while (!list_empty(&clist_local)) {
> -			reset_cmd	= list_entry((&clist_local)->next,
> +			reset_cmd = list_entry((&clist_local)->next,
>  						struct megasas_cmd, list);
>  			list_del_init(&reset_cmd->list);
>  			if (reset_cmd->scmd) {
> @@ -2324,7 +2336,6 @@ static int megasas_wait_for_outstanding(struct
> megasas_instance *instance)
>  	}
>
>  	for (i = 0; i < resetwaittime; i++) {
> -
>  		int outstanding = atomic_read(&instance->fw_outstanding);
>
>  		if (!outstanding)
> @@ -2363,10 +2374,8 @@ static int megasas_wait_for_outstanding(struct
> megasas_instance *instance)
>  		i++;
>  	} while (i <= 3);
>
> -	if (atomic_read(&instance->fw_outstanding) &&
> -					!kill_adapter_flag) {
> +	if (atomic_read(&instance->fw_outstanding) && !kill_adapter_flag) {
>  		if (instance->disableOnlineCtrlReset == 0) {
> -
>  			megasas_do_ocr(instance);
>
>  			/* wait for 5 secs to let FW finish the pending cmds */
> @@ -2384,9 +2393,9 @@ static int megasas_wait_for_outstanding(struct
> megasas_instance *instance)
>  					(kill_adapter_flag == 2)) {
>  		dev_notice(&instance->pdev->dev, "pending cmds after
> reset\n");
>  		/*
> -		* Send signal to FW to stop processing any pending cmds.
> -		* The controller will be taken offline by the OS now.
> -		*/
> +		 * Send signal to FW to stop processing any pending cmds.
> +		 * The controller will be taken offline by the OS now.
> +		 */
>  		if ((instance->pdev->device ==
>  			PCI_DEVICE_ID_LSI_SAS0073SKINNY) ||
>  			(instance->pdev->device ==
> @@ -2399,7 +2408,7 @@ static int megasas_wait_for_outstanding(struct
> megasas_instance *instance)
>  		}
>  		megasas_dump_pending_frames(instance);
>  		spin_lock_irqsave(&instance->hba_lock, flags);
> -		instance->adprecovery	= MEGASAS_HW_CRITICAL_ERROR;
> +		instance->adprecovery = MEGASAS_HW_CRITICAL_ERROR;
>  		spin_unlock_irqrestore(&instance->hba_lock, flags);
>  		return FAILED;
>  	}
> @@ -2478,14 +2487,10 @@ blk_eh_timer_return megasas_reset_timer(struct
> scsi_cmnd *scmd)
>   */
>  static int megasas_reset_device(struct scsi_cmnd *scmd)  {
> -	int ret;
> -
>  	/*
>  	 * First wait for all commands to complete
>  	 */
> -	ret = megasas_generic_reset(scmd);
> -
> -	return ret;
> +	return megasas_generic_reset(scmd);
>  }
>
>  /**
> @@ -2495,6 +2500,7 @@ static int megasas_reset_bus_host(struct scsi_cmnd
> *scmd)  {
>  	int ret;
>  	struct megasas_instance *instance;
> +
>  	instance = (struct megasas_instance *)scmd->device->host->hostdata;
>
>  	/*
> @@ -2513,7 +2519,7 @@ static int megasas_reset_bus_host(struct scsi_cmnd
> *scmd)
>
>  /**
>   * megasas_bios_param - Returns disk geometry for a disk
> - * @sdev: 		device handle
> + * @sdev:		device handle
>   * @bdev:		block device
>   * @capacity:		drive capacity
>   * @geom:		geometry parameters
> @@ -2526,6 +2532,7 @@ megasas_bios_param(struct scsi_device *sdev, struct
> block_device *bdev,
>  	int sectors;
>  	sector_t cylinders;
>  	unsigned long tmp;
> +
>  	/* Default heads (64) & sectors (32) */
>  	heads = 64;
>  	sectors = 32;
> @@ -2572,6 +2579,7 @@ static void
>  megasas_service_aen(struct megasas_instance *instance, struct megasas_cmd
> *cmd)  {
>  	unsigned long flags;
> +
>  	/*
>  	 * Don't signal app if it is just an aborted previously registered aen
>  	 */
> @@ -2592,6 +2600,7 @@ megasas_service_aen(struct megasas_instance
> *instance, struct megasas_cmd *cmd)
>  	if ((instance->unload == 0) &&
>  		((instance->issuepend_done == 1))) {
>  		struct megasas_aen_event *ev;
> +
>  		ev = kzalloc(sizeof(*ev), GFP_ATOMIC);
>  		if (!ev) {
>  			dev_err(&instance->pdev->dev, "megasas_service_aen:
> out of memory\n"); @@ -2651,8 +2660,7 @@
> megasas_fw_crash_buffer_show(struct device *cdev,
>
>  	buff_addr = (unsigned long) buf;
>
> -	if (buff_offset >
> -		(instance->fw_crash_buffer_size * dmachunk)) {
> +	if (buff_offset > (instance->fw_crash_buffer_size * dmachunk)) {
>  		dev_err(&instance->pdev->dev,
>  			"Firmware crash dump offset is out of range\n");
>  		spin_unlock_irqrestore(&instance->crashdump_lock, flags);
> @@ -2664,7 +2672,7 @@ megasas_fw_crash_buffer_show(struct device *cdev,
>
>  	src_addr = (unsigned long)instance->crash_buf[buff_offset / dmachunk]
> +
>  		(buff_offset % dmachunk);
> -	memcpy(buf, (void *)src_addr,  size);
> +	memcpy(buf, (void *)src_addr, size);
>  	spin_unlock_irqrestore(&instance->crashdump_lock, flags);
>
>  	return size;
> @@ -2724,6 +2732,7 @@ megasas_fw_crash_state_show(struct device *cdev,
>  	struct Scsi_Host *shost = class_to_shost(cdev);
>  	struct megasas_instance *instance =
>  		(struct megasas_instance *) shost->hostdata;
> +
>  	return snprintf(buf, PAGE_SIZE, "%d\n", instance->fw_crash_state);  }
>
> @@ -2808,8 +2817,6 @@ megasas_complete_abort(struct megasas_instance
> *instance,
>  		cmd->cmd_status_drv = 0;
>  		wake_up(&instance->abort_cmd_wait_q);
>  	}
> -
> -	return;
>  }
>
>  /**
> @@ -2817,10 +2824,10 @@ megasas_complete_abort(struct
> megasas_instance *instance,
>   * @instance:			Adapter soft state
>   * @cmd:			Command to be completed
>   * @alt_status:			If non-zero, use this value as status to
> - * 				SCSI mid-layer instead of the value returned
> - * 				by the FW. This should be used if caller wants
> - * 				an alternate status (as in the case of aborted
> - * 				commands)
> + *				SCSI mid-layer instead of the value returned
> + *				by the FW. This should be used if caller wants
> + *				an alternate status (as in the case of aborted
> + *				commands)
>   */
>  void
>  megasas_complete_cmd(struct megasas_instance *instance, struct
> megasas_cmd *cmd, @@ -3001,7 +3008,7 @@ megasas_complete_cmd(struct
> megasas_instance *instance, struct megasas_cmd *cmd,
>
>  /**
>   * megasas_issue_pending_cmds_again -	issue all pending cmds
> - *                              	in FW again because of the fw reset
> + *					in FW again because of the fw reset
>   * @instance:				Adapter soft state
>   */
>  static inline void
> @@ -3019,7 +3026,7 @@ megasas_issue_pending_cmds_again(struct
> megasas_instance *instance)
>  	spin_unlock_irqrestore(&instance->hba_lock, flags);
>
>  	while (!list_empty(&clist_local)) {
> -		cmd	= list_entry((&clist_local)->next,
> +		cmd = list_entry((&clist_local)->next,
>  					struct megasas_cmd, list);
>  		list_del_init(&cmd->list);
>
> @@ -3052,7 +3059,7 @@ megasas_issue_pending_cmds_again(struct
> megasas_instance *instance)
>  						"issue it again.\n", cmd);
>  			cmd->cmd_status_drv = MFI_STAT_INVALID_STATUS;
>  			instance->instancet->fire_cmd(instance,
> -							cmd-
> >frame_phys_addr ,
> +							cmd-
> >frame_phys_addr,
>  							0, instance->reg_set);
>  		} else if (cmd->scmd) {
>  			dev_notice(&instance->pdev->dev, "%p scsi cmd
> [%02x]"
> @@ -3074,12 +3081,12 @@ megasas_issue_pending_cmds_again(struct
> megasas_instance *instance)
>  		dev_notice(&instance->pdev->dev, "aen_cmd in def
> process\n");
>  		megasas_return_cmd(instance, instance->aen_cmd);
>
> -		instance->aen_cmd	= NULL;
> +		instance->aen_cmd = NULL;
>  	}
>
>  	/*
> -	* Initiate AEN (Asynchronous Event Notification)
> -	*/
> +	 * Initiate AEN (Asynchronous Event Notification)
> +	 */
>  	seq_num = instance->last_seq_num;
>  	class_locale.members.reserved = 0;
>  	class_locale.members.locale = MR_EVT_LOCALE_ALL; @@ -3106,7
> +3113,7 @@ megasas_internal_reset_defer_cmds(struct megasas_instance
> *instance)
>  	u32 defer_index;
>  	unsigned long flags;
>
> -	defer_index     = 0;
> +	defer_index = 0;
>  	spin_lock_irqsave(&instance->mfi_pool_lock, flags);
>  	for (i = 0; i < max_cmd; i++) {
>  		cmd = instance->cmd_list[i];
> @@ -3155,7 +3162,7 @@ process_fw_state_change_wq(struct work_struct
> *work)
>
>  		atomic_set(&instance->fw_reset_no_pci_access, 1);
>  		instance->instancet->adp_reset(instance, instance->reg_set);
> -		atomic_set(&instance->fw_reset_no_pci_access, 0 );
> +		atomic_set(&instance->fw_reset_no_pci_access, 0);
>
>  		dev_notice(&instance->pdev->dev, "FW restarted successfully,"
>  					"initiating next stage...\n");
> @@ -3163,7 +3170,7 @@ process_fw_state_change_wq(struct work_struct
> *work)
>  		dev_notice(&instance->pdev->dev, "HBA recovery state
> machine,"
>  					"state 2 starting...\n");
>
> -		/*waitting for about 20 second before start the second init*/
> +		/* waiting for about 20 second before start the second init */
>  		for (wait = 0; wait < 30; wait++) {
>  			msleep(1000);
>  		}
> @@ -3196,15 +3203,14 @@ process_fw_state_change_wq(struct work_struct
> *work)
>  		megasas_issue_pending_cmds_again(instance);
>  		instance->issuepend_done = 1;
>  	}
> -	return ;
>  }
>
>  /**
>   * megasas_deplete_reply_queue -	Processes all completed commands
>   * @instance:				Adapter soft state
>   * @alt_status:				Alternate status to be returned to
> - * 					SCSI mid-layer instead of the status
> - * 					returned by the FW
> + *					SCSI mid-layer instead of the status
> + *					returned by the FW
>   * Note: this must be called with hba lock held
>   */
>  static int
> @@ -3284,13 +3290,13 @@ static irqreturn_t megasas_isr(int irq, void
> *devp)
>  	struct megasas_irq_context *irq_context = devp;
>  	struct megasas_instance *instance = irq_context->instance;
>  	unsigned long flags;
> -	irqreturn_t	rc;
> +	irqreturn_t rc;
>
>  	if (atomic_read(&instance->fw_reset_no_pci_access))
>  		return IRQ_HANDLED;
>
>  	spin_lock_irqsave(&instance->hba_lock, flags);
> -	rc =  megasas_deplete_reply_queue(instance, DID_OK);
> +	rc = megasas_deplete_reply_queue(instance, DID_OK);
>  	spin_unlock_irqrestore(&instance->hba_lock, flags);
>
>  	return rc;
> @@ -3566,9 +3572,8 @@ static int megasas_create_frame_pool(struct
> megasas_instance *instance)
>  	sge_sz = (IS_DMA64) ? sizeof(struct megasas_sge64) :
>  	    sizeof(struct megasas_sge32);
>
> -	if (instance->flag_ieee) {
> +	if (instance->flag_ieee)
>  		sge_sz = sizeof(struct megasas_sge_skinny);
> -	}
>
>  	/*
>  	 * For MFI controllers.
> @@ -3652,6 +3657,7 @@ static int megasas_create_frame_pool(struct
> megasas_instance *instance)  void megasas_free_cmds(struct
> megasas_instance *instance)  {
>  	int i;
> +
>  	/* First free the MFI frame pool */
>  	megasas_teardown_frame_pool(instance);
>
> @@ -3807,12 +3813,12 @@ megasas_get_pd_list(struct megasas_instance
> *instance)
>  		ret = megasas_issue_polled(instance, cmd);
>
>  	/*
> -	* the following function will get the instance PD LIST.
> -	*/
> +	 * the following function will get the instance PD LIST.
> +	 */
>
>  	pd_addr = ci->addr;
>
> -	if ( ret == 0 &&
> +	if (ret == 0 &&
>  	     (le32_to_cpu(ci->count) <
>  		  (MEGASAS_MAX_PD_CHANNELS *
> MEGASAS_MAX_DEV_PER_CHANNEL))) {
>
> @@ -4048,11 +4054,11 @@ static void megasas_update_ext_vd_details(struct
> megasas_instance *instance)
>  		instance->supportmax256vd ? "Extended VD(240 VD)firmware" :
>  		"Legacy(64 VD) firmware");
>
> -	old_map_sz =  sizeof(struct MR_FW_RAID_MAP) +
> +	old_map_sz = sizeof(struct MR_FW_RAID_MAP) +
>  				(sizeof(struct MR_LD_SPAN_MAP) *
>  				(instance->fw_supported_vd_count - 1));
> -	new_map_sz =  sizeof(struct MR_FW_RAID_MAP_EXT);
> -	fusion->drv_map_sz =  sizeof(struct MR_DRV_RAID_MAP) +
> +	new_map_sz = sizeof(struct MR_FW_RAID_MAP_EXT);
> +	fusion->drv_map_sz = sizeof(struct MR_DRV_RAID_MAP) +
>  				(sizeof(struct MR_LD_SPAN_MAP) *
>  				(instance->drv_supported_vd_count - 1));
>
> @@ -4063,7 +4069,6 @@ static void megasas_update_ext_vd_details(struct
> megasas_instance *instance)
>  		fusion->current_map_sz = new_map_sz;
>  	else
>  		fusion->current_map_sz = old_map_sz;
> -
>  }
>
>  /**
> @@ -4210,9 +4215,7 @@ static int
>  megasas_issue_init_mfi(struct megasas_instance *instance)  {
>  	__le32 context;
> -
>  	struct megasas_cmd *cmd;
> -
>  	struct megasas_init_frame *init_frame;
>  	struct megasas_init_queue_info *initq_info;
>  	dma_addr_t init_frame_h;
> @@ -4651,10 +4654,9 @@ static int megasas_init_fw(struct megasas_instance
> *instance)
>  	dev_err(&instance->pdev->dev, "INIT adapter done\n");
>
>  	/** for passthrough
> -	* the following function will get the PD LIST.
> -	*/
> -
> -	memset(instance->pd_list, 0 ,
> +	 * the following function will get the PD LIST.
> +	 */
> +	memset(instance->pd_list, 0,
>  		(MEGASAS_MAX_PD * sizeof(struct megasas_pd_list)));
>  	if (megasas_get_pd_list(instance) < 0) {
>  		dev_err(&instance->pdev->dev, "failed to get PD list\n"); @@ -
> 4682,7 +4684,7 @@ static int megasas_init_fw(struct megasas_instance
> *instance)
>  		le16_to_cpu(ctrl_info->max_strips_per_io);
>  	max_sectors_2 = le32_to_cpu(ctrl_info->max_request_size);
>
> -	tmp_sectors = min_t(u32, max_sectors_1 , max_sectors_2);
> +	tmp_sectors = min_t(u32, max_sectors_1, max_sectors_2);
>
>  	instance->disableOnlineCtrlReset =
>  	ctrl_info->properties.OnOffProperties.disableOnlineCtrlReset;
> @@ -5047,7 +5049,7 @@ static int megasas_start_aen(struct
> megasas_instance *instance)  static int megasas_io_attach(struct
> megasas_instance *instance)  {
>  	struct Scsi_Host *host = instance->host;
> -	u32		error;
> +	u32 error;
>
>  	/*
>  	 * Export parameters required by SCSI mid-layer @@ -5122,7 +5124,7
> @@ static int  megasas_set_dma_mask(struct pci_dev *pdev)  {
>  	/*
> -	 * All our contollers are capable of performing 64-bit DMA
> +	 * All our controllers are capable of performing 64-bit DMA
>  	 */
>  	if (IS_DMA64) {
>  		if (pci_set_dma_mask(pdev, DMA_BIT_MASK(64)) != 0) { @@ -
> 5208,7 +5210,7 @@ static int megasas_probe_one(struct pci_dev *pdev,
>
>  	instance = (struct megasas_instance *)host->hostdata;
>  	memset(instance, 0, sizeof(*instance));
> -	atomic_set( &instance->fw_reset_no_pci_access, 0 );
> +	atomic_set(&instance->fw_reset_no_pci_access, 0);
>  	instance->pdev = pdev;
>
>  	switch (instance->pdev->device) {
> @@ -5405,8 +5407,8 @@ static int megasas_probe_one(struct pci_dev *pdev,
>
>  	return 0;
>
> -      fail_start_aen:
> -      fail_io_attach:
> +fail_start_aen:
> +fail_io_attach:
>  	megasas_mgmt_info.count--;
>  	megasas_mgmt_info.instance[megasas_mgmt_info.max_index] =
> NULL;
>  	megasas_mgmt_info.max_index--;
> @@ -5424,7 +5426,7 @@ static int megasas_probe_one(struct pci_dev *pdev,
>  	if (instance->msix_vectors)
>  		pci_disable_msix(instance->pdev);
>  fail_init_mfi:
> -      fail_alloc_dma_buf:
> +fail_alloc_dma_buf:
>  	if (instance->evt_detail)
>  		pci_free_consistent(pdev, sizeof(struct megasas_evt_detail),
>  				    instance->evt_detail,
> @@ -5438,8 +5440,8 @@ fail_init_mfi:
>  				    instance->consumer_h);
>  	scsi_host_put(host);
>
> -      fail_alloc_instance:
> -      fail_set_dma_mask:
> +fail_alloc_instance:
> +fail_set_dma_mask:
>  	pci_disable_device(pdev);
>
>  	return -ENODEV;
> @@ -5481,8 +5483,6 @@ static void megasas_flush_cache(struct
> megasas_instance *instance)
>  			" from %s\n", __func__);
>
>  	megasas_return_cmd(instance, cmd);
> -
> -	return;
>  }
>
>  /**
> @@ -5528,8 +5528,6 @@ static void megasas_shutdown_controller(struct
> megasas_instance *instance,
>  			"from %s\n", __func__);
>
>  	megasas_return_cmd(instance, cmd);
> -
> -	return;
>  }
>
>  #ifdef CONFIG_PM
> @@ -5835,8 +5833,6 @@ static void megasas_detach_one(struct pci_dev
> *pdev)
>  	scsi_host_put(host);
>
>  	pci_disable_device(pdev);
> -
> -	return;
>  }
>
>  /**
> @@ -5905,11 +5901,11 @@ static unsigned int megasas_mgmt_poll(struct file
> *file, poll_table *wait)  {
>  	unsigned int mask;
>  	unsigned long flags;
> +
>  	poll_wait(file, &megasas_poll_wait, wait);
>  	spin_lock_irqsave(&poll_aen_lock, flags);
>  	if (megasas_poll_wait_aen)
> -		mask =   (POLLIN | POLLRDNORM);
> -
> +		mask = (POLLIN | POLLRDNORM);
>  	else
>  		mask = 0;
>  	megasas_poll_wait_aen = 0;
> @@ -5923,8 +5919,7 @@ static unsigned int megasas_mgmt_poll(struct file
> *file, poll_table *wait)
>   * @cmd:	MFI command frame
>   */
>
> -static int megasas_set_crash_dump_params_ioctl(
> -	struct megasas_cmd *cmd)
> +static int megasas_set_crash_dump_params_ioctl(struct megasas_cmd *cmd)
>  {
>  	struct megasas_instance *local_instance;
>  	int i, error = 0;
> @@ -6120,7 +6115,7 @@ megasas_mgmt_fw_ioctl(struct megasas_instance
> *instance,
>  		error = -EFAULT;
>  	}
>
> -      out:
> +out:
>  	if (sense) {
>  		dma_free_coherent(&instance->pdev->dev, ioc->sense_len,
>  				    sense, sense_handle);
> @@ -6220,10 +6215,10 @@ static int megasas_mgmt_ioctl_fw(struct file
> *file,
> unsigned long arg)
>  	spin_unlock_irqrestore(&instance->hba_lock, flags);
>
>  	error = megasas_mgmt_fw_ioctl(instance, user_ioc, ioc);
> -      out_up:
> +out_up:
>  	up(&instance->ioctl_sem);
>
> -      out_kfree_ioc:
> +out_kfree_ioc:
>  	kfree(ioc);
>  	return error;
>  }
> @@ -6458,7 +6453,8 @@ static ssize_t
>  megasas_sysfs_set_dbg_lvl(struct device_driver *dd, const char *buf,
> size_t
> count)  {
>  	int retval = count;
> -	if(sscanf(buf,"%u",&megasas_dbg_lvl)<1){
> +
> +	if (sscanf(buf,"%u",&megasas_dbg_lvl) < 1) {
>  		printk(KERN_ERR "megasas: could not set dbg_lvl\n");
>  		retval = -EINVAL;
>  	}
> @@ -6520,14 +6516,12 @@ megasas_aen_polling(struct work_struct *work)
>  				pd_index =
>  				(i * MEGASAS_MAX_DEV_PER_CHANNEL) + j;
>
> -				sdev1 =
> -				scsi_device_lookup(host, i, j, 0);
> +				sdev1 = scsi_device_lookup(host, i, j, 0);
>
>  				if (instance->pd_list[pd_index].driveState
>  						== MR_PD_STATE_SYSTEM) {
> -						if (!sdev1) {
> +					if (!sdev1)
>  						scsi_add_device(host, i, j, 0);
> -						}
>
>  					if (sdev1)
>  						scsi_device_put(sdev1);
> @@ -6548,14 +6542,12 @@ megasas_aen_polling(struct work_struct *work)
>  				pd_index =
>  				(i * MEGASAS_MAX_DEV_PER_CHANNEL) + j;
>
> -				sdev1 =
> -				scsi_device_lookup(host, i, j, 0);
> +				sdev1 = scsi_device_lookup(host, i, j, 0);
>
>  				if (instance->pd_list[pd_index].driveState
>  					== MR_PD_STATE_SYSTEM) {
> -					if (sdev1) {
> +					if (sdev1)
>  						scsi_device_put(sdev1);
> -					}
>  				} else {
>  					if (sdev1) {
>  						scsi_remove_device(sdev1);
> @@ -6701,7 +6693,7 @@ megasas_aen_polling(struct work_struct *work)
>  		}
>  	}
>
> -	if ( instance->aen_cmd != NULL ) {
> +	if (instance->aen_cmd != NULL) {
>  		kfree(ev);
>  		return ;
>  	}
Acked-by: Sumit Saxena <sumit.saxena@avagotech.com>

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH v3 1/3] megaraid : use dev_printk when possible
  2015-07-07 20:52 ` [PATCH v3 1/3] megaraid : use dev_printk " Bjorn Helgaas
  2015-07-08  6:08   ` Sumit Saxena
@ 2015-07-08 10:44   ` Hannes Reinecke
  1 sibling, 0 replies; 12+ messages in thread
From: Hannes Reinecke @ 2015-07-08 10:44 UTC (permalink / raw)
  To: Bjorn Helgaas, Kashyap Desai, Uday Lingala, Sumit Saxena
  Cc: megaraidlinux.pdl, linux-scsi, James E.J. Bottomley,
	linux-kernel, Joe Perches, Christoph Hellwig

On 07/07/2015 10:52 PM, Bjorn Helgaas wrote:
> Use dev_printk() when possible to make messages more useful.
> 
> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
> ---
>  drivers/scsi/megaraid.c |  140 ++++++++++++++++++++++-------------------------
>  1 file changed, 66 insertions(+), 74 deletions(-)
> 
Reviewed-by: Hannes Reinecke <hare@suse.de>

Cheers,

Hannes
-- 
Dr. Hannes Reinecke		               zSeries & Storage
hare@suse.de			               +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton
HRB 21284 (AG Nürnberg)

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH v3 2/3] megaraid_sas : use dev_printk when possible
  2015-07-07 20:52 ` [PATCH v3 2/3] megaraid_sas " Bjorn Helgaas
  2015-07-08  9:13   ` Sumit Saxena
@ 2015-07-08 10:47   ` Hannes Reinecke
  2015-07-08 13:28     ` Bjorn Helgaas
  1 sibling, 1 reply; 12+ messages in thread
From: Hannes Reinecke @ 2015-07-08 10:47 UTC (permalink / raw)
  To: Bjorn Helgaas, Kashyap Desai, Uday Lingala, Sumit Saxena
  Cc: megaraidlinux.pdl, linux-scsi, James E.J. Bottomley,
	linux-kernel, Joe Perches, Christoph Hellwig

On 07/07/2015 10:52 PM, Bjorn Helgaas wrote:
> Use dev_printk() when possible to make messages more useful.
> 
> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
> ---
>  drivers/scsi/megaraid/megaraid_sas_base.c   |  304 +++++++++++++--------------
>  drivers/scsi/megaraid/megaraid_sas_fusion.c |   95 ++++----
>  2 files changed, 196 insertions(+), 203 deletions(-)
> 
[ .. ]
> @@ -1873,8 +1872,8 @@ static int megasas_get_ld_vf_affiliation_111(struct megasas_instance *instance,
>  	cmd = megasas_get_cmd(instance);
>  
>  	if (!cmd) {
> -		printk(KERN_DEBUG "megasas: megasas_get_ld_vf_affiliation_111:"
> -		       "Failed to get cmd for scsi%d.\n",
> +		dev_printk(KERN_DEBUG, &instance->pdev->dev, "megasas_get_ld_vf_affiliation_111:"
> +		       "Failed to get cmd for scsi%d\n",
>  			instance->host->host_no);
>  		return -ENOMEM;
>  	}
Makes one wonder why we don't have a 'dev_debug'; dev_notice() and
dev_warn() are there ...

Otherwise: Reviewed-by: Hannes Reinecke <hare@suse.de>

Cheers,

Hannes
-- 
Dr. Hannes Reinecke		               zSeries & Storage
hare@suse.de			               +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton
HRB 21284 (AG Nürnberg)

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH v3 3/3] megaraid_sas : fix whitespace errors
  2015-07-07 20:52 ` [PATCH v3 3/3] megaraid_sas : fix whitespace errors Bjorn Helgaas
  2015-07-08  9:13   ` Sumit Saxena
@ 2015-07-08 10:48   ` Hannes Reinecke
  2015-08-26 14:36   ` James Bottomley
  2 siblings, 0 replies; 12+ messages in thread
From: Hannes Reinecke @ 2015-07-08 10:48 UTC (permalink / raw)
  To: Bjorn Helgaas, Kashyap Desai, Uday Lingala, Sumit Saxena
  Cc: megaraidlinux.pdl, linux-scsi, James E.J. Bottomley,
	linux-kernel, Joe Perches, Christoph Hellwig

On 07/07/2015 10:52 PM, Bjorn Helgaas wrote:
> Fix whitespace and indentation errors.  No code change.
> 
> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
> ---
>  drivers/scsi/megaraid/megaraid_sas_base.c |  244 ++++++++++++++---------------
>  1 file changed, 118 insertions(+), 126 deletions(-)
> 
Reviewed-by: Hannes Reinecke <hare@suse.de>

Cheers,

Hannes
-- 
Dr. Hannes Reinecke		               zSeries & Storage
hare@suse.de			               +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton
HRB 21284 (AG Nürnberg)

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH v3 2/3] megaraid_sas : use dev_printk when possible
  2015-07-08 10:47   ` Hannes Reinecke
@ 2015-07-08 13:28     ` Bjorn Helgaas
  0 siblings, 0 replies; 12+ messages in thread
From: Bjorn Helgaas @ 2015-07-08 13:28 UTC (permalink / raw)
  To: Hannes Reinecke
  Cc: Kashyap Desai, Uday Lingala, Sumit Saxena, PDL,MEGARAIDLINUX,
	linux-scsi, James E.J. Bottomley, linux-kernel, Joe Perches,
	Christoph Hellwig

On Wed, Jul 8, 2015 at 5:47 AM, Hannes Reinecke <hare@suse.de> wrote:
> On 07/07/2015 10:52 PM, Bjorn Helgaas wrote:
>> Use dev_printk() when possible to make messages more useful.
>>
>> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
>> ---
>>  drivers/scsi/megaraid/megaraid_sas_base.c   |  304 +++++++++++++--------------
>>  drivers/scsi/megaraid/megaraid_sas_fusion.c |   95 ++++----
>>  2 files changed, 196 insertions(+), 203 deletions(-)
>>
> [ .. ]
>> @@ -1873,8 +1872,8 @@ static int megasas_get_ld_vf_affiliation_111(struct megasas_instance *instance,
>>       cmd = megasas_get_cmd(instance);
>>
>>       if (!cmd) {
>> -             printk(KERN_DEBUG "megasas: megasas_get_ld_vf_affiliation_111:"
>> -                    "Failed to get cmd for scsi%d.\n",
>> +             dev_printk(KERN_DEBUG, &instance->pdev->dev, "megasas_get_ld_vf_affiliation_111:"
>> +                    "Failed to get cmd for scsi%d\n",
>>                       instance->host->host_no);
>>               return -ENOMEM;
>>       }
> Makes one wonder why we don't have a 'dev_debug'; dev_notice() and
> dev_warn() are there ...

There actually is a 'dev_dbg()' but when CONFIG_DYNAMIC_DEBUG is set,
I think dev_dbg() generates no output by default.  So to preserve the
previous behavior of "this message always appears in the dmesg log no
matter what the dynamic debug setting," I used dev_printk(KERN_DEBUG).

Somebody who maintains these drivers could probably go through and
convert these to either dev_info() or dev_dbg() depending on what they
need.  That would require more judgment than I wanted to get into :)

Thanks for taking a look at these!

Bjorn

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH v3 3/3] megaraid_sas : fix whitespace errors
  2015-07-07 20:52 ` [PATCH v3 3/3] megaraid_sas : fix whitespace errors Bjorn Helgaas
  2015-07-08  9:13   ` Sumit Saxena
  2015-07-08 10:48   ` Hannes Reinecke
@ 2015-08-26 14:36   ` James Bottomley
  2 siblings, 0 replies; 12+ messages in thread
From: James Bottomley @ 2015-08-26 14:36 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Kashyap Desai, Uday Lingala, Sumit Saxena, megaraidlinux.pdl,
	linux-scsi, linux-kernel, Joe Perches, Christoph Hellwig

On Tue, 2015-07-07 at 15:52 -0500, Bjorn Helgaas wrote:
> Fix whitespace and indentation errors.  No code change.

checkpatch says you missed one:

ERROR: space required after that ',' (ctx:VxV)
#860: FILE: drivers/scsi/megaraid/megaraid_sas_base.c:6457:
+       if (sscanf(buf,"%u",&megasas_dbg_lvl) < 1) {
                      ^

ERROR: space required after that ',' (ctx:VxO)
#860: FILE: drivers/scsi/megaraid/megaraid_sas_base.c:6457:
+       if (sscanf(buf,"%u",&megasas_dbg_lvl) < 1) {
                           ^

ERROR: space required before that '&' (ctx:OxV)
#860: FILE: drivers/scsi/megaraid/megaraid_sas_base.c:6457:
+       if (sscanf(buf,"%u",&megasas_dbg_lvl) < 1) {


I fixed it up

James



^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2015-08-26 14:36 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-07 20:52 [PATCH v3 0/3] megaraid: use dev_printk() when possible Bjorn Helgaas
2015-07-07 20:52 ` [PATCH v3 1/3] megaraid : use dev_printk " Bjorn Helgaas
2015-07-08  6:08   ` Sumit Saxena
2015-07-08 10:44   ` Hannes Reinecke
2015-07-07 20:52 ` [PATCH v3 2/3] megaraid_sas " Bjorn Helgaas
2015-07-08  9:13   ` Sumit Saxena
2015-07-08 10:47   ` Hannes Reinecke
2015-07-08 13:28     ` Bjorn Helgaas
2015-07-07 20:52 ` [PATCH v3 3/3] megaraid_sas : fix whitespace errors Bjorn Helgaas
2015-07-08  9:13   ` Sumit Saxena
2015-07-08 10:48   ` Hannes Reinecke
2015-08-26 14:36   ` James Bottomley

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).