The SCSI core never sets sc_data_direction to DMA_BIDIRECTIONAL. This allows
to simplify srp_unmap_data(). Fix the bidi test in srp_map_data().

Signed-off-by: Bart Van Assche <bart.vanass...@sandisk.com>
Cc: Roland Dreier <rol...@kernel.org>
---
 drivers/infiniband/ulp/srp/ib_srp.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/drivers/infiniband/ulp/srp/ib_srp.c 
b/drivers/infiniband/ulp/srp/ib_srp.c
index 0747c05..22b7529 100644
--- a/drivers/infiniband/ulp/srp/ib_srp.c
+++ b/drivers/infiniband/ulp/srp/ib_srp.c
@@ -1063,9 +1063,7 @@ static void srp_unmap_data(struct scsi_cmnd *scmnd,
        struct ib_device *ibdev = dev->dev;
        int i, res;
 
-       if (!scsi_sglist(scmnd) ||
-           (scmnd->sc_data_direction != DMA_TO_DEVICE &&
-            scmnd->sc_data_direction != DMA_FROM_DEVICE))
+       if (!scsi_sglist(scmnd))
                return;
 
        if (dev->use_fast_reg) {
@@ -1524,11 +1522,9 @@ static int srp_map_data(struct scsi_cmnd *scmnd, struct 
srp_rdma_ch *ch,
        if (!scsi_sglist(scmnd) || scmnd->sc_data_direction == DMA_NONE)
                return sizeof (struct srp_cmd);
 
-       if (scmnd->sc_data_direction != DMA_FROM_DEVICE &&
-           scmnd->sc_data_direction != DMA_TO_DEVICE) {
+       if (scsi_bidi_cmnd(scmnd)) {
                shost_printk(KERN_WARNING, target->scsi_host,
-                            PFX "Unhandled data direction %d\n",
-                            scmnd->sc_data_direction);
+                            PFX "Bidi commands are not yet supported\n");
                return -EINVAL;
        }
 
-- 
2.1.2

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

Reply via email to