Skip to content

Commit

Permalink
scsi: libsas: Change the coding style of sas_discover_sata()
Browse files Browse the repository at this point in the history
The coding style where calling this interface is inconsistent with other
interfaces for SATA devices. The standard style for other SATA interfaces
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: Jack Wang <jinpu.wang@ionos.com>
Reviewed-by: John Garry <john.g.garry@oracle.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
  • Loading branch information
Jason Yan authored and Martin K. Petersen committed Dec 30, 2022
1 parent 6c90466 commit ffebb38
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
6 changes: 0 additions & 6 deletions drivers/scsi/libsas/sas_discover.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
1 change: 0 additions & 1 deletion include/scsi/libsas.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 *);
Expand Down
11 changes: 11 additions & 0 deletions include/scsi/sas_ata.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,13 @@ 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

static inline void sas_ata_disabled_notice(void)
{
pr_notice_once("ATA device seen but CONFIG_SCSI_SAS_ATA=N\n");
}

static inline int dev_is_sata(struct domain_device *dev)
{
Expand Down Expand Up @@ -103,6 +108,12 @@ static inline int smp_ata_check_ready_type(struct ata_link *link)
{
return 0;
}

static inline int sas_discover_sata(struct domain_device *dev)
{
sas_ata_disabled_notice();
return -ENXIO;
}
#endif

#endif /* _SAS_ATA_H_ */

0 comments on commit ffebb38

Please sign in to comment.