]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
ata: libata-core: Do not register PM operations for SAS ports
authorDamien Le Moal <dlemoal@kernel.org>
Fri, 8 Sep 2023 11:04:52 +0000 (20:04 +0900)
committerDamien Le Moal <dlemoal@kernel.org>
Thu, 28 Sep 2023 12:23:14 +0000 (21:23 +0900)
libsas does its own domain based power management of ports. For such
ports, libata should not use a device type defining power management
operations as executing these operations for suspend/resume in addition
to libsas calls to ata_sas_port_suspend() and ata_sas_port_resume() is
not necessary (and likely dangerous to do, even though problems are not
seen currently).

Introduce the new ata_port_sas_type device_type for ports managed by
libsas. This new device type is used in ata_tport_add() and is defined
without power management operations.

Fixes: 2fcbdcb4c802 ("[SCSI] libata: export ata_port suspend/resume infrastructure for sas")
Cc: stable@vger.kernel.org
Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Tested-by: Chia-Lin Kao (AceLan) <acelan.kao@canonical.com>
Tested-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: John Garry <john.g.garry@oracle.com>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/ata/libata-core.c
drivers/ata/libata-transport.c
drivers/ata/libata.h

index 092372334e9253d4cd1bf88d734f860ee917ee0c..261445c1851bde6d775dd73e87c8e33ebcf0ff8a 100644 (file)
@@ -5335,7 +5335,7 @@ EXPORT_SYMBOL_GPL(ata_host_resume);
 #endif
 
 const struct device_type ata_port_type = {
-       .name = "ata_port",
+       .name = ATA_PORT_TYPE_NAME,
 #ifdef CONFIG_PM
        .pm = &ata_port_pm_ops,
 #endif
index e4fb9d1b9b39803a624ce8bf0185193a84d61d00..3e49a877500e124ec36fedb95ae122ca793afec6 100644 (file)
@@ -266,6 +266,10 @@ void ata_tport_delete(struct ata_port *ap)
        put_device(dev);
 }
 
+static const struct device_type ata_port_sas_type = {
+       .name = ATA_PORT_TYPE_NAME,
+};
+
 /** ata_tport_add - initialize a transport ATA port structure
  *
  * @parent:    parent device
@@ -283,7 +287,10 @@ int ata_tport_add(struct device *parent,
        struct device *dev = &ap->tdev;
 
        device_initialize(dev);
-       dev->type = &ata_port_type;
+       if (ap->flags & ATA_FLAG_SAS_HOST)
+               dev->type = &ata_port_sas_type;
+       else
+               dev->type = &ata_port_type;
 
        dev->parent = parent;
        ata_host_get(ap->host);
index 820299bd9d063871181ff0437dec549b0b0da881..05ac80da8ebc7d11153310ac892c25258c03993a 100644 (file)
@@ -30,6 +30,8 @@ enum {
        ATA_DNXFER_QUIET        = (1 << 31),
 };
 
+#define ATA_PORT_TYPE_NAME     "ata_port"
+
 extern atomic_t ata_print_id;
 extern int atapi_passthru16;
 extern int libata_fua;