Linux SCSI subsystem development
 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 v2 2/5] scsi: libsas: change the coding style of sas_discover_sata()
Date: Tue, 13 Dec 2022 16:08:53 +0000	[thread overview]
Message-ID: <b2b4b24c-7c92-db27-6d4e-9ec8a2438369@oracle.com> (raw)
In-Reply-To: <20221213150942.988371-3-yanaijie@huawei.com>

On 13/12/2022 15:09, Jason Yan wrote:
> The coding style where calling this interface is inconsistent with other
> interfaces for sata devices. The standard style for other sata interfaces

nit: capitalize acronyms, so /s/sata/SATA/

> is like:
> 
>      #ifdefine CONFIG_SCSI_SAS_ATA
>      void sas_ata_task_abort(struct sas_task *task);
>      #else
>      static inline void sas_ata_task_abort(struct sas_task *task)
>      {
>      }
>      #endif
> 
> And the callers does not have to do things like "#ifdefine CONFIG_SCSI_SAS_ATA"
> and may call the interface directly. So follow the standard style here.
> 
> Cc: John Garry <john.g.garry@oracle.com>
> Signed-off-by: Jason Yan <yanaijie@huawei.com>

Reviewed-by: John Garry <john.g.garry@oracle.com>

> ---
>   drivers/scsi/libsas/sas_discover.c | 6 ------
>   include/scsi/libsas.h              | 1 -
>   include/scsi/sas_ata.h             | 6 ++++++
>   3 files changed, 6 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/scsi/libsas/sas_discover.c b/drivers/scsi/libsas/sas_discover.c
> index d5bc1314c341..72fdb2e5d047 100644
> --- a/drivers/scsi/libsas/sas_discover.c
> +++ b/drivers/scsi/libsas/sas_discover.c
> @@ -455,14 +455,8 @@ static void sas_discover_domain(struct work_struct *work)
>   		break;
>   	case SAS_SATA_DEV:
>   	case SAS_SATA_PM:
> -#ifdef CONFIG_SCSI_SAS_ATA
>   		error = sas_discover_sata(dev);
>   		break;
> -#else
> -		pr_notice("ATA device seen but CONFIG_SCSI_SAS_ATA=N so cannot attach\n");
> -		fallthrough;
> -#endif
> -		/* Fall through - only for the #else condition above. */
>   	default:
>   		error = -ENXIO;
>   		pr_err("unhandled device %d\n", dev->dev_type);
> diff --git a/include/scsi/libsas.h b/include/scsi/libsas.h
> index 1aee3d0ebbb2..159823e0afbf 100644
> --- a/include/scsi/libsas.h
> +++ b/include/scsi/libsas.h
> @@ -735,7 +735,6 @@ void sas_unregister_domain_devices(struct asd_sas_port *port, int gone);
>   void sas_init_disc(struct sas_discovery *disc, struct asd_sas_port *);
>   void sas_discover_event(struct asd_sas_port *, enum discover_event ev);
>   
> -int  sas_discover_sata(struct domain_device *);
>   int  sas_discover_end_dev(struct domain_device *);
>   
>   void sas_unregister_dev(struct asd_sas_port *port, struct domain_device *);
> diff --git a/include/scsi/sas_ata.h b/include/scsi/sas_ata.h
> index 9c927d46f136..2fd15f194316 100644
> --- a/include/scsi/sas_ata.h
> +++ b/include/scsi/sas_ata.h
> @@ -36,6 +36,7 @@ void sas_ata_device_link_abort(struct domain_device *dev, bool force_reset);
>   int sas_execute_ata_cmd(struct domain_device *device, u8 *fis,
>   			int force_phy_id);
>   int smp_ata_check_ready_type(struct ata_link *link);
> +int sas_discover_sata(struct domain_device *dev);
>   #else
>   
>   
> @@ -103,6 +104,11 @@ static inline int smp_ata_check_ready_type(struct ata_link *link)
>   {
>   	return 0;
>   }

nit: is there a blank line missing?

> +static inline int sas_discover_sata(struct domain_device *dev)
> +{
> +	pr_notice("ATA device seen but CONFIG_SCSI_SAS_ATA=N so cannot attach\n");
> +	return -ENXIO;
> +}
>   #endif
>   
>   #endif /* _SAS_ATA_H_ */


  reply	other threads:[~2022-12-13 16:09 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-13 15:09 [PATCH v2 0/5] scsi: libsas: Some coding style fixes and cleanups Jason Yan
2022-12-13 15:09 ` [PATCH v2 1/5] scsi: libsas: move sas_get_ata_command_set() up to save the declaration Jason Yan
2022-12-13 16:00   ` John Garry
2022-12-13 15:09 ` [PATCH v2 2/5] scsi: libsas: change the coding style of sas_discover_sata() Jason Yan
2022-12-13 16:08   ` John Garry [this message]
2022-12-13 15:09 ` [PATCH v2 3/5] scsi: libsas: remove useless dev_list delete in sas_ex_discover_end_dev() Jason Yan
2022-12-13 16:13   ` John Garry
2022-12-13 15:09 ` [PATCH v2 4/5] scsi: libsas: factor out sas_ata_add_dev() Jason Yan
2022-12-13 16:22   ` John Garry
2022-12-14  2:46     ` Jason Yan
2022-12-13 15:09 ` [PATCH v2 5/5] scsi: libsas: factor out sas_ex_add_dev() Jason Yan
2022-12-13 16:24   ` John Garry
2022-12-13 16:12 ` [PATCH v2 0/5] scsi: libsas: Some coding style fixes and cleanups John Garry
2022-12-14  2:54   ` 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=b2b4b24c-7c92-db27-6d4e-9ec8a2438369@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