aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/ultrastor.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/ultrastor.c')
-rw-r--r--drivers/scsi/ultrastor.c19
1 files changed, 9 insertions, 10 deletions
diff --git a/drivers/scsi/ultrastor.c b/drivers/scsi/ultrastor.c
index 56906aba5ee3..c08235d5afc9 100644
--- a/drivers/scsi/ultrastor.c
+++ b/drivers/scsi/ultrastor.c
@@ -675,16 +675,15 @@ static const char *ultrastor_info(struct Scsi_Host * shpnt)
675 675
676static inline void build_sg_list(struct mscp *mscp, struct scsi_cmnd *SCpnt) 676static inline void build_sg_list(struct mscp *mscp, struct scsi_cmnd *SCpnt)
677{ 677{
678 struct scatterlist *sl; 678 struct scatterlist *sg;
679 long transfer_length = 0; 679 long transfer_length = 0;
680 int i, max; 680 int i, max;
681 681
682 sl = (struct scatterlist *) SCpnt->request_buffer; 682 max = scsi_sg_count(SCpnt);
683 max = SCpnt->use_sg; 683 scsi_for_each_sg(SCpnt, sg, max, i) {
684 for (i = 0; i < max; i++) { 684 mscp->sglist[i].address = isa_page_to_bus(sg->page) + sg->offset;
685 mscp->sglist[i].address = isa_page_to_bus(sl[i].page) + sl[i].offset; 685 mscp->sglist[i].num_bytes = sg->length;
686 mscp->sglist[i].num_bytes = sl[i].length; 686 transfer_length += sg->length;
687 transfer_length += sl[i].length;
688 } 687 }
689 mscp->number_of_sg_list = max; 688 mscp->number_of_sg_list = max;
690 mscp->transfer_data = isa_virt_to_bus(mscp->sglist); 689 mscp->transfer_data = isa_virt_to_bus(mscp->sglist);
@@ -730,15 +729,15 @@ static int ultrastor_queuecommand(struct scsi_cmnd *SCpnt,
730 my_mscp->target_id = SCpnt->device->id; 729 my_mscp->target_id = SCpnt->device->id;
731 my_mscp->ch_no = 0; 730 my_mscp->ch_no = 0;
732 my_mscp->lun = SCpnt->device->lun; 731 my_mscp->lun = SCpnt->device->lun;
733 if (SCpnt->use_sg) { 732 if (scsi_sg_count(SCpnt)) {
734 /* Set scatter/gather flag in SCSI command packet */ 733 /* Set scatter/gather flag in SCSI command packet */
735 my_mscp->sg = TRUE; 734 my_mscp->sg = TRUE;
736 build_sg_list(my_mscp, SCpnt); 735 build_sg_list(my_mscp, SCpnt);
737 } else { 736 } else {
738 /* Unset scatter/gather flag in SCSI command packet */ 737 /* Unset scatter/gather flag in SCSI command packet */
739 my_mscp->sg = FALSE; 738 my_mscp->sg = FALSE;
740 my_mscp->transfer_data = isa_virt_to_bus(SCpnt->request_buffer); 739 my_mscp->transfer_data = isa_virt_to_bus(scsi_sglist(SCpnt));
741 my_mscp->transfer_data_length = SCpnt->request_bufflen; 740 my_mscp->transfer_data_length = scsi_bufflen(SCpnt);
742 } 741 }
743 my_mscp->command_link = 0; /*???*/ 742 my_mscp->command_link = 0; /*???*/
744 my_mscp->scsi_command_link_id = 0; /*???*/ 743 my_mscp->scsi_command_link_id = 0; /*???*/