[PATCH 1/3] ata: Allow having a port recovery callback

From: Florian Fainelli
Date: Tue Jan 09 2018 - 18:05:39 EST


Some AHCI controllers may need to recovery from a failure to identify a drive,
such as the Broadcom AHCI controller, make that possible at both the
libata-core.c and AHCI controller level such that we can provide such an error
recovery callback.

Signed-off-by: Florian Fainelli <f.fainelli@xxxxxxxxx>
---
drivers/ata/libata-core.c | 2 ++
include/linux/libata.h | 1 +
2 files changed, 3 insertions(+)

diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index 3c09122bf038..921c2813af07 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -2045,6 +2045,8 @@ int ata_dev_read_id(struct ata_device *dev, unsigned int *p_class,
if (ata_msg_warn(ap))
ata_dev_warn(dev, "failed to IDENTIFY (%s, err_mask=0x%x)\n",
reason, err_mask);
+ if (ap->host->ops->port_recovery)
+ ap->host->ops->port_recovery(ap);
return rc;
}

diff --git a/include/linux/libata.h b/include/linux/libata.h
index ed9826b21c5e..23646a557ab2 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -956,6 +956,7 @@ struct ata_port_operations {
int (*port_resume)(struct ata_port *ap);
int (*port_start)(struct ata_port *ap);
void (*port_stop)(struct ata_port *ap);
+ void (*port_recovery)(struct ata_port *ap);
void (*host_stop)(struct ata_host *host);

#ifdef CONFIG_ATA_SFF
--
2.7.4