diff options
Diffstat (limited to 'include/linux/libata.h')
-rw-r--r-- | include/linux/libata.h | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/include/linux/libata.h b/include/linux/libata.h index ca4493125fa0..62fa8cf677a1 100644 --- a/include/linux/libata.h +++ b/include/linux/libata.h | |||
@@ -1030,15 +1030,26 @@ static inline unsigned int ata_dev_absent(const struct ata_device *dev) | |||
1030 | } | 1030 | } |
1031 | 1031 | ||
1032 | /* | 1032 | /* |
1033 | * port helpers | 1033 | * link helpers |
1034 | */ | 1034 | */ |
1035 | static inline int ata_port_max_devices(const struct ata_port *ap) | 1035 | static inline int ata_link_max_devices(const struct ata_link *link) |
1036 | { | 1036 | { |
1037 | if (ap->flags & ATA_FLAG_SLAVE_POSS) | 1037 | if (link->ap->flags & ATA_FLAG_SLAVE_POSS) |
1038 | return 2; | 1038 | return 2; |
1039 | return 1; | 1039 | return 1; |
1040 | } | 1040 | } |
1041 | 1041 | ||
1042 | #define ata_port_for_each_link(lk, ap) \ | ||
1043 | for ((lk) = &(ap)->link; (lk); (lk) = NULL) | ||
1044 | |||
1045 | #define ata_link_for_each_dev(dev, link) \ | ||
1046 | for ((dev) = (link)->device; \ | ||
1047 | (dev) < (link)->device + ata_link_max_devices(link) || ((dev) = NULL); \ | ||
1048 | (dev)++) | ||
1049 | |||
1050 | #define ata_link_for_each_dev_reverse(dev, link) \ | ||
1051 | for ((dev) = (link)->device + ata_link_max_devices(link) - 1; \ | ||
1052 | (dev) >= (link)->device || ((dev) = NULL); (dev)--) | ||
1042 | 1053 | ||
1043 | static inline u8 ata_chk_status(struct ata_port *ap) | 1054 | static inline u8 ata_chk_status(struct ata_port *ap) |
1044 | { | 1055 | { |