Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ata: libata-core: Do not register PM operations for SAS ports

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>

+11 -2
+1 -1
drivers/ata/libata-core.c
··· 5335 5335 #endif 5336 5336 5337 5337 const struct device_type ata_port_type = { 5338 - .name = "ata_port", 5338 + .name = ATA_PORT_TYPE_NAME, 5339 5339 #ifdef CONFIG_PM 5340 5340 .pm = &ata_port_pm_ops, 5341 5341 #endif
+8 -1
drivers/ata/libata-transport.c
··· 266 266 put_device(dev); 267 267 } 268 268 269 + static const struct device_type ata_port_sas_type = { 270 + .name = ATA_PORT_TYPE_NAME, 271 + }; 272 + 269 273 /** ata_tport_add - initialize a transport ATA port structure 270 274 * 271 275 * @parent: parent device ··· 287 283 struct device *dev = &ap->tdev; 288 284 289 285 device_initialize(dev); 290 - dev->type = &ata_port_type; 286 + if (ap->flags & ATA_FLAG_SAS_HOST) 287 + dev->type = &ata_port_sas_type; 288 + else 289 + dev->type = &ata_port_type; 291 290 292 291 dev->parent = parent; 293 292 ata_host_get(ap->host);
+2
drivers/ata/libata.h
··· 30 30 ATA_DNXFER_QUIET = (1 << 31), 31 31 }; 32 32 33 + #define ATA_PORT_TYPE_NAME "ata_port" 34 + 33 35 extern atomic_t ata_print_id; 34 36 extern int atapi_passthru16; 35 37 extern int libata_fua;