Re: [PATCH v4 08/23] ata: libata-core: Do not register PM operations for SAS ports

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 20/09/2023 14:54, Damien Le Moal wrote:
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@xxxxxxxxxxxxxxx
Signed-off-by: Damien Le Moal <dlemoal@xxxxxxxxxx>
Reviewed-by: Hannes Reinecke <hare@xxxxxxx>
Tested-by: Chia-Lin Kao (AceLan) <acelan.kao@xxxxxxxxxxxxx>
---
  drivers/ata/libata-core.c      | 2 +-
  drivers/ata/libata-transport.c | 9 ++++++++-
  drivers/ata/libata.h           | 2 ++
  3 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index 092372334e92..261445c1851b 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -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
diff --git a/drivers/ata/libata-transport.c b/drivers/ata/libata-transport.c
index e4fb9d1b9b39..3e49a877500e 100644
--- a/drivers/ata/libata-transport.c
+++ b/drivers/ata/libata-transport.c
@@ -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,

It seems less than ideal to give different device types the same name.

However, from the definition of device_type.name, it seems to be used for uevent, so I suppose best to keep the same at this stage.

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


+};
+
  /** 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);
diff --git a/drivers/ata/libata.h b/drivers/ata/libata.h
index a5ee06f0234a..c57e094c3af9 100644
--- a/drivers/ata/libata.h
+++ b/drivers/ata/libata.h
@@ -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;




[Index of Archives]     [Linux Filesystems]     [Linux SCSI]     [Linux RAID]     [Git]     [Kernel Newbies]     [Linux Newbie]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Samba]     [Device Mapper]

  Powered by Linux