]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
ata,scsi: Remove wrapper ata_sas_port_alloc()
authorNiklas Cassel <cassel@kernel.org>
Wed, 3 Jul 2024 18:44:25 +0000 (20:44 +0200)
committerNiklas Cassel <cassel@kernel.org>
Thu, 4 Jul 2024 09:52:32 +0000 (11:52 +0200)
The ata_sas_port_alloc() wrapper mainly exists in order to export the
internal libata function which it wraps. The secondary reason is that
it initializes some ata_port struct members.

However, ata_sas_port_alloc() is only used in a single location,
sas_ata_init(), which already performs some ata_port struct member
initialization, so it does not make sense to spread this initialization
out over two separate locations.

Thus, remove the wrapper and instead export the libata function directly,
and move the libsas specific ata_port initialization to sas_ata_init(),
which already does some ata_port initialization.

Reviewed-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: John Garry <john.g.garry@oracle.com>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
Link: https://lore.kernel.org/r/20240703184418.723066-19-cassel@kernel.org
Signed-off-by: Niklas Cassel <cassel@kernel.org>
drivers/ata/libata-core.c
drivers/ata/libata-sata.c
drivers/ata/libata.h
drivers/scsi/libsas/sas_ata.c
include/linux/libata.h

index 02c3b8a22417e727c1ed979b9a2b2fa34f0c68a2..c7752dc800280ed6102e0a5bce29b74c68ca9a92 100644 (file)
@@ -5501,6 +5501,7 @@ struct ata_port *ata_port_alloc(struct ata_host *host)
 
        return ap;
 }
+EXPORT_SYMBOL_GPL(ata_port_alloc);
 
 void ata_port_free(struct ata_port *ap)
 {
index b602247604dc56739b5b8d39e21377e82892bdcc..48660d44560250feb2b9aa5e7c1f57f63264994b 100644 (file)
@@ -1204,41 +1204,6 @@ int ata_scsi_change_queue_depth(struct scsi_device *sdev, int queue_depth)
 }
 EXPORT_SYMBOL_GPL(ata_scsi_change_queue_depth);
 
-/**
- *     ata_sas_port_alloc - Allocate port for a SAS attached SATA device
- *     @host: ATA host container for all SAS ports
- *     @port_info: Information from low-level host driver
- *     @shost: SCSI host that the scsi device is attached to
- *
- *     LOCKING:
- *     PCI/etc. bus probe sem.
- *
- *     RETURNS:
- *     ata_port pointer on success / NULL on failure.
- */
-
-struct ata_port *ata_sas_port_alloc(struct ata_host *host,
-                                   struct ata_port_info *port_info,
-                                   struct Scsi_Host *shost)
-{
-       struct ata_port *ap;
-
-       ap = ata_port_alloc(host);
-       if (!ap)
-               return NULL;
-
-       ap->port_no = 0;
-       ap->pio_mask = port_info->pio_mask;
-       ap->mwdma_mask = port_info->mwdma_mask;
-       ap->udma_mask = port_info->udma_mask;
-       ap->flags |= port_info->flags;
-       ap->ops = port_info->port_ops;
-       ap->cbl = ATA_CBL_SATA;
-
-       return ap;
-}
-EXPORT_SYMBOL_GPL(ata_sas_port_alloc);
-
 /**
  *     ata_sas_device_configure - Default device_configure routine for libata
  *                                devices
index 5ea194ae8a8b51a953fef406ccf7954111389453..6abf265f626efe0d3d84b818e341e5b9aca8b488 100644 (file)
@@ -81,7 +81,6 @@ extern void ata_link_init(struct ata_port *ap, struct ata_link *link, int pmp);
 extern int sata_link_init_spd(struct ata_link *link);
 extern int ata_task_ioctl(struct scsi_device *scsidev, void __user *arg);
 extern int ata_cmd_ioctl(struct scsi_device *scsidev, void __user *arg);
-extern struct ata_port *ata_port_alloc(struct ata_host *host);
 extern const char *sata_spd_string(unsigned int spd);
 extern unsigned int ata_read_log_page(struct ata_device *dev, u8 log,
                                      u8 page, void *buf, unsigned int sectors);
index ab4ddeea4909b1fe893b8f447ee5376760a18d6e..88714b7b0dbad1ecf1b038eb57b599af408b4b81 100644 (file)
@@ -572,15 +572,6 @@ static struct ata_port_operations sas_sata_ops = {
        .end_eh                 = sas_ata_end_eh,
 };
 
-static struct ata_port_info sata_port_info = {
-       .flags = ATA_FLAG_SATA | ATA_FLAG_PIO_DMA | ATA_FLAG_NCQ |
-                ATA_FLAG_SAS_HOST | ATA_FLAG_FPDMA_AUX,
-       .pio_mask = ATA_PIO4,
-       .mwdma_mask = ATA_MWDMA2,
-       .udma_mask = ATA_UDMA6,
-       .port_ops = &sas_sata_ops
-};
-
 int sas_ata_init(struct domain_device *found_dev)
 {
        struct sas_ha_struct *ha = found_dev->port->ha;
@@ -597,13 +588,20 @@ int sas_ata_init(struct domain_device *found_dev)
 
        ata_host_init(ata_host, ha->dev, &sas_sata_ops);
 
-       ap = ata_sas_port_alloc(ata_host, &sata_port_info, shost);
+       ap = ata_port_alloc(ata_host);
        if (!ap) {
-               pr_err("ata_sas_port_alloc failed.\n");
+               pr_err("ata_port_alloc failed.\n");
                rc = -ENODEV;
                goto free_host;
        }
 
+       ap->port_no = 0;
+       ap->pio_mask = ATA_PIO4;
+       ap->mwdma_mask = ATA_MWDMA2;
+       ap->udma_mask = ATA_UDMA6;
+       ap->flags |= ATA_FLAG_SATA | ATA_FLAG_PIO_DMA | ATA_FLAG_NCQ |
+                    ATA_FLAG_SAS_HOST | ATA_FLAG_FPDMA_AUX;
+       ap->ops = &sas_sata_ops;
        ap->private_data = found_dev;
        ap->cbl = ATA_CBL_SATA;
        ap->scsi_host = shost;
index 84a7bfbac9fa7b27dd986b5e349c3737a7dfa4b9..17394098bee9f194b379dcdf597d79d2ea601835 100644 (file)
@@ -1244,9 +1244,8 @@ extern int sata_link_debounce(struct ata_link *link,
 extern int sata_link_scr_lpm(struct ata_link *link, enum ata_lpm_policy policy,
                             bool spm_wakeup);
 extern int ata_slave_link_init(struct ata_port *ap);
-extern struct ata_port *ata_sas_port_alloc(struct ata_host *,
-                                          struct ata_port_info *, struct Scsi_Host *);
 extern void ata_port_probe(struct ata_port *ap);
+extern struct ata_port *ata_port_alloc(struct ata_host *host);
 extern void ata_port_free(struct ata_port *ap);
 extern int ata_tport_add(struct device *parent, struct ata_port *ap);
 extern void ata_tport_delete(struct ata_port *ap);