From ebdfca6eb1b755d3bfe9a81339ecdafd92038c1a Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Thu, 23 Mar 2006 15:38:34 +0000 Subject: [PATCH] libata: add ata_dev_pair helper Signed-off-by: Alan Cox Signed-off-by: Jeff Garzik --- drivers/scsi/libata-core.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'drivers/scsi/libata-core.c') diff --git a/drivers/scsi/libata-core.c b/drivers/scsi/libata-core.c index d8f77f2a5af1..909568f7a72a 100644 --- a/drivers/scsi/libata-core.c +++ b/drivers/scsi/libata-core.c @@ -1575,6 +1575,23 @@ void sata_phy_reset(struct ata_port *ap) ata_bus_reset(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. -- cgit v1.2.2