aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--drivers/scsi/libata-core.c17
-rw-r--r--include/linux/libata.h2
2 files changed, 19 insertions, 0 deletions
diff --git a/drivers/scsi/libata-core.c b/drivers/scsi/libata-core.c
index d8f77f2a5af..909568f7a72 100644
--- a/drivers/scsi/libata-core.c
+++ b/drivers/scsi/libata-core.c
@@ -1576,6 +1576,23 @@ void sata_phy_reset(struct ata_port *ap)
}
/**
+ * ata_dev_pair - return other device on cable
+ * @ap: port
+ * @adev: device
+ *
+ * Obtain the other device on the same cable, or if none is
+ * present NULL is returned
+ */
+
+struct ata_device *ata_dev_pair(struct ata_port *ap, struct ata_device *adev)
+{
+ struct ata_device *pair = &ap->device[1 - adev->devno];
+ if (!ata_dev_present(pair))
+ return NULL;
+ return pair;
+}
+
+/**
* ata_port_disable - Disable port.
* @ap: Port to be disabled.
*
diff --git a/include/linux/libata.h b/include/linux/libata.h
index c52f1349855..80c2339da67 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -573,6 +573,8 @@ extern int ata_std_bios_param(struct scsi_device *sdev,
struct block_device *bdev,
sector_t capacity, int geom[]);
extern int ata_scsi_slave_config(struct scsi_device *sdev);
+extern struct ata_device *ata_dev_pair(struct ata_port *ap,
+ struct ata_device *adev);
/*
* Timing helpers