Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 45711f1a authored by Jens Axboe's avatar Jens Axboe
Browse files

[SG] Update drivers to use sg helpers

parent 78c2f0b8
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1115,7 +1115,7 @@ static void do_ubd_request(struct request_queue *q)
			}
			prepare_request(req, io_req,
					(unsigned long long) req->sector << 9,
					sg->offset, sg->length, sg->page);
					sg->offset, sg->length, sg_page(sg));

			last_sectors = sg->length >> 9;
			n = os_write_file(thread_fd, &io_req,
+5 −5
Original line number Diff line number Diff line
@@ -4296,7 +4296,7 @@ void ata_sg_clean(struct ata_queued_cmd *qc)
		sg_last(sg, qc->orig_n_elem)->length += qc->pad_len;
		if (pad_buf) {
			struct scatterlist *psg = &qc->pad_sgent;
			void *addr = kmap_atomic(psg->page, KM_IRQ0);
			void *addr = kmap_atomic(sg_page(psg), KM_IRQ0);
			memcpy(addr + psg->offset, pad_buf, qc->pad_len);
			kunmap_atomic(addr, KM_IRQ0);
		}
@@ -4686,11 +4686,11 @@ static int ata_sg_setup(struct ata_queued_cmd *qc)
		 * data in this function or read data in ata_sg_clean.
		 */
		offset = lsg->offset + lsg->length - qc->pad_len;
		psg->page = nth_page(lsg->page, offset >> PAGE_SHIFT);
		sg_set_page(psg, nth_page(sg_page(lsg), offset >> PAGE_SHIFT));
		psg->offset = offset_in_page(offset);

		if (qc->tf.flags & ATA_TFLAG_WRITE) {
			void *addr = kmap_atomic(psg->page, KM_IRQ0);
			void *addr = kmap_atomic(sg_page(psg), KM_IRQ0);
			memcpy(pad_buf, addr + psg->offset, qc->pad_len);
			kunmap_atomic(addr, KM_IRQ0);
		}
@@ -4836,7 +4836,7 @@ static void ata_pio_sector(struct ata_queued_cmd *qc)
	if (qc->curbytes == qc->nbytes - qc->sect_size)
		ap->hsm_task_state = HSM_ST_LAST;

	page = qc->cursg->page;
	page = sg_page(qc->cursg);
	offset = qc->cursg->offset + qc->cursg_ofs;

	/* get the current page and offset */
@@ -4988,7 +4988,7 @@ static void __atapi_pio_bytes(struct ata_queued_cmd *qc, unsigned int bytes)

	sg = qc->cursg;

	page = sg->page;
	page = sg_page(sg);
	offset = sg->offset + qc->cursg_ofs;

	/* get the current page and offset */
+1 −1
Original line number Diff line number Diff line
@@ -1544,7 +1544,7 @@ static unsigned int ata_scsi_rbuf_get(struct scsi_cmnd *cmd, u8 **buf_out)
	struct scatterlist *sg = scsi_sglist(cmd);

	if (sg) {
		buf = kmap_atomic(sg->page, KM_IRQ0) + sg->offset;
		buf = kmap_atomic(sg_page(sg), KM_IRQ0) + sg->offset;
		buflen = sg->length;
	} else {
		buf = NULL;
+2 −0
Original line number Diff line number Diff line
@@ -345,6 +345,7 @@ static bool DAC960_CreateAuxiliaryStructures(DAC960_Controller_T *Controller)
	Command->V1.ScatterGatherList =
		(DAC960_V1_ScatterGatherSegment_T *)ScatterGatherCPU;
	Command->V1.ScatterGatherListDMA = ScatterGatherDMA;
	sg_init_table(Command->cmd_sglist, DAC960_V1_ScatterGatherLimit);
      } else {
        Command->cmd_sglist = Command->V2.ScatterList;
	Command->V2.ScatterGatherList =
@@ -353,6 +354,7 @@ static bool DAC960_CreateAuxiliaryStructures(DAC960_Controller_T *Controller)
	Command->V2.RequestSense =
				(DAC960_SCSI_RequestSense_T *)RequestSenseCPU;
	Command->V2.RequestSenseDMA = RequestSenseDMA;
	sg_init_table(Command->cmd_sglist, DAC960_V2_ScatterGatherLimit);
      }
    }
  return true;
+2 −2
Original line number Diff line number Diff line
@@ -2610,7 +2610,7 @@ static void do_cciss_request(struct request_queue *q)
	       (int)creq->nr_sectors);
#endif				/* CCISS_DEBUG */

	memset(tmp_sg, 0, sizeof(tmp_sg));
	sg_init_table(tmp_sg, MAXSGENTRIES);
	seg = blk_rq_map_sg(q, creq, tmp_sg);

	/* get the DMA records for the setup */
@@ -2621,7 +2621,7 @@ static void do_cciss_request(struct request_queue *q)

	for (i = 0; i < seg; i++) {
		c->SG[i].Len = tmp_sg[i].length;
		temp64.val = (__u64) pci_map_page(h->pdev, tmp_sg[i].page,
		temp64.val = (__u64) pci_map_page(h->pdev, sg_page(&tmp_sg[i]),
						  tmp_sg[i].offset,
						  tmp_sg[i].length, dir);
		c->SG[i].Addr.lower = temp64.val32.lower;
Loading