scsi: always use format argumets for dev_printk
PATCH 1/4 scsi: always use format argumets for dev_printk
--- drivers/scsi/scsi_logging.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
drivers/scsi/scsi_logging.c +7 -7
@@ -251,7 +251,7 @@ void scsi_print_command(struct scsi_cmnd *cmd)if (cmd->cmd_len >16 ) {/* Print opcode in one line and use separate lines for CDB */ off +=scnprintf (logbuf + off, logbuf_len - off,"\n" ); -dev_printk (KERN_INFO , &cmd->device->sdev_gendev, logbuf); +dev_printk (KERN_INFO , &cmd->device->sdev_gendev,"%s" , logbuf);scsi_log_release_buffer (logbuf);for (k =0 ; k < cmd->cmd_len; k +=16 ) {size_t linelen =min (cmd->cmd_len - k,16 );
@@ -269,7 +269,7 @@ void scsi_print_command(struct scsi_cmnd *cmd)16 ,1 , logbuf + off, logbuf_len - off, false); } -dev_printk (KERN_INFO , &cmd->device->sdev_gendev, +dev_printk (KERN_INFO , &cmd->device->sdev_gendev,"%s" , logbuf);scsi_log_release_buffer (logbuf); }
@@ -282,7 +282,7 @@ void scsi_print_command(struct scsi_cmnd *cmd) false); } out_printk: -dev_printk (KERN_INFO , &cmd->device->sdev_gendev, logbuf); +dev_printk (KERN_INFO , &cmd->device->sdev_gendev,"%s" , logbuf);scsi_log_release_buffer (logbuf); }EXPORT_SYMBOL (scsi_print_command);
@@ -360,7 +360,7 @@ scsi_log_dump_sense(const struct scsi_device *sdev, const char *name, int tag,hex_dump_to_buffer (&sense_buffer[i], len,16 ,1 , logbuf + off, logbuf_len - off, false); -dev_printk (KERN_INFO , &sdev->sdev_gendev, logbuf); +dev_printk (KERN_INFO , &sdev->sdev_gendev,"%s" , logbuf); }scsi_log_release_buffer (logbuf); }
@@ -377,7 +377,7 @@ scsi_log_print_sense_hdr(const struct scsi_device *sdev, const char *name,return ; off =sdev_format_header (logbuf, logbuf_len, name, tag); off +=scsi_format_sense_hdr (logbuf + off, logbuf_len - off, sshdr); -dev_printk (KERN_INFO , &sdev->sdev_gendev, logbuf); +dev_printk (KERN_INFO , &sdev->sdev_gendev,"%s" , logbuf);scsi_log_release_buffer (logbuf); logbuf =scsi_log_reserve_buffer (&logbuf_len);
@@ -386,7 +386,7 @@ scsi_log_print_sense_hdr(const struct scsi_device *sdev, const char *name, off =sdev_format_header (logbuf, logbuf_len, name, tag); off +=scsi_format_extd_sense (logbuf + off, logbuf_len - off, sshdr->asc, sshdr->ascq); -dev_printk (KERN_INFO , &sdev->sdev_gendev, logbuf); +dev_printk (KERN_INFO , &sdev->sdev_gendev,"%s" , logbuf);scsi_log_release_buffer (logbuf); }
@@ -483,7 +483,7 @@ void scsi_print_result(const struct scsi_cmnd *cmd, const char *msg, off +=scnprintf (logbuf + off, logbuf_len - off,"driverbyte=0x%02x" ,driver_byte (cmd->result)); out_printk: -dev_printk (KERN_INFO , &cmd->device->sdev_gendev, logbuf); +dev_printk (KERN_INFO , &cmd->device->sdev_gendev,"%s" , logbuf);scsi_log_release_buffer (logbuf); }EXPORT_SYMBOL (scsi_print_result);
Signature · 1 line
1.9.1
PATCH 2/4 scsi: annotate sdev_prefix_printk and scmd_printk as printf-like
--- include/scsi/scsi_device.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
include/scsi/scsi_device.h +5 -4
@@ -237,14 +237,15 @@ struct scsi_dh_data {* like scmd_printk, but the device name is passed in * as a string pointer */ -extern int sdev_prefix_printk (const char *,const struct scsi_device *, -const char *,const char *, ...); +__printf(4, 5) int +sdev_prefix_printk (const char *,const struct scsi_device *,const char *, +const char *, ...); #define sdev_printk(l, sdev, fmt, a...) \ sdev_prefix_printk(l, sdev, NULL, fmt, ##a) -extern int scmd_printk (const char *,const struct scsi_cmnd *, -const char *, ...); +__printf(3, 4) int +scmd_printk (const char *,const struct scsi_cmnd *,const char *, ...); #define scmd_dbg(scmd, fmt, a...) \ do { \
Signature · 1 line
1.9.1
Re: [PATCH 2/4] scsi: annotate sdev_prefix_printk and scmd_printk as printf-like
Quoted 1 line · Christoph Hellwig
Signed-off-by Christoph Hellwig <[email protected]>
Cheers,
Hannes
Signature · 9 lines
Dr. Hannes Reinecke zSeries & Storage [email protected] +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-scsi" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 2/4] scsi: annotate sdev_prefix_printk and scmd_printk as printf-like
In reply to Christoph HellwigQuoted 19 lines · Christoph Hellwig
Signed-off-by Christoph Hellwig <[email protected]>--- include/scsi/scsi_device.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)include/scsi/scsi_device.h +3
-2@@ -237,14 +237,15 @@ struct scsi_dh_data {* like scmd_printk, but the device name is passed in * as a string pointer */ -extern int sdev_prefix_printk (const char *,const struct scsi_device *, -const char *,const char *, ...); +__printf(4, 5) int +sdev_prefix_printk (const char *,const struct scsi_device *,const char *, +const char *, ...);
include/scsi/scsi_device.h struct scsi_dh_data { · line 251
Quoted 10 lines
include/scsi/scsi_device.h +2
-2#define sdev_printk(l, sdev, fmt, a...) \ sdev_prefix_printk(l, sdev, NULL, fmt, ##a) -extern int scmd_printk (const char *,const struct scsi_cmnd *, -const char *, ...); +__printf(3, 4) int +scmd_printk (const char *,const struct scsi_cmnd *,const char *, ...); #define scmd_dbg(scmd, fmt, a...) \ do { \
PATCH 3/4 ch: remove debug noise in ch_do_scsi
In reply to Christoph HellwigThe midlayer logging already prints the cdb details if the logging level is high enough, no need to duplicate this in the ch driver.
--- drivers/scsi/ch.c | 8 -------- 1 file changed, 8 deletions(-)
drivers/scsi/ch.c +0 -8
@@ -194,18 +194,10 @@ ch_do_scsi(scsi_changer *ch, unsigned char *cmd, int cmd_len, retry: errno =0 ; -if (debug) { -char logbuf[SCSI_LOG_BUFSIZE ]; - -__scsi_format_command (logbuf,sizeof (logbuf), cmd, cmd_len); -DPRINTK ("command: %s" , logbuf); - } - result =scsi_execute_req (ch->device, cmd, direction, buffer, buflength, &sshdr, timeout *HZ ,MAX_RETRIES ,NULL ); -DPRINTK ("result: 0x%x\n" ,result);if (driver_byte (result) &DRIVER_SENSE ) {if (debug)scsi_print_sense_hdr (ch->device, ch->name, &sshdr);
Signature · 1 line
1.9.1
Re: [PATCH 3/4] ch: remove debug noise in ch_do_scsi
Quoted 4 lines · Christoph Hellwig
The midlayer logging already prints the cdb details if the logging level is high enough, no need to duplicate this in the ch driver.
Signed-off-by Christoph Hellwig <[email protected]>
Cheers,
Hannes
Signature · 9 lines
Dr. Hannes Reinecke zSeries & Storage [email protected] +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-scsi" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 3/4] ch: remove debug noise in ch_do_scsi
In reply to Christoph HellwigQuoted 21 lines · Christoph Hellwig
The midlayer logging already prints the cdb details if the logging level is high enough, no need to duplicate this in the ch driver.
Signed-off-by Christoph Hellwig <[email protected]>--- drivers/scsi/ch.c | 8 -------- 1 file changed, 8 deletions(-)drivers/scsi/ch.c +0
-5@@ -194,18 +194,10 @@ ch_do_scsi(scsi_changer *ch, unsigned char *cmd, int cmd_len, retry: errno =0 ; -if (debug) { -char logbuf[SCSI_LOG_BUFSIZE ]; - -__scsi_format_command (logbuf,sizeof (logbuf), cmd, cmd_len); -DPRINTK ("command: %s" , logbuf);
drivers/scsi/ch.c ch_do_scsi(scsi_changer *ch, unsigned char *cmd, int cmd_len, · line 203
Quoted 10 lines
drivers/scsi/ch.c +0
-3- } - result =scsi_execute_req (ch->device, cmd, direction, buffer, buflength, &sshdr, timeout *HZ ,MAX_RETRIES ,NULL ); -DPRINTK ("result: 0x%x\n" ,result);if (driver_byte (result) &DRIVER_SENSE ) {if (debug)scsi_print_sense_hdr (ch->device, ch->name, &sshdr);
PATCH 4/4 sr: reduce debug noise in sr_do_ioctl
In reply to Christoph HellwigThe midlayer scsi logging already logs the command and sense code if the logging level is high enough, no need to duplicate that in the sr driver.
--- drivers/scsi/sr_ioctl.c | 18 ------------------ 1 file changed, 18 deletions(-)
drivers/scsi/sr_ioctl.c +0 -18
@@ -188,7 +188,6 @@ int sr_do_ioctl(Scsi_CD *cd, struct packet_command *cgc)struct scsi_sense_hdr sshdr;int result, err =0 , retries =0 ;struct request_sense *sense = cgc->sense; -char logbuf[SCSI_LOG_BUFSIZE ]; SDev = cd->device;
@@ -246,9 +245,6 @@ int sr_do_ioctl(Scsi_CD *cd, struct packet_command *cgc)sr_printk (KERN_INFO , cd,"CDROM not ready. Make sure there " "is a disc in the drive.\n" ); -#ifdef DEBUG -scsi_print_sense_hdr (cd->device, cd->cdi.name, &sshdr); -#endif err = -ENOMEDIUM ;break ;case ILLEGAL_REQUEST :
@@ -257,22 +253,8 @@ int sr_do_ioctl(Scsi_CD *cd, struct packet_command *cgc) sshdr.ascq == 0x00)/* sense: Invalid command operation code */ err = -EDRIVE_CANT_DO_THIS ; -#ifdef DEBUG -__scsi_format_command (logbuf,sizeof (logbuf), - cgc->cmd,CDROM_PACKET_SIZE ); -sr_printk (KERN_INFO , cd, -"CDROM (ioctl) invalid command: %s\n" , - logbuf); -scsi_print_sense_hdr (cd->device, cd->cdi.name, &sshdr); -#endif break ;default : -__scsi_format_command (logbuf,sizeof (logbuf), - cgc->cmd,CDROM_PACKET_SIZE ); -sr_printk (KERN_ERR , cd, -"CDROM (ioctl) error, command: %s\n" , - logbuf); -scsi_print_sense_hdr (cd->device, cd->cdi.name, &sshdr); err = -EIO ; } }
Signature · 1 line
1.9.1
Re: [PATCH 4/4] sr: reduce debug noise in sr_do_ioctl
Quoted 5 lines · Christoph Hellwig
The midlayer scsi logging already logs the command and sense code if the logging level is high enough, no need to duplicate that in the sr driver.
Signed-off-by Christoph Hellwig <[email protected]>
Cheers,
Hannes
Signature · 9 lines
Dr. Hannes Reinecke zSeries & Storage [email protected] +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-scsi" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 4/4] sr: reduce debug noise in sr_do_ioctl
In reply to Christoph HellwigQuoted 44 lines · Christoph Hellwig
The midlayer scsi logging already logs the command and sense code if the logging level is high enough, no need to duplicate that in the sr driver.
Signed-off-by Christoph Hellwig <[email protected]>--- drivers/scsi/sr_ioctl.c | 18 ------------------ 1 file changed, 18 deletions(-)drivers/scsi/sr_ioctl.c +0
-12@@ -188,7 +188,6 @@ int sr_do_ioctl(Scsi_CD *cd, struct packet_command *cgc)struct scsi_sense_hdr sshdr;int result, err =0 , retries =0 ;struct request_sense *sense = cgc->sense; -char logbuf[SCSI_LOG_BUFSIZE ]; SDev = cd->device;@@ -246,9 +245,6 @@ int sr_do_ioctl(Scsi_CD *cd, struct packet_command *cgc)sr_printk (KERN_INFO , cd,"CDROM not ready. Make sure there " "is a disc in the drive.\n" ); -#ifdef DEBUG -scsi_print_sense_hdr (cd->device, cd->cdi.name, &sshdr); -#endif err = -ENOMEDIUM ;break ;case ILLEGAL_REQUEST :@@ -257,22 +253,8 @@ int sr_do_ioctl(Scsi_CD *cd, struct packet_command *cgc) sshdr.ascq == 0x00)/* sense: Invalid command operation code */ err = -EDRIVE_CANT_DO_THIS ; -#ifdef DEBUG -__scsi_format_command (logbuf,sizeof (logbuf), - cgc->cmd,CDROM_PACKET_SIZE ); -sr_printk (KERN_INFO , cd, -"CDROM (ioctl) invalid command: %s\n" , - logbuf); -scsi_print_sense_hdr (cd->device, cd->cdi.name, &sshdr); -#endif break ;
drivers/scsi/sr_ioctl.c int sr_do_ioctl(Scsi_CD *cd, struct packet_command *cgc) · line 260
Quoted 10 lines
drivers/scsi/sr_ioctl.c +0
-6default : -__scsi_format_command (logbuf,sizeof (logbuf), - cgc->cmd,CDROM_PACKET_SIZE ); -sr_printk (KERN_ERR , cd, -"CDROM (ioctl) error, command: %s\n" , - logbuf); -scsi_print_sense_hdr (cd->device, cd->cdi.name, &sshdr); err = -EIO ; } }
Quoted 1 line · Christoph Hellwig
Signed-off-by Christoph Hellwig <[email protected]>
Thanks. Ideally I would have preferred them folded into the logging series, but if that's not going to be forthcoming, then this works.
For the series:
James
Quoted 1 line · Christoph Hellwig
Signed-off-by Christoph Hellwig <[email protected]>
Cheers,
Hannes
Signature · 9 lines
Dr. Hannes Reinecke zSeries & Storage [email protected] +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-scsi" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 64 lines · Christoph Hellwig
Signed-off-by Christoph Hellwig <[email protected]>--- drivers/scsi/scsi_logging.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)drivers/scsi/scsi_logging.c +6
-6@@ -251,7 +251,7 @@ void scsi_print_command(struct scsi_cmnd *cmd)if (cmd->cmd_len >16 ) {/* Print opcode in one line and use separate lines for CDB */ off +=scnprintf (logbuf + off, logbuf_len - off,"\n" ); -dev_printk (KERN_INFO , &cmd->device->sdev_gendev, logbuf); +dev_printk (KERN_INFO , &cmd->device->sdev_gendev,"%s" , logbuf);scsi_log_release_buffer (logbuf);for (k =0 ; k < cmd->cmd_len; k +=16 ) {size_t linelen =min (cmd->cmd_len - k,16 );@@ -269,7 +269,7 @@ void scsi_print_command(struct scsi_cmnd *cmd)16 ,1 , logbuf + off, logbuf_len - off, false); } -dev_printk (KERN_INFO , &cmd->device->sdev_gendev, +dev_printk (KERN_INFO , &cmd->device->sdev_gendev,"%s" , logbuf);scsi_log_release_buffer (logbuf); }@@ -282,7 +282,7 @@ void scsi_print_command(struct scsi_cmnd *cmd) false); } out_printk: -dev_printk (KERN_INFO , &cmd->device->sdev_gendev, logbuf); +dev_printk (KERN_INFO , &cmd->device->sdev_gendev,"%s" , logbuf);scsi_log_release_buffer (logbuf); }EXPORT_SYMBOL (scsi_print_command);@@ -360,7 +360,7 @@ scsi_log_dump_sense(const struct scsi_device *sdev, const char *name, int tag,hex_dump_to_buffer (&sense_buffer[i], len,16 ,1 , logbuf + off, logbuf_len - off, false); -dev_printk (KERN_INFO , &sdev->sdev_gendev, logbuf); +dev_printk (KERN_INFO , &sdev->sdev_gendev,"%s" , logbuf); }scsi_log_release_buffer (logbuf); }@@ -377,7 +377,7 @@ scsi_log_print_sense_hdr(const struct scsi_device *sdev, const char *name,return ; off =sdev_format_header (logbuf, logbuf_len, name, tag); off +=scsi_format_sense_hdr (logbuf + off, logbuf_len - off, sshdr); -dev_printk (KERN_INFO , &sdev->sdev_gendev, logbuf); +dev_printk (KERN_INFO , &sdev->sdev_gendev,"%s" , logbuf);scsi_log_release_buffer (logbuf); logbuf =scsi_log_reserve_buffer (&logbuf_len);@@ -386,7 +386,7 @@ scsi_log_print_sense_hdr(const struct scsi_device *sdev, const char *name, off =sdev_format_header (logbuf, logbuf_len, name, tag); off +=scsi_format_extd_sense (logbuf + off, logbuf_len - off, sshdr->asc, sshdr->ascq); -dev_printk (KERN_INFO , &sdev->sdev_gendev, logbuf); +dev_printk (KERN_INFO , &sdev->sdev_gendev,"%s" , logbuf);scsi_log_release_buffer (logbuf); }
drivers/scsi/scsi_logging.c void scsi_print_result(const struct scsi_cmnd *cmd, const char *msg, · line 489
Quoted 8 lines
drivers/scsi/scsi_logging.c +1
-1@@ -483,7 +483,7 @@ void scsi_print_result(const struct scsi_cmnd *cmd, const char *msg, off +=scnprintf (logbuf + off, logbuf_len - off,"driverbyte=0x%02x" ,driver_byte (cmd->result)); out_printk: -dev_printk (KERN_INFO , &cmd->device->sdev_gendev, logbuf); +dev_printk (KERN_INFO , &cmd->device->sdev_gendev,"%s" , logbuf);scsi_log_release_buffer (logbuf); }EXPORT_SYMBOL (scsi_print_result);