]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
ide: Add ide_get_paired_drive() helper
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>
Thu, 18 Oct 2007 22:30:05 +0000 (00:30 +0200)
committerGreg Kroah-Hartman <gregkh@suse.de>
Fri, 16 Nov 2007 17:30:23 +0000 (09:30 -0800)
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>
include/linux/ide.h

index b9f66c10caa04b26a413fb450ce8237d91c74e5a..20528c0b60442883c0871ddf7bcb5b5cf84764dc 100644 (file)
@@ -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 */