ata,scsi: remove ata_sas_port_init()
authorNiklas Cassel <niklas.cassel@wdc.com>
Mon, 31 Jul 2023 14:34:18 +0000 (16:34 +0200)
committerDamien Le Moal <dlemoal@kernel.org>
Wed, 2 Aug 2023 08:45:30 +0000 (17:45 +0900)
ata_sas_port_init() now only contains a single initialization.

Move this single initialization to ata_sas_port_alloc(), since:
1) ata_sas_port_alloc() already initializes some of the struct members.
2) ata_sas_port_alloc() is only used by libsas.

Suggested-by: John Garry <john.g.garry@oracle.com>
Signed-off-by: Niklas Cassel <niklas.cassel@wdc.com>
Reviewed-by: John Garry <john.g.garry@oracle.com>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
drivers/ata/libata-sata.c
drivers/scsi/libsas/sas_ata.c
include/linux/libata.h

index eb81641d383af469e1d2e26ca8e994306d597099..5d31c08be0136cc0ff6baeac1d9f6041be48b5fb 100644 (file)
@@ -1139,29 +1139,12 @@ struct ata_port *ata_sas_port_alloc(struct ata_host *host,
        ap->flags |= port_info->flags;
        ap->ops = port_info->port_ops;
        ap->cbl = ATA_CBL_SATA;
+       ap->print_id = atomic_inc_return(&ata_print_id);
 
        return ap;
 }
 EXPORT_SYMBOL_GPL(ata_sas_port_alloc);
 
-/**
- *     ata_sas_port_init - Initialize a SATA device
- *     @ap: SATA port to initialize
- *
- *     LOCKING:
- *     PCI/etc. bus probe sem.
- *
- *     RETURNS:
- *     Zero on success, non-zero on error.
- */
-
-int ata_sas_port_init(struct ata_port *ap)
-{
-       ap->print_id = atomic_inc_return(&ata_print_id);
-       return 0;
-}
-EXPORT_SYMBOL_GPL(ata_sas_port_init);
-
 int ata_sas_tport_add(struct device *parent, struct ata_port *ap)
 {
        return ata_tport_add(parent, ap);
index d6bb37b3974ad64a6ec05314383d320038c985c9..cd16a1ac379d3186569ed49dd6d5551d4befcd0d 100644 (file)
@@ -605,9 +605,6 @@ int sas_ata_init(struct domain_device *found_dev)
        ap->private_data = found_dev;
        ap->cbl = ATA_CBL_SATA;
        ap->scsi_host = shost;
-       rc = ata_sas_port_init(ap);
-       if (rc)
-               goto destroy_port;
 
        rc = ata_sas_tport_add(ata_host->dev, ap);
        if (rc)
index 7468a330fc775e54fe5cd5a57a36b23e037ace00..0980992c54c21426f02d59f985e1d5a2342edd27 100644 (file)
@@ -1241,7 +1241,6 @@ 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 int ata_sas_port_init(struct ata_port *);
 extern int ata_sas_tport_add(struct device *parent, struct ata_port *ap);
 extern void ata_sas_tport_delete(struct ata_port *ap);
 extern int ata_sas_slave_configure(struct scsi_device *, struct ata_port *);