aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/libata.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/libata.h')
-rw-r--r--include/linux/libata.h33
1 files changed, 8 insertions, 25 deletions
diff --git a/include/linux/libata.h b/include/linux/libata.h
index ffd622fa319c..3eaca347ce29 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -1265,34 +1265,17 @@ static inline int ata_link_active(struct ata_link *link)
1265 return ata_tag_valid(link->active_tag) || link->sactive; 1265 return ata_tag_valid(link->active_tag) || link->sactive;
1266} 1266}
1267 1267
1268static inline struct ata_link *ata_port_first_link(struct ata_port *ap) 1268extern struct ata_link *__ata_port_next_link(struct ata_port *ap,
1269{ 1269 struct ata_link *link,
1270 if (sata_pmp_attached(ap)) 1270 bool dev_only);
1271 return ap->pmp_link;
1272 return &ap->link;
1273}
1274
1275static inline struct ata_link *ata_port_next_link(struct ata_link *link)
1276{
1277 struct ata_port *ap = link->ap;
1278
1279 if (ata_is_host_link(link)) {
1280 if (!sata_pmp_attached(ap))
1281 return NULL;
1282 return ap->pmp_link;
1283 }
1284
1285 if (++link < ap->nr_pmp_links + ap->pmp_link)
1286 return link;
1287 return NULL;
1288}
1289 1271
1290#define __ata_port_for_each_link(lk, ap) \ 1272#define __ata_port_for_each_link(link, ap) \
1291 for ((lk) = &(ap)->link; (lk); (lk) = ata_port_next_link(lk)) 1273 for ((link) = __ata_port_next_link((ap), NULL, false); (link); \
1274 (link) = __ata_port_next_link((ap), (link), false))
1292 1275
1293#define ata_port_for_each_link(link, ap) \ 1276#define ata_port_for_each_link(link, ap) \
1294 for ((link) = ata_port_first_link(ap); (link); \ 1277 for ((link) = __ata_port_next_link((ap), NULL, true); (link); \
1295 (link) = ata_port_next_link(link)) 1278 (link) = __ata_port_next_link((ap), (link), true))
1296 1279
1297#define ata_link_for_each_dev(dev, link) \ 1280#define ata_link_for_each_dev(dev, link) \
1298 for ((dev) = (link)->device; \ 1281 for ((dev) = (link)->device; \