summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>2007-10-19 00:30:05 +0200
committerGreg Kroah-Hartman <gregkh@suse.de>2007-11-16 09:30:23 -0800
commit61c5c64a1d07ffec6e1b511a680bd3c53b1d490a (patch)
treea303e9f300a712722e5d1b6037d036bc93dd3f4d
parentbd9f792ffdfbc6b7457e406a82e1e62c122d9c8a (diff)
ide: Add ide_get_paired_drive() helper
patch 1b678347121001c3c230c6eccfdf9f65c3ec1a4e in mainline. 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> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r--include/linux/ide.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/include/linux/ide.h b/include/linux/ide.h
index b9f66c10caa0..20528c0b6044 100644
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -1437,4 +1437,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 */