linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Ewan D. Milne" <emilne@redhat.com>
To: Hannes Reinecke <hare@suse.de>
Cc: linux-scsi@vger.kernel.org, Hannes Reinecke <hare@suse.com>
Subject: Re: [PATCH 3/3] scsi: consolidate checking for VPD pages
Date: Mon, 20 Jun 2016 09:26:10 -0400	[thread overview]
Message-ID: <1466429170.4039.16.camel@localhost.localdomain> (raw)
In-Reply-To: <1466405868-87720-4-git-send-email-hare@suse.de>

On Mon, 2016-06-20 at 08:57 +0200, Hannes Reinecke wrote:
> scsi_get_vpd_page() has a check for 'skip_vpd_pages'. However,
> this is not sufficient to test if the device really supports
> VPD pages. At the same time, most sites were already calling
> scsi_device_supports_vpd() prior to calling this function.
> So this patchs updates all callers to use scsi_device_supports_vpd()
> prior to calling scsi_get_vpd_page() and remove the check
> to skip_vpd_pages.
> 
> Signed-off-by: Hannes Reinecke <hare@suse.com>
> ---
>  drivers/scsi/scsi.c               | 5 ++---
>  drivers/scsi/scsi_transport_sas.c | 3 ++-
>  2 files changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c
> index 1ff4a0b..f054878 100644
> --- a/drivers/scsi/scsi.c
> +++ b/drivers/scsi/scsi.c
> @@ -727,15 +727,14 @@ static int scsi_vpd_inquiry(struct scsi_device *sdev, unsigned char *buffer,
>   * to a buffer containing the data from that page.  The caller is
>   * responsible for calling kfree() on this pointer when it is no longer
>   * needed.  If we cannot retrieve the VPD page this routine returns %NULL.
> + * The caller is responsible for checking if the device supports VPD
> + * pages prior to calling this function.
>   */
>  int scsi_get_vpd_page(struct scsi_device *sdev, u8 page, unsigned char *buf,
>  		      int buf_len)
>  {
>  	int i, result;
>  
> -	if (sdev->skip_vpd_pages)
> -		goto fail;
> -
>  	/* Ask for all the pages supported by this device */
>  	result = scsi_vpd_inquiry(sdev, buf, 0, buf_len);
>  	if (result < 4)
> diff --git a/drivers/scsi/scsi_transport_sas.c b/drivers/scsi/scsi_transport_sas.c
> index 3f0ff07..b2616eb 100644
> --- a/drivers/scsi/scsi_transport_sas.c
> +++ b/drivers/scsi/scsi_transport_sas.c
> @@ -412,7 +412,8 @@ sas_tlr_supported(struct scsi_device *sdev)
>  	char *buffer = kzalloc(vpd_len, GFP_KERNEL);
>  	int ret = 0;
>  
> -	if (scsi_get_vpd_page(sdev, 0x90, buffer, vpd_len))
> +	if (!scsi_device_supports_vpd(sdev) ||
> +	    scsi_get_vpd_page(sdev, 0x90, buffer, vpd_len))
>  		goto out;
>  
>  	/*

Reviewed-by: Ewan D. Milne <emilne@redhat.com>



  reply	other threads:[~2016-06-20 13:26 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-20  6:57 [PATCH 0/3] VPD page check consolidation Hannes Reinecke
2016-06-20  6:57 ` [PATCH 1/3] scsi: Move 'scsi_attach_vpd()' prototype to scsi_priv.h Hannes Reinecke
2016-06-20 13:24   ` Ewan D. Milne
2016-06-22 13:22   ` Christoph Hellwig
2016-06-20  6:57 ` [PATCH 2/3] scsi: disable VPD page check on error Hannes Reinecke
2016-06-20 13:25   ` Ewan D. Milne
2016-06-20 13:44     ` James Bottomley
2016-06-20 15:03       ` Ewan D. Milne
2016-06-22  2:54       ` Martin K. Petersen
2016-06-22 13:23   ` Christoph Hellwig
2016-06-20  6:57 ` [PATCH 3/3] scsi: consolidate checking for VPD pages Hannes Reinecke
2016-06-20 13:26   ` Ewan D. Milne [this message]
2016-06-22 13:24   ` 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=1466429170.4039.16.camel@localhost.localdomain \
    --to=emilne@redhat.com \
    --cc=hare@suse.com \
    --cc=hare@suse.de \
    --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;
as well as URLs for NNTP newsgroup(s).