ide: Add ide_get_paired_drive() helper
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>
Thu, 18 Oct 2007 22:30:05 +0000 (00:30 +0200)
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Thu, 18 Oct 2007 22:30:05 +0000 (00:30 +0200)
This adds a helper to get to the "other" drive on a pair connected
to a given hwif.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Andrew Morton <akpm@osdl.org>
Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
include/linux/ide.h

index e39ee2fa260720a48236815c9ba6de334339de84..69dbe7dc04beacde71a716f6624910e8c8f7e312 100644 (file)
@@ -1454,4 +1454,11 @@ static inline int hwif_to_node(ide_hwif_t *hwif)
        return dev ? pcibus_to_node(dev->bus) : -1;
 }
 
+static inline ide_drive_t *ide_get_paired_drive(ide_drive_t *drive)
+{
+       ide_hwif_t *hwif        = HWIF(drive);
+
+       return &hwif->drives[(drive->dn ^ 1) & 1];
+}
+
 #endif /* _IDE_H */