public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: John Garry <john.g.garry@oracle.com>
To: Jason Yan <yanaijie@huawei.com>,
	martin.petersen@oracle.com, jejb@linux.ibm.com
Cc: linux-scsi@vger.kernel.org, hare@suse.com, hch@lst.de,
	bvanassche@acm.org, jinpu.wang@cloud.ionos.com,
	damien.lemoal@opensource.wdc.com
Subject: Re: [PATCH 1/6] scsi: libsas: move sas_get_ata_command_set() up to save the declaration
Date: Mon, 5 Dec 2022 08:45:19 +0000	[thread overview]
Message-ID: <37743f09-8d30-a41b-10c1-caf34f919f3e@oracle.com> (raw)
In-Reply-To: <20221204081643.3835966-2-yanaijie@huawei.com>

On 04/12/2022 08:16, Jason Yan wrote:
> There is a sas_get_ata_command_set() declaration above sas_get_ata_info()
> to make it compile ok. However this function is defined in the same file
> below. So move it up to save the declaration.
> 
> Cc: John Garry <john.g.garry@oracle.com>
> Signed-off-by: Jason Yan <yanaijie@huawei.com>

Apart from comments, below:
Reviewed-by: John Garry <john.g.garry@oracle.com>

> ---
>   drivers/scsi/libsas/sas_ata.c | 28 +++++++++++++---------------
>   1 file changed, 13 insertions(+), 15 deletions(-)
> 
> diff --git a/drivers/scsi/libsas/sas_ata.c b/drivers/scsi/libsas/sas_ata.c
> index f7439bf9cdc6..34009c330eb2 100644
> --- a/drivers/scsi/libsas/sas_ata.c
> +++ b/drivers/scsi/libsas/sas_ata.c
> @@ -239,7 +239,19 @@ static struct sas_internal *dev_to_sas_internal(struct domain_device *dev)
>   	return to_sas_internal(dev->port->ha->core.shost->transportt);
>   }
>   
> -static int sas_get_ata_command_set(struct domain_device *dev);
> +static int sas_get_ata_command_set(struct domain_device *dev)
> +{
> +	struct dev_to_host_fis *fis =
> +		(struct dev_to_host_fis *) dev->frame_rcvd;

nit: I did not think that we add a whitespace before casting. And I 
think that it would be neater if fis was assigned separately, avoiding 
overflowing the line in this way.

Having said that, it does seem odd to cast from u8 [] to struct 
dev_to_host_fis * and then back to (u8 *) in the ata_tf_from_fis() call, 
below.


> +	struct ata_taskfile tf;
> +
> +	if (dev->dev_type == SAS_SATA_PENDING)
> +		return ATA_DEV_UNKNOWN;
> +
> +	ata_tf_from_fis((const u8 *)fis, &tf);
> +
> +	return ata_dev_classify(&tf);
> +}
>   
>   int sas_get_ata_info(struct domain_device *dev, struct ex_phy *phy)
>   {
> @@ -637,20 +649,6 @@ void sas_ata_task_abort(struct sas_task *task)
>   	complete(waiting);
>   }
>   
> -static int sas_get_ata_command_set(struct domain_device *dev)
> -{
> -	struct dev_to_host_fis *fis =
> -		(struct dev_to_host_fis *) dev->frame_rcvd;
> -	struct ata_taskfile tf;
> -
> -	if (dev->dev_type == SAS_SATA_PENDING)
> -		return ATA_DEV_UNKNOWN;
> -
> -	ata_tf_from_fis((const u8 *)fis, &tf);
> -
> -	return ata_dev_classify(&tf);
> -}
> -
>   void sas_probe_sata(struct asd_sas_port *port)
>   {
>   	struct domain_device *dev, *n;


  reply	other threads:[~2022-12-05  8:46 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-04  8:16 [PATCH 0/6] scsi: libsas: Some coding style fixes and cleanups Jason Yan
2022-12-04  8:16 ` [PATCH 1/6] scsi: libsas: move sas_get_ata_command_set() up to save the declaration Jason Yan
2022-12-05  8:45   ` John Garry [this message]
2022-12-08  6:36     ` Jason Yan
2022-12-04  8:16 ` [PATCH 2/6] scsi: libsas: delete wrapper function sas_discover_end_dev() Jason Yan
2022-12-05  8:57   ` John Garry
2022-12-08  6:56     ` Jason Yan
2022-12-04  8:16 ` [PATCH 3/6] scsi: libsas: rename sas_discover_sata() and related refactors Jason Yan
2022-12-04  8:16 ` [PATCH 4/6] scsi: libsas: remove useless dev_list delete in sas_ex_discover_end_dev() Jason Yan
2022-12-05  9:14   ` John Garry
2022-12-08  7:21     ` Jason Yan
2022-12-08 10:40       ` John Garry
2022-12-08 11:11         ` Jason Yan
2022-12-04  8:16 ` [PATCH 5/6] scsi: libsas: factor out sas_ata_add_dev() Jason Yan
2022-12-05  9:24   ` John Garry
2022-12-08  7:26     ` Jason Yan
2022-12-04  8:16 ` [PATCH 6/6] scsi: libsas: factor out sas_ex_add_dev() Jason Yan
2022-12-05  9:31   ` John Garry
2022-12-08  8:07     ` Jason Yan

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=37743f09-8d30-a41b-10c1-caf34f919f3e@oracle.com \
    --to=john.g.garry@oracle.com \
    --cc=bvanassche@acm.org \
    --cc=damien.lemoal@opensource.wdc.com \
    --cc=hare@suse.com \
    --cc=hch@lst.de \
    --cc=jejb@linux.ibm.com \
    --cc=jinpu.wang@cloud.ionos.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=yanaijie@huawei.com \
    /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