From: Yoshihiro YUNOMAE <yoshihiro.yunomae.ez@hitachi.com>
To: Hannes Reinecke <hare@suse.de>
Cc: Christoph Hellwig <hch@infradead.org>,
James Bottomley <jbottomley@parallels.com>,
Ewan Milne <emilne@redhat.com>,
linux-scsi@vger.kernel.org
Subject: Re: [PATCH 18/20] scsi: remove scsi_show_result()
Date: Fri, 05 Sep 2014 13:22:13 +0900 [thread overview]
Message-ID: <54093A75.6050207@hitachi.com> (raw)
In-Reply-To: <1409738775-80876-19-git-send-email-hare@suse.de>
This patch looks good.
Thanks,
Yoshihiro YUNOMAE
(2014/09/03 19:06), Hannes Reinecke wrote:
> scsi_show_result() was only ever used in one place in sd.c.
> So open-code scsi_show_result() in sd.c and remove it from
> constants.c.
>
> Signed-off-by: Hannes Reinecke <hare@suse.de>
> ---
> drivers/scsi/constants.c | 16 -------------
> drivers/scsi/sd.c | 62 +++++++++++++++++++++++++++++-------------------
> include/scsi/scsi_dbg.h | 1 -
> 3 files changed, 37 insertions(+), 42 deletions(-)
>
> diff --git a/drivers/scsi/constants.c b/drivers/scsi/constants.c
> index 630e272..d7516c3 100644
> --- a/drivers/scsi/constants.c
> +++ b/drivers/scsi/constants.c
> @@ -1496,22 +1496,6 @@ const char *scsi_show_driverbyte(int result)
> }
> EXPORT_SYMBOL(scsi_show_driverbyte);
>
> -void scsi_show_result(int result)
> -{
> - const char *hb_string = scsi_show_hostbyte(result);
> - const char *db_string = scsi_show_driverbyte(result);
> -
> - if (hb_string || db_string)
> - printk("Result: hostbyte=%s driverbyte=%s\n",
> - hb_string ? hb_string : "invalid",
> - db_string ? db_string : "invalid");
> - else
> - printk("Result: hostbyte=0x%02x driverbyte=0x%02x\n",
> - host_byte(result), driver_byte(result));
> -}
> -EXPORT_SYMBOL(scsi_show_result);
> -
> -
> void scsi_print_result(struct scsi_cmnd *cmd)
> {
> const char *hb_string = scsi_show_hostbyte(cmd->result);
> diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
> index aac267a..f96e3f9 100644
> --- a/drivers/scsi/sd.c
> +++ b/drivers/scsi/sd.c
> @@ -116,7 +116,7 @@ static int sd_eh_action(struct scsi_cmnd *, int);
> static void sd_read_capacity(struct scsi_disk *sdkp, unsigned char *buffer);
> static void scsi_disk_release(struct device *cdev);
> static void sd_print_sense_hdr(struct scsi_disk *, struct scsi_sense_hdr *);
> -static void sd_print_result(struct scsi_disk *, int);
> +static void sd_print_result(struct scsi_disk *, const char *, int);
>
> static DEFINE_SPINLOCK(sd_index_lock);
> static DEFINE_IDA(sd_index_ida);
> @@ -1479,7 +1479,7 @@ static int sd_sync_cache(struct scsi_disk *sdkp)
> }
>
> if (res) {
> - sd_print_result(sdkp, res);
> + sd_print_result(sdkp, "SYNCHRONIZE CACHE failed", res);
>
> if (driver_byte(res) & DRIVER_SENSE)
> sd_print_sense_hdr(sdkp, &sshdr);
> @@ -1820,8 +1820,8 @@ sd_spinup_disk(struct scsi_disk *sdkp)
> /* no sense, TUR either succeeded or failed
> * with a status error */
> if(!spintime && !scsi_status_is_good(the_result)) {
> - sd_printk(KERN_NOTICE, sdkp, "Unit Not Ready\n");
> - sd_print_result(sdkp, the_result);
> + sd_print_result(sdkp, "Unit Not Ready",
> + the_result);
> }
> break;
> }
> @@ -1937,11 +1937,13 @@ static int sd_read_protection_type(struct scsi_disk *sdkp, unsigned char *buffer
> return ret;
> }
>
> -static void read_capacity_error(struct scsi_disk *sdkp, struct scsi_device *sdp,
> - struct scsi_sense_hdr *sshdr, int sense_valid,
> - int the_result)
> +static void read_capacity_error(struct scsi_disk *sdkp,
> + struct scsi_sense_hdr *sshdr, int sense_valid,
> + const char *msg, int the_result)
> {
> - sd_print_result(sdkp, the_result);
> + struct scsi_device *sdp = sdkp->device;
> +
> + sd_print_result(sdkp, msg, the_result);
> if (driver_byte(the_result) & DRIVER_SENSE)
> sd_print_sense_hdr(sdkp, sshdr);
> else
> @@ -1970,9 +1972,9 @@ static void read_capacity_error(struct scsi_disk *sdkp, struct scsi_device *sdp,
>
> #define READ_CAPACITY_RETRIES_ON_RESET 10
>
> -static int read_capacity_16(struct scsi_disk *sdkp, struct scsi_device *sdp,
> - unsigned char *buffer)
> +static int read_capacity_16(struct scsi_disk *sdkp, unsigned char *buffer)
> {
> + struct scsi_device *sdp = sdkp->device;
> unsigned char cmd[16];
> struct scsi_sense_hdr sshdr;
> int sense_valid = 0;
> @@ -2022,8 +2024,8 @@ static int read_capacity_16(struct scsi_disk *sdkp, struct scsi_device *sdp,
> } while (the_result && retries);
>
> if (the_result) {
> - sd_printk(KERN_NOTICE, sdkp, "READ CAPACITY(16) failed\n");
> - read_capacity_error(sdkp, sdp, &sshdr, sense_valid, the_result);
> + read_capacity_error(sdkp, &sshdr, sense_valid,
> + "READ CAPACITY(16) failed", the_result);
> return -EINVAL;
> }
>
> @@ -2066,9 +2068,9 @@ static int read_capacity_16(struct scsi_disk *sdkp, struct scsi_device *sdp,
> return sector_size;
> }
>
> -static int read_capacity_10(struct scsi_disk *sdkp, struct scsi_device *sdp,
> - unsigned char *buffer)
> +static int read_capacity_10(struct scsi_disk *sdkp, unsigned char *buffer)
> {
> + struct scsi_device *sdp = sdkp->device;
> unsigned char cmd[16];
> struct scsi_sense_hdr sshdr;
> int sense_valid = 0;
> @@ -2104,8 +2106,8 @@ static int read_capacity_10(struct scsi_disk *sdkp, struct scsi_device *sdp,
> } while (the_result && retries);
>
> if (the_result) {
> - sd_printk(KERN_NOTICE, sdkp, "READ CAPACITY failed\n");
> - read_capacity_error(sdkp, sdp, &sshdr, sense_valid, the_result);
> + read_capacity_error(sdkp, &sshdr, sense_valid,
> + "READ CAPACITY failed", the_result);
> return -EINVAL;
> }
>
> @@ -2158,17 +2160,17 @@ sd_read_capacity(struct scsi_disk *sdkp, unsigned char *buffer)
> sector_t old_capacity = sdkp->capacity;
>
> if (sd_try_rc16_first(sdp)) {
> - sector_size = read_capacity_16(sdkp, sdp, buffer);
> + sector_size = read_capacity_16(sdkp, buffer);
> if (sector_size == -EOVERFLOW)
> goto got_data;
> if (sector_size == -ENODEV)
> return;
> if (sector_size < 0)
> - sector_size = read_capacity_10(sdkp, sdp, buffer);
> + sector_size = read_capacity_10(sdkp, buffer);
> if (sector_size < 0)
> return;
> } else {
> - sector_size = read_capacity_10(sdkp, sdp, buffer);
> + sector_size = read_capacity_10(sdkp, buffer);
> if (sector_size == -EOVERFLOW)
> goto got_data;
> if (sector_size < 0)
> @@ -2178,7 +2180,7 @@ sd_read_capacity(struct scsi_disk *sdkp, unsigned char *buffer)
> int old_sector_size = sector_size;
> sd_printk(KERN_NOTICE, sdkp, "Very big device. "
> "Trying to use READ CAPACITY(16).\n");
> - sector_size = read_capacity_16(sdkp, sdp, buffer);
> + sector_size = read_capacity_16(sdkp, buffer);
> if (sector_size < 0) {
> sd_printk(KERN_NOTICE, sdkp,
> "Using 0xffffffff as device size\n");
> @@ -3124,8 +3126,7 @@ static int sd_start_stop_device(struct scsi_disk *sdkp, int start)
> res = scsi_execute_req_flags(sdp, cmd, DMA_NONE, NULL, 0, &sshdr,
> SD_TIMEOUT, SD_MAX_RETRIES, NULL, REQ_PM);
> if (res) {
> - sd_printk(KERN_WARNING, sdkp, "START_STOP FAILED\n");
> - sd_print_result(sdkp, res);
> + sd_print_result(sdkp, "START_STOP failed", res);
> if (driver_byte(res) & DRIVER_SENSE)
> sd_print_sense_hdr(sdkp, &sshdr);
> if (scsi_sense_valid(&sshdr) &&
> @@ -3326,9 +3327,20 @@ static void sd_print_sense_hdr(struct scsi_disk *sdkp,
> sshdr->asc, sshdr->ascq);
> }
>
> -static void sd_print_result(struct scsi_disk *sdkp, int result)
> +static void sd_print_result(struct scsi_disk *sdkp, const char *msg,
> + int result)
> {
> - sd_printk(KERN_INFO, sdkp, " ");
> - scsi_show_result(result);
> + const char *hb_string = scsi_show_hostbyte(result);
> + const char *db_string = scsi_show_driverbyte(result);
> +
> + if (hb_string || db_string)
> + sd_printk(KERN_INFO, sdkp,
> + "%s: Result: hostbyte=%s driverbyte=%s\n", msg,
> + hb_string ? hb_string : "invalid",
> + db_string ? db_string : "invalid");
> + else
> + sd_printk(KERN_INFO, sdkp,
> + "%s: Result: hostbyte=0x%02x driverbyte=0x%02x\n",
> + msg, host_byte(result), driver_byte(result));
> }
>
> diff --git a/include/scsi/scsi_dbg.h b/include/scsi/scsi_dbg.h
> index a3170a5..b4770f0 100644
> --- a/include/scsi/scsi_dbg.h
> +++ b/include/scsi/scsi_dbg.h
> @@ -17,7 +17,6 @@ extern void scsi_print_sense(struct scsi_cmnd *);
> extern void __scsi_print_sense(struct scsi_device *, const char *name,
> const unsigned char *sense_buffer,
> int sense_len);
> -extern void scsi_show_result(int);
> extern void scsi_print_result(struct scsi_cmnd *);
> extern const char *scsi_show_hostbyte(int);
> extern const char *scsi_show_driverbyte(int);
>
--
Yoshihiro YUNOMAE
Software Platform Research Dept. Linux Technology Center
Hitachi, Ltd., Yokohama Research Laboratory
E-mail: yoshihiro.yunomae.ez@hitachi.com
next prev parent reply other threads:[~2014-09-05 4:22 UTC|newest]
Thread overview: 49+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-03 10:05 [PATCHv2 00/20] scsi logging update Hannes Reinecke
2014-09-03 10:05 ` [PATCH 01/20] Remove scsi_cmd_print_sense_hdr() Hannes Reinecke
2014-09-03 10:05 ` [PATCH 02/20] aha152x: Debug output update and whitespace cleanup Hannes Reinecke
2014-09-06 0:02 ` Christoph Hellwig
2014-09-03 10:05 ` [PATCH 03/20] sd: Remove scsi_print_sense() in sd_done() Hannes Reinecke
2014-09-03 10:05 ` [PATCH 04/20] scsi: introduce sdev_prefix_printk() Hannes Reinecke
2014-09-06 0:03 ` Christoph Hellwig
2014-09-03 10:06 ` [PATCH 05/20] scsi: Use sdev as argument for sense code printing Hannes Reinecke
2014-09-03 10:06 ` [PATCH 06/20] scsi: stop decoding if scsi_normalize_sense() fails Hannes Reinecke
2014-09-06 0:04 ` Christoph Hellwig
2014-09-03 10:06 ` [PATCH 07/20] scsi: do not decode sense extras Hannes Reinecke
2014-09-06 0:04 ` Christoph Hellwig
2014-09-03 10:06 ` [PATCH 08/20] scsi: use 'bool' as return value for scsi_normalize_sense() Hannes Reinecke
2014-09-05 0:51 ` Yoshihiro YUNOMAE
2014-09-05 6:07 ` Hannes Reinecke
2014-09-06 0:09 ` Christoph Hellwig
2014-09-03 10:06 ` [PATCH 09/20] scsi: remove scsi_print_status() Hannes Reinecke
2014-09-06 0:10 ` Christoph Hellwig
2014-09-03 10:06 ` [PATCH 10/20] Implement scsi_opcode_sa_name Hannes Reinecke
2014-09-03 10:06 ` [PATCH 11/20] scsi: Use scsi_print_command() where possible Hannes Reinecke
2014-09-06 0:11 ` Christoph Hellwig
2014-09-03 10:06 ` [PATCH 12/20] scsi: merge print_opcode_name() Hannes Reinecke
2014-09-05 1:24 ` Yoshihiro YUNOMAE
2014-09-06 0:12 ` Christoph Hellwig
2014-09-03 10:06 ` [PATCH 13/20] scsi: consolidate opcode lookup in scsi_opcode_sa_name() Hannes Reinecke
2014-09-06 0:46 ` Christoph Hellwig
2014-09-03 10:06 ` [PATCH 14/20] scsi: use local buffer for printing CDB Hannes Reinecke
2014-09-05 2:02 ` Yoshihiro YUNOMAE
2014-09-07 16:10 ` Christoph Hellwig
2014-09-03 10:06 ` [PATCH 15/20] libata: use __scsi_print_command() Hannes Reinecke
2014-09-03 10:06 ` [PATCH 16/20] scsi: separate out scsi_retval_string() Hannes Reinecke
2014-09-05 2:04 ` Yoshihiro YUNOMAE
2014-09-05 6:14 ` Hannes Reinecke
2014-09-07 16:11 ` Christoph Hellwig
2014-09-03 10:06 ` [PATCH 17/20] scsi: separate out scsi_host_hostbyte() and scsi_show_driverbyte() Hannes Reinecke
2014-09-05 4:19 ` Yoshihiro YUNOMAE
2014-09-07 16:12 ` Christoph Hellwig
2014-09-03 10:06 ` [PATCH 18/20] scsi: remove scsi_show_result() Hannes Reinecke
2014-09-05 4:22 ` Yoshihiro YUNOMAE [this message]
2014-09-07 16:17 ` Christoph Hellwig
2014-09-03 10:06 ` [PATCH 19/20] sd: Reduce logging output Hannes Reinecke
2014-09-07 16:17 ` Christoph Hellwig
2014-09-03 10:06 ` [PATCH 20/20] scsi_error: format abort error message Hannes Reinecke
2014-09-05 4:23 ` Yoshihiro YUNOMAE
2014-09-06 0:33 ` Christoph Hellwig
2014-09-13 1:07 ` Elliott, Robert (Server Storage)
2014-09-14 10:49 ` Hannes Reinecke
2014-09-14 16:40 ` Christoph Hellwig
2014-09-06 0:51 ` [PATCHv2 00/20] scsi logging update Christoph Hellwig
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=54093A75.6050207@hitachi.com \
--to=yoshihiro.yunomae.ez@hitachi.com \
--cc=emilne@redhat.com \
--cc=hare@suse.de \
--cc=hch@infradead.org \
--cc=jbottomley@parallels.com \
--cc=linux-scsi@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox