aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/scsi/sg.c38
1 files changed, 13 insertions, 25 deletions
diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c
index ccce31a400ea..9a56c0d320bf 100644
--- a/drivers/scsi/sg.c
+++ b/drivers/scsi/sg.c
@@ -1626,14 +1626,23 @@ exit_sg(void)
1626 idr_destroy(&sg_index_idr); 1626 idr_destroy(&sg_index_idr);
1627} 1627}
1628 1628
1629static int __sg_start_req(struct sg_request *srp, struct sg_io_hdr *hp, 1629static int sg_start_req(Sg_request *srp, unsigned char *cmd)
1630 unsigned char *cmd)
1631{ 1630{
1632 struct sg_fd *sfp = srp->parentfp; 1631 int res = 0;
1633 struct request_queue *q = sfp->parentdp->device->request_queue;
1634 struct request *rq; 1632 struct request *rq;
1633 Sg_fd *sfp = srp->parentfp;
1634 sg_io_hdr_t *hp = &srp->header;
1635 int dxfer_len = (int) hp->dxfer_len;
1636 int dxfer_dir = hp->dxfer_direction;
1637 Sg_scatter_hold *req_schp = &srp->data;
1638 Sg_scatter_hold *rsv_schp = &sfp->reserve;
1639 struct request_queue *q = sfp->parentdp->device->request_queue;
1640 struct rq_map_data map_data;
1635 int rw = hp->dxfer_direction == SG_DXFER_TO_DEV ? WRITE : READ; 1641 int rw = hp->dxfer_direction == SG_DXFER_TO_DEV ? WRITE : READ;
1636 1642
1643 SCSI_LOG_TIMEOUT(4, printk(KERN_INFO "sg_start_req: dxfer_len=%d\n",
1644 dxfer_len));
1645
1637 rq = blk_get_request(q, rw, GFP_ATOMIC); 1646 rq = blk_get_request(q, rw, GFP_ATOMIC);
1638 if (!rq) 1647 if (!rq)
1639 return -ENOMEM; 1648 return -ENOMEM;
@@ -1648,27 +1657,6 @@ static int __sg_start_req(struct sg_request *srp, struct sg_io_hdr *hp,
1648 rq->sense = srp->sense_b; 1657 rq->sense = srp->sense_b;
1649 rq->retries = SG_DEFAULT_RETRIES; 1658 rq->retries = SG_DEFAULT_RETRIES;
1650 1659
1651 return 0;
1652}
1653
1654static int sg_start_req(Sg_request *srp, unsigned char *cmd)
1655{
1656 int res;
1657 Sg_fd *sfp = srp->parentfp;
1658 sg_io_hdr_t *hp = &srp->header;
1659 int dxfer_len = (int) hp->dxfer_len;
1660 int dxfer_dir = hp->dxfer_direction;
1661 Sg_scatter_hold *req_schp = &srp->data;
1662 Sg_scatter_hold *rsv_schp = &sfp->reserve;
1663 struct request_queue *q = sfp->parentdp->device->request_queue;
1664 struct rq_map_data map_data;
1665
1666 SCSI_LOG_TIMEOUT(4, printk("sg_start_req: dxfer_len=%d\n", dxfer_len));
1667
1668 res = __sg_start_req(srp, hp, cmd);
1669 if (res)
1670 return res;
1671
1672 if ((dxfer_len <= 0) || (dxfer_dir == SG_DXFER_NONE)) 1660 if ((dxfer_len <= 0) || (dxfer_dir == SG_DXFER_NONE))
1673 return 0; 1661 return 0;
1674 1662