From: Benjamin Herrenschmidt Date: Thu, 18 Oct 2007 22:30:05 +0000 (+0200) Subject: ide: Add ide_get_paired_drive() helper X-Git-Tag: firefly_0821_release~24903^2~36 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=1b678347121001c3c230c6eccfdf9f65c3ec1a4e;p=firefly-linux-kernel-4.4.55.git ide: Add ide_get_paired_drive() helper This adds a helper to get to the "other" drive on a pair connected to a given hwif. Signed-off-by: Benjamin Herrenschmidt Cc: Andrew Morton Acked-by: Sergei Shtylyov Signed-off-by: Bartlomiej Zolnierkiewicz --- diff --git a/include/linux/ide.h b/include/linux/ide.h index e39ee2fa2607..69dbe7dc04be 100644 --- a/include/linux/ide.h +++ b/include/linux/ide.h @@ -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 */