From: Nadav Haklai <nad...@marvell.com>

With this patch, when searching for active link, first search through
the port multiplier links. And then fall to the default ap active_tag
only if no there is no active link in the port multiplier.

[gregory.clem...@free-electrons.com: reword commit log and title]

Signed-off-by: Lior Amsalem <al...@marvell.com>
Reviewed-by: Nadav Haklai <nad...@marvell.com>
Signed-off-by: Gregory CLEMENT <gregory.clem...@free-electrons.com>
---
 drivers/ata/sata_mv.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/drivers/ata/sata_mv.c b/drivers/ata/sata_mv.c
index f8c33e3772b8..7fac4d0fee86 100644
--- a/drivers/ata/sata_mv.c
+++ b/drivers/ata/sata_mv.c
@@ -2423,10 +2423,19 @@ static struct ata_queued_cmd *mv_get_active_qc(struct 
ata_port *ap)
 {
        struct mv_port_priv *pp = ap->private_data;
        struct ata_queued_cmd *qc;
+       struct ata_link *link = NULL;
 
        if (pp->pp_flags & MV_PP_FLAG_NCQ_EN)
                return NULL;
-       qc = ata_qc_from_tag(ap, ap->link.active_tag);
+
+       ata_for_each_link(link, ap, EDGE)
+               if (ata_link_active(link))
+                       break;
+
+       if (!link)
+               link = &ap->link;
+
+       qc = ata_qc_from_tag(ap, link->active_tag);
        if (qc && !(qc->tf.flags & ATA_TFLAG_POLLING))
                return qc;
        return NULL;
-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to