Re: [PATCH v3 2/3] megaraid_sas : use dev_printk when possible
On Wed, Jul 8, 2015 at 5:47 AM, Hannes Reinecke 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 >> --- >> 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 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH v3 2/3] megaraid_sas : use dev_printk when possible
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 > --- > 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 Cheers, Hannes -- Dr. Hannes ReineckezSeries & Storage h...@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) -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
RE: [PATCH v3 2/3] megaraid_sas : use dev_printk when possible
> -Original Message- > From: Bjorn Helgaas [mailto:bhelg...@google.com] > Sent: Wednesday, July 08, 2015 2:23 AM > To: Kashyap Desai; Uday Lingala; Sumit Saxena > Cc: megaraidlinux@avagotech.com; linux-s...@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 > --- > 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 & 0x) == 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_c
[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 --- 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 & 0x) == 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->