aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorCong Wang <amwang@redhat.com>2011-11-25 10:14:23 -0500
committerCong Wang <xiyou.wangcong@gmail.com>2012-03-20 09:48:19 -0400
commit77dfce076cbd76c04e90abff188d058cdbff78dd (patch)
treec2f1ac2dd386c68e6bf8dee8d996d0b6e36f9c73 /drivers
parent4679026d783eb5ac90247bc466d66b817b213abf (diff)
scsi: remove the second argument of k[un]map_atomic()
Signed-off-by: Cong Wang <amwang@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/scsi/arcmsr/arcmsr_hba.c8
-rw-r--r--drivers/scsi/bnx2fc/bnx2fc_fcoe.c5
-rw-r--r--drivers/scsi/cxgbi/libcxgbi.c5
-rw-r--r--drivers/scsi/fcoe/fcoe.c4
-rw-r--r--drivers/scsi/fcoe/fcoe_transport.c5
-rw-r--r--drivers/scsi/gdth.c4
-rw-r--r--drivers/scsi/ips.c6
-rw-r--r--drivers/scsi/isci/request.c16
-rw-r--r--drivers/scsi/libfc/fc_fcp.c8
-rw-r--r--drivers/scsi/libfc/fc_libfc.c8
-rw-r--r--drivers/scsi/libfc/fc_libfc.h2
-rw-r--r--drivers/scsi/libfc/fc_lport.c2
-rw-r--r--drivers/scsi/libiscsi_tcp.c4
-rw-r--r--drivers/scsi/libsas/sas_host_smp.c8
-rw-r--r--drivers/scsi/megaraid.c4
-rw-r--r--drivers/scsi/mvsas/mv_sas.c4
-rw-r--r--drivers/scsi/scsi_debug.c24
-rw-r--r--drivers/scsi/scsi_lib.c4
-rw-r--r--drivers/scsi/sd_dif.c12
19 files changed, 64 insertions, 69 deletions
diff --git a/drivers/scsi/arcmsr/arcmsr_hba.c b/drivers/scsi/arcmsr/arcmsr_hba.c
index f980600f78a8..2fe9e90e53d9 100644
--- a/drivers/scsi/arcmsr/arcmsr_hba.c
+++ b/drivers/scsi/arcmsr/arcmsr_hba.c
@@ -1736,7 +1736,7 @@ static int arcmsr_iop_message_xfer(struct AdapterControlBlock *acb,
1736 (uint32_t ) cmd->cmnd[8]; 1736 (uint32_t ) cmd->cmnd[8];
1737 /* 4 bytes: Areca io control code */ 1737 /* 4 bytes: Areca io control code */
1738 sg = scsi_sglist(cmd); 1738 sg = scsi_sglist(cmd);
1739 buffer = kmap_atomic(sg_page(sg), KM_IRQ0) + sg->offset; 1739 buffer = kmap_atomic(sg_page(sg)) + sg->offset;
1740 if (scsi_sg_count(cmd) > 1) { 1740 if (scsi_sg_count(cmd) > 1) {
1741 retvalue = ARCMSR_MESSAGE_FAIL; 1741 retvalue = ARCMSR_MESSAGE_FAIL;
1742 goto message_out; 1742 goto message_out;
@@ -1985,7 +1985,7 @@ static int arcmsr_iop_message_xfer(struct AdapterControlBlock *acb,
1985 } 1985 }
1986 message_out: 1986 message_out:
1987 sg = scsi_sglist(cmd); 1987 sg = scsi_sglist(cmd);
1988 kunmap_atomic(buffer - sg->offset, KM_IRQ0); 1988 kunmap_atomic(buffer - sg->offset);
1989 return retvalue; 1989 return retvalue;
1990} 1990}
1991 1991
@@ -2035,11 +2035,11 @@ static void arcmsr_handle_virtual_command(struct AdapterControlBlock *acb,
2035 strncpy(&inqdata[32], "R001", 4); /* Product Revision */ 2035 strncpy(&inqdata[32], "R001", 4); /* Product Revision */
2036 2036
2037 sg = scsi_sglist(cmd); 2037 sg = scsi_sglist(cmd);
2038 buffer = kmap_atomic(sg_page(sg), KM_IRQ0) + sg->offset; 2038 buffer = kmap_atomic(sg_page(sg)) + sg->offset;
2039 2039
2040 memcpy(buffer, inqdata, sizeof(inqdata)); 2040 memcpy(buffer, inqdata, sizeof(inqdata));
2041 sg = scsi_sglist(cmd); 2041 sg = scsi_sglist(cmd);
2042 kunmap_atomic(buffer - sg->offset, KM_IRQ0); 2042 kunmap_atomic(buffer - sg->offset);
2043 2043
2044 cmd->scsi_done(cmd); 2044 cmd->scsi_done(cmd);
2045 } 2045 }
diff --git a/drivers/scsi/bnx2fc/bnx2fc_fcoe.c b/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
index 8c6156a10d90..a9af42e83632 100644
--- a/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
+++ b/drivers/scsi/bnx2fc/bnx2fc_fcoe.c
@@ -322,8 +322,7 @@ static int bnx2fc_xmit(struct fc_lport *lport, struct fc_frame *fp)
322 return -ENOMEM; 322 return -ENOMEM;
323 } 323 }
324 frag = &skb_shinfo(skb)->frags[skb_shinfo(skb)->nr_frags - 1]; 324 frag = &skb_shinfo(skb)->frags[skb_shinfo(skb)->nr_frags - 1];
325 cp = kmap_atomic(skb_frag_page(frag), KM_SKB_DATA_SOFTIRQ) 325 cp = kmap_atomic(skb_frag_page(frag)) + frag->page_offset;
326 + frag->page_offset;
327 } else { 326 } else {
328 cp = (struct fcoe_crc_eof *)skb_put(skb, tlen); 327 cp = (struct fcoe_crc_eof *)skb_put(skb, tlen);
329 } 328 }
@@ -332,7 +331,7 @@ static int bnx2fc_xmit(struct fc_lport *lport, struct fc_frame *fp)
332 cp->fcoe_eof = eof; 331 cp->fcoe_eof = eof;
333 cp->fcoe_crc32 = cpu_to_le32(~crc); 332 cp->fcoe_crc32 = cpu_to_le32(~crc);
334 if (skb_is_nonlinear(skb)) { 333 if (skb_is_nonlinear(skb)) {
335 kunmap_atomic(cp, KM_SKB_DATA_SOFTIRQ); 334 kunmap_atomic(cp);
336 cp = NULL; 335 cp = NULL;
337 } 336 }
338 337
diff --git a/drivers/scsi/cxgbi/libcxgbi.c b/drivers/scsi/cxgbi/libcxgbi.c
index d3ff9cd40234..89afd6d21d89 100644
--- a/drivers/scsi/cxgbi/libcxgbi.c
+++ b/drivers/scsi/cxgbi/libcxgbi.c
@@ -1956,12 +1956,11 @@ int cxgbi_conn_init_pdu(struct iscsi_task *task, unsigned int offset,
1956 1956
1957 /* data fits in the skb's headroom */ 1957 /* data fits in the skb's headroom */
1958 for (i = 0; i < tdata->nr_frags; i++, frag++) { 1958 for (i = 0; i < tdata->nr_frags; i++, frag++) {
1959 char *src = kmap_atomic(frag->page, 1959 char *src = kmap_atomic(frag->page);
1960 KM_SOFTIRQ0);
1961 1960
1962 memcpy(dst, src+frag->offset, frag->size); 1961 memcpy(dst, src+frag->offset, frag->size);
1963 dst += frag->size; 1962 dst += frag->size;
1964 kunmap_atomic(src, KM_SOFTIRQ0); 1963 kunmap_atomic(src);
1965 } 1964 }
1966 if (padlen) { 1965 if (padlen) {
1967 memset(dst, 0, padlen); 1966 memset(dst, 0, padlen);
diff --git a/drivers/scsi/fcoe/fcoe.c b/drivers/scsi/fcoe/fcoe.c
index e9599600aa23..1094357d373e 100644
--- a/drivers/scsi/fcoe/fcoe.c
+++ b/drivers/scsi/fcoe/fcoe.c
@@ -1515,7 +1515,7 @@ static int fcoe_xmit(struct fc_lport *lport, struct fc_frame *fp)
1515 return -ENOMEM; 1515 return -ENOMEM;
1516 } 1516 }
1517 frag = &skb_shinfo(skb)->frags[skb_shinfo(skb)->nr_frags - 1]; 1517 frag = &skb_shinfo(skb)->frags[skb_shinfo(skb)->nr_frags - 1];
1518 cp = kmap_atomic(skb_frag_page(frag), KM_SKB_DATA_SOFTIRQ) 1518 cp = kmap_atomic(skb_frag_page(frag))
1519 + frag->page_offset; 1519 + frag->page_offset;
1520 } else { 1520 } else {
1521 cp = (struct fcoe_crc_eof *)skb_put(skb, tlen); 1521 cp = (struct fcoe_crc_eof *)skb_put(skb, tlen);
@@ -1526,7 +1526,7 @@ static int fcoe_xmit(struct fc_lport *lport, struct fc_frame *fp)
1526 cp->fcoe_crc32 = cpu_to_le32(~crc); 1526 cp->fcoe_crc32 = cpu_to_le32(~crc);
1527 1527
1528 if (skb_is_nonlinear(skb)) { 1528 if (skb_is_nonlinear(skb)) {
1529 kunmap_atomic(cp, KM_SKB_DATA_SOFTIRQ); 1529 kunmap_atomic(cp);
1530 cp = NULL; 1530 cp = NULL;
1531 } 1531 }
1532 1532
diff --git a/drivers/scsi/fcoe/fcoe_transport.c b/drivers/scsi/fcoe/fcoe_transport.c
index bd97b2273f20..4d119a326d3b 100644
--- a/drivers/scsi/fcoe/fcoe_transport.c
+++ b/drivers/scsi/fcoe/fcoe_transport.c
@@ -210,10 +210,9 @@ u32 fcoe_fc_crc(struct fc_frame *fp)
210 while (len > 0) { 210 while (len > 0) {
211 clen = min(len, PAGE_SIZE - (off & ~PAGE_MASK)); 211 clen = min(len, PAGE_SIZE - (off & ~PAGE_MASK));
212 data = kmap_atomic( 212 data = kmap_atomic(
213 skb_frag_page(frag) + (off >> PAGE_SHIFT), 213 skb_frag_page(frag) + (off >> PAGE_SHIFT));
214 KM_SKB_DATA_SOFTIRQ);
215 crc = crc32(crc, data + (off & ~PAGE_MASK), clen); 214 crc = crc32(crc, data + (off & ~PAGE_MASK), clen);
216 kunmap_atomic(data, KM_SKB_DATA_SOFTIRQ); 215 kunmap_atomic(data);
217 off += clen; 216 off += clen;
218 len -= clen; 217 len -= clen;
219 } 218 }
diff --git a/drivers/scsi/gdth.c b/drivers/scsi/gdth.c
index 3242bcabad97..d42ec921de46 100644
--- a/drivers/scsi/gdth.c
+++ b/drivers/scsi/gdth.c
@@ -2310,10 +2310,10 @@ static void gdth_copy_internal_data(gdth_ha_str *ha, Scsi_Cmnd *scp,
2310 return; 2310 return;
2311 } 2311 }
2312 local_irq_save(flags); 2312 local_irq_save(flags);
2313 address = kmap_atomic(sg_page(sl), KM_BIO_SRC_IRQ) + sl->offset; 2313 address = kmap_atomic(sg_page(sl)) + sl->offset;
2314 memcpy(address, buffer, cpnow); 2314 memcpy(address, buffer, cpnow);
2315 flush_dcache_page(sg_page(sl)); 2315 flush_dcache_page(sg_page(sl));
2316 kunmap_atomic(address, KM_BIO_SRC_IRQ); 2316 kunmap_atomic(address);
2317 local_irq_restore(flags); 2317 local_irq_restore(flags);
2318 if (cpsum == cpcount) 2318 if (cpsum == cpcount)
2319 break; 2319 break;
diff --git a/drivers/scsi/ips.c b/drivers/scsi/ips.c
index d77891e5683b..b6d7a5c2fc94 100644
--- a/drivers/scsi/ips.c
+++ b/drivers/scsi/ips.c
@@ -1511,14 +1511,14 @@ static int ips_is_passthru(struct scsi_cmnd *SC)
1511 /* kmap_atomic() ensures addressability of the user buffer.*/ 1511 /* kmap_atomic() ensures addressability of the user buffer.*/
1512 /* local_irq_save() protects the KM_IRQ0 address slot. */ 1512 /* local_irq_save() protects the KM_IRQ0 address slot. */
1513 local_irq_save(flags); 1513 local_irq_save(flags);
1514 buffer = kmap_atomic(sg_page(sg), KM_IRQ0) + sg->offset; 1514 buffer = kmap_atomic(sg_page(sg)) + sg->offset;
1515 if (buffer && buffer[0] == 'C' && buffer[1] == 'O' && 1515 if (buffer && buffer[0] == 'C' && buffer[1] == 'O' &&
1516 buffer[2] == 'P' && buffer[3] == 'P') { 1516 buffer[2] == 'P' && buffer[3] == 'P') {
1517 kunmap_atomic(buffer - sg->offset, KM_IRQ0); 1517 kunmap_atomic(buffer - sg->offset);
1518 local_irq_restore(flags); 1518 local_irq_restore(flags);
1519 return 1; 1519 return 1;
1520 } 1520 }
1521 kunmap_atomic(buffer - sg->offset, KM_IRQ0); 1521 kunmap_atomic(buffer - sg->offset);
1522 local_irq_restore(flags); 1522 local_irq_restore(flags);
1523 } 1523 }
1524 return 0; 1524 return 0;
diff --git a/drivers/scsi/isci/request.c b/drivers/scsi/isci/request.c
index 192cb48d849a..ee0dc05c6269 100644
--- a/drivers/scsi/isci/request.c
+++ b/drivers/scsi/isci/request.c
@@ -1304,9 +1304,9 @@ sci_stp_request_pio_data_in_copy_data_buffer(struct isci_stp_request *stp_req,
1304 struct page *page = sg_page(sg); 1304 struct page *page = sg_page(sg);
1305 1305
1306 copy_len = min_t(int, total_len, sg_dma_len(sg)); 1306 copy_len = min_t(int, total_len, sg_dma_len(sg));
1307 kaddr = kmap_atomic(page, KM_IRQ0); 1307 kaddr = kmap_atomic(page);
1308 memcpy(kaddr + sg->offset, src_addr, copy_len); 1308 memcpy(kaddr + sg->offset, src_addr, copy_len);
1309 kunmap_atomic(kaddr, KM_IRQ0); 1309 kunmap_atomic(kaddr);
1310 total_len -= copy_len; 1310 total_len -= copy_len;
1311 src_addr += copy_len; 1311 src_addr += copy_len;
1312 sg = sg_next(sg); 1312 sg = sg_next(sg);
@@ -1654,7 +1654,7 @@ sci_io_request_frame_handler(struct isci_request *ireq,
1654 sci_unsolicited_frame_control_get_header(&ihost->uf_control, 1654 sci_unsolicited_frame_control_get_header(&ihost->uf_control,
1655 frame_index, 1655 frame_index,
1656 &frame_header); 1656 &frame_header);
1657 kaddr = kmap_atomic(sg_page(sg), KM_IRQ0); 1657 kaddr = kmap_atomic(sg_page(sg));
1658 rsp = kaddr + sg->offset; 1658 rsp = kaddr + sg->offset;
1659 sci_swab32_cpy(rsp, frame_header, 1); 1659 sci_swab32_cpy(rsp, frame_header, 1);
1660 1660
@@ -1691,7 +1691,7 @@ sci_io_request_frame_handler(struct isci_request *ireq,
1691 ireq->sci_status = SCI_FAILURE_CONTROLLER_SPECIFIC_IO_ERR; 1691 ireq->sci_status = SCI_FAILURE_CONTROLLER_SPECIFIC_IO_ERR;
1692 sci_change_state(&ireq->sm, SCI_REQ_COMPLETED); 1692 sci_change_state(&ireq->sm, SCI_REQ_COMPLETED);
1693 } 1693 }
1694 kunmap_atomic(kaddr, KM_IRQ0); 1694 kunmap_atomic(kaddr);
1695 1695
1696 sci_controller_release_frame(ihost, frame_index); 1696 sci_controller_release_frame(ihost, frame_index);
1697 1697
@@ -3023,10 +3023,10 @@ static void isci_request_io_request_complete(struct isci_host *ihost,
3023 dma_unmap_sg(&ihost->pdev->dev, sg, 1, DMA_TO_DEVICE); 3023 dma_unmap_sg(&ihost->pdev->dev, sg, 1, DMA_TO_DEVICE);
3024 3024
3025 /* need to swab it back in case the command buffer is re-used */ 3025 /* need to swab it back in case the command buffer is re-used */
3026 kaddr = kmap_atomic(sg_page(sg), KM_IRQ0); 3026 kaddr = kmap_atomic(sg_page(sg));
3027 smp_req = kaddr + sg->offset; 3027 smp_req = kaddr + sg->offset;
3028 sci_swab32_cpy(smp_req, smp_req, sg->length / sizeof(u32)); 3028 sci_swab32_cpy(smp_req, smp_req, sg->length / sizeof(u32));
3029 kunmap_atomic(kaddr, KM_IRQ0); 3029 kunmap_atomic(kaddr);
3030 break; 3030 break;
3031 } 3031 }
3032 default: 3032 default:
@@ -3311,7 +3311,7 @@ sci_io_request_construct_smp(struct device *dev,
3311 u8 req_len; 3311 u8 req_len;
3312 u32 cmd; 3312 u32 cmd;
3313 3313
3314 kaddr = kmap_atomic(sg_page(sg), KM_IRQ0); 3314 kaddr = kmap_atomic(sg_page(sg));
3315 smp_req = kaddr + sg->offset; 3315 smp_req = kaddr + sg->offset;
3316 /* 3316 /*
3317 * Look at the SMP requests' header fields; for certain SAS 1.x SMP 3317 * Look at the SMP requests' header fields; for certain SAS 1.x SMP
@@ -3337,7 +3337,7 @@ sci_io_request_construct_smp(struct device *dev,
3337 req_len = smp_req->req_len; 3337 req_len = smp_req->req_len;
3338 sci_swab32_cpy(smp_req, smp_req, sg->length / sizeof(u32)); 3338 sci_swab32_cpy(smp_req, smp_req, sg->length / sizeof(u32));
3339 cmd = *(u32 *) smp_req; 3339 cmd = *(u32 *) smp_req;
3340 kunmap_atomic(kaddr, KM_IRQ0); 3340 kunmap_atomic(kaddr);
3341 3341
3342 if (!dma_map_sg(dev, sg, 1, DMA_TO_DEVICE)) 3342 if (!dma_map_sg(dev, sg, 1, DMA_TO_DEVICE))
3343 return SCI_FAILURE; 3343 return SCI_FAILURE;
diff --git a/drivers/scsi/libfc/fc_fcp.c b/drivers/scsi/libfc/fc_fcp.c
index f607314810ac..b577c907b318 100644
--- a/drivers/scsi/libfc/fc_fcp.c
+++ b/drivers/scsi/libfc/fc_fcp.c
@@ -485,11 +485,11 @@ static void fc_fcp_recv_data(struct fc_fcp_pkt *fsp, struct fc_frame *fp)
485 485
486 if (!(fr_flags(fp) & FCPHF_CRC_UNCHECKED)) { 486 if (!(fr_flags(fp) & FCPHF_CRC_UNCHECKED)) {
487 copy_len = fc_copy_buffer_to_sglist(buf, len, sg, &nents, 487 copy_len = fc_copy_buffer_to_sglist(buf, len, sg, &nents,
488 &offset, KM_SOFTIRQ0, NULL); 488 &offset, NULL);
489 } else { 489 } else {
490 crc = crc32(~0, (u8 *) fh, sizeof(*fh)); 490 crc = crc32(~0, (u8 *) fh, sizeof(*fh));
491 copy_len = fc_copy_buffer_to_sglist(buf, len, sg, &nents, 491 copy_len = fc_copy_buffer_to_sglist(buf, len, sg, &nents,
492 &offset, KM_SOFTIRQ0, &crc); 492 &offset, &crc);
493 buf = fc_frame_payload_get(fp, 0); 493 buf = fc_frame_payload_get(fp, 0);
494 if (len % 4) 494 if (len % 4)
495 crc = crc32(crc, buf + len, 4 - (len % 4)); 495 crc = crc32(crc, buf + len, 4 - (len % 4));
@@ -650,10 +650,10 @@ static int fc_fcp_send_data(struct fc_fcp_pkt *fsp, struct fc_seq *seq,
650 * The scatterlist item may be bigger than PAGE_SIZE, 650 * The scatterlist item may be bigger than PAGE_SIZE,
651 * but we must not cross pages inside the kmap. 651 * but we must not cross pages inside the kmap.
652 */ 652 */
653 page_addr = kmap_atomic(page, KM_SOFTIRQ0); 653 page_addr = kmap_atomic(page);
654 memcpy(data, (char *)page_addr + (off & ~PAGE_MASK), 654 memcpy(data, (char *)page_addr + (off & ~PAGE_MASK),
655 sg_bytes); 655 sg_bytes);
656 kunmap_atomic(page_addr, KM_SOFTIRQ0); 656 kunmap_atomic(page_addr);
657 data += sg_bytes; 657 data += sg_bytes;
658 } 658 }
659 offset += sg_bytes; 659 offset += sg_bytes;
diff --git a/drivers/scsi/libfc/fc_libfc.c b/drivers/scsi/libfc/fc_libfc.c
index 1bf9841ef154..8d65a51a7598 100644
--- a/drivers/scsi/libfc/fc_libfc.c
+++ b/drivers/scsi/libfc/fc_libfc.c
@@ -105,14 +105,13 @@ module_exit(libfc_exit);
105 * @sg: pointer to the pointer of the SG list. 105 * @sg: pointer to the pointer of the SG list.
106 * @nents: pointer to the remaining number of entries in the SG list. 106 * @nents: pointer to the remaining number of entries in the SG list.
107 * @offset: pointer to the current offset in the SG list. 107 * @offset: pointer to the current offset in the SG list.
108 * @km_type: dedicated page table slot type for kmap_atomic.
109 * @crc: pointer to the 32-bit crc value. 108 * @crc: pointer to the 32-bit crc value.
110 * If crc is NULL, CRC is not calculated. 109 * If crc is NULL, CRC is not calculated.
111 */ 110 */
112u32 fc_copy_buffer_to_sglist(void *buf, size_t len, 111u32 fc_copy_buffer_to_sglist(void *buf, size_t len,
113 struct scatterlist *sg, 112 struct scatterlist *sg,
114 u32 *nents, size_t *offset, 113 u32 *nents, size_t *offset,
115 enum km_type km_type, u32 *crc) 114 u32 *crc)
116{ 115{
117 size_t remaining = len; 116 size_t remaining = len;
118 u32 copy_len = 0; 117 u32 copy_len = 0;
@@ -142,12 +141,11 @@ u32 fc_copy_buffer_to_sglist(void *buf, size_t len,
142 off = *offset + sg->offset; 141 off = *offset + sg->offset;
143 sg_bytes = min(sg_bytes, 142 sg_bytes = min(sg_bytes,
144 (size_t)(PAGE_SIZE - (off & ~PAGE_MASK))); 143 (size_t)(PAGE_SIZE - (off & ~PAGE_MASK)));
145 page_addr = kmap_atomic(sg_page(sg) + (off >> PAGE_SHIFT), 144 page_addr = kmap_atomic(sg_page(sg) + (off >> PAGE_SHIFT));
146 km_type);
147 if (crc) 145 if (crc)
148 *crc = crc32(*crc, buf, sg_bytes); 146 *crc = crc32(*crc, buf, sg_bytes);
149 memcpy((char *)page_addr + (off & ~PAGE_MASK), buf, sg_bytes); 147 memcpy((char *)page_addr + (off & ~PAGE_MASK), buf, sg_bytes);
150 kunmap_atomic(page_addr, km_type); 148 kunmap_atomic(page_addr);
151 buf += sg_bytes; 149 buf += sg_bytes;
152 *offset += sg_bytes; 150 *offset += sg_bytes;
153 remaining -= sg_bytes; 151 remaining -= sg_bytes;
diff --git a/drivers/scsi/libfc/fc_libfc.h b/drivers/scsi/libfc/fc_libfc.h
index c7d071289af5..c2830cc66d6a 100644
--- a/drivers/scsi/libfc/fc_libfc.h
+++ b/drivers/scsi/libfc/fc_libfc.h
@@ -134,6 +134,6 @@ extern void fc_fc4_conf_lport_params(struct fc_lport *, enum fc_fh_type);
134u32 fc_copy_buffer_to_sglist(void *buf, size_t len, 134u32 fc_copy_buffer_to_sglist(void *buf, size_t len,
135 struct scatterlist *sg, 135 struct scatterlist *sg,
136 u32 *nents, size_t *offset, 136 u32 *nents, size_t *offset,
137 enum km_type km_type, u32 *crc); 137 u32 *crc);
138 138
139#endif /* _FC_LIBFC_H_ */ 139#endif /* _FC_LIBFC_H_ */
diff --git a/drivers/scsi/libfc/fc_lport.c b/drivers/scsi/libfc/fc_lport.c
index 83750ebb527f..c1a808cc5920 100644
--- a/drivers/scsi/libfc/fc_lport.c
+++ b/drivers/scsi/libfc/fc_lport.c
@@ -1698,7 +1698,7 @@ static void fc_lport_bsg_resp(struct fc_seq *sp, struct fc_frame *fp,
1698 1698
1699 job->reply->reply_payload_rcv_len += 1699 job->reply->reply_payload_rcv_len +=
1700 fc_copy_buffer_to_sglist(buf, len, info->sg, &info->nents, 1700 fc_copy_buffer_to_sglist(buf, len, info->sg, &info->nents,
1701 &info->offset, KM_BIO_SRC_IRQ, NULL); 1701 &info->offset, NULL);
1702 1702
1703 if (fr_eof(fp) == FC_EOF_T && 1703 if (fr_eof(fp) == FC_EOF_T &&
1704 (ntoh24(fh->fh_f_ctl) & (FC_FC_LAST_SEQ | FC_FC_END_SEQ)) == 1704 (ntoh24(fh->fh_f_ctl) & (FC_FC_LAST_SEQ | FC_FC_END_SEQ)) ==
diff --git a/drivers/scsi/libiscsi_tcp.c b/drivers/scsi/libiscsi_tcp.c
index 5715a3d0a3d3..7f0465b9623e 100644
--- a/drivers/scsi/libiscsi_tcp.c
+++ b/drivers/scsi/libiscsi_tcp.c
@@ -135,7 +135,7 @@ static void iscsi_tcp_segment_map(struct iscsi_segment *segment, int recv)
135 135
136 if (recv) { 136 if (recv) {
137 segment->atomic_mapped = true; 137 segment->atomic_mapped = true;
138 segment->sg_mapped = kmap_atomic(sg_page(sg), KM_SOFTIRQ0); 138 segment->sg_mapped = kmap_atomic(sg_page(sg));
139 } else { 139 } else {
140 segment->atomic_mapped = false; 140 segment->atomic_mapped = false;
141 /* the xmit path can sleep with the page mapped so use kmap */ 141 /* the xmit path can sleep with the page mapped so use kmap */
@@ -149,7 +149,7 @@ void iscsi_tcp_segment_unmap(struct iscsi_segment *segment)
149{ 149{
150 if (segment->sg_mapped) { 150 if (segment->sg_mapped) {
151 if (segment->atomic_mapped) 151 if (segment->atomic_mapped)
152 kunmap_atomic(segment->sg_mapped, KM_SOFTIRQ0); 152 kunmap_atomic(segment->sg_mapped);
153 else 153 else
154 kunmap(sg_page(segment->sg)); 154 kunmap(sg_page(segment->sg));
155 segment->sg_mapped = NULL; 155 segment->sg_mapped = NULL;
diff --git a/drivers/scsi/libsas/sas_host_smp.c b/drivers/scsi/libsas/sas_host_smp.c
index bb8f49269a68..3814d3eed401 100644
--- a/drivers/scsi/libsas/sas_host_smp.c
+++ b/drivers/scsi/libsas/sas_host_smp.c
@@ -246,9 +246,9 @@ int sas_smp_host_handler(struct Scsi_Host *shost, struct request *req,
246 } 246 }
247 247
248 local_irq_disable(); 248 local_irq_disable();
249 buf = kmap_atomic(bio_page(req->bio), KM_USER0) + bio_offset(req->bio); 249 buf = kmap_atomic(bio_page(req->bio));
250 memcpy(req_data, buf, blk_rq_bytes(req)); 250 memcpy(req_data, buf, blk_rq_bytes(req));
251 kunmap_atomic(buf - bio_offset(req->bio), KM_USER0); 251 kunmap_atomic(buf - bio_offset(req->bio));
252 local_irq_enable(); 252 local_irq_enable();
253 253
254 if (req_data[0] != SMP_REQUEST) 254 if (req_data[0] != SMP_REQUEST)
@@ -361,10 +361,10 @@ int sas_smp_host_handler(struct Scsi_Host *shost, struct request *req,
361 } 361 }
362 362
363 local_irq_disable(); 363 local_irq_disable();
364 buf = kmap_atomic(bio_page(rsp->bio), KM_USER0) + bio_offset(rsp->bio); 364 buf = kmap_atomic(bio_page(rsp->bio));
365 memcpy(buf, resp_data, blk_rq_bytes(rsp)); 365 memcpy(buf, resp_data, blk_rq_bytes(rsp));
366 flush_kernel_dcache_page(bio_page(rsp->bio)); 366 flush_kernel_dcache_page(bio_page(rsp->bio));
367 kunmap_atomic(buf - bio_offset(rsp->bio), KM_USER0); 367 kunmap_atomic(buf - bio_offset(rsp->bio));
368 local_irq_enable(); 368 local_irq_enable();
369 369
370 out: 370 out:
diff --git a/drivers/scsi/megaraid.c b/drivers/scsi/megaraid.c
index 15eefa1d61fd..4d39a9ffc081 100644
--- a/drivers/scsi/megaraid.c
+++ b/drivers/scsi/megaraid.c
@@ -670,10 +670,10 @@ mega_build_cmd(adapter_t *adapter, Scsi_Cmnd *cmd, int *busy)
670 struct scatterlist *sg; 670 struct scatterlist *sg;
671 671
672 sg = scsi_sglist(cmd); 672 sg = scsi_sglist(cmd);
673 buf = kmap_atomic(sg_page(sg), KM_IRQ0) + sg->offset; 673 buf = kmap_atomic(sg_page(sg)) + sg->offset;
674 674
675 memset(buf, 0, cmd->cmnd[4]); 675 memset(buf, 0, cmd->cmnd[4]);
676 kunmap_atomic(buf - sg->offset, KM_IRQ0); 676 kunmap_atomic(buf - sg->offset);
677 677
678 cmd->result = (DID_OK << 16); 678 cmd->result = (DID_OK << 16);
679 cmd->scsi_done(cmd); 679 cmd->scsi_done(cmd);
diff --git a/drivers/scsi/mvsas/mv_sas.c b/drivers/scsi/mvsas/mv_sas.c
index a4884a57cf79..01ab9c4d3464 100644
--- a/drivers/scsi/mvsas/mv_sas.c
+++ b/drivers/scsi/mvsas/mv_sas.c
@@ -1885,11 +1885,11 @@ int mvs_slot_complete(struct mvs_info *mvi, u32 rx_desc, u32 flags)
1885 case SAS_PROTOCOL_SMP: { 1885 case SAS_PROTOCOL_SMP: {
1886 struct scatterlist *sg_resp = &task->smp_task.smp_resp; 1886 struct scatterlist *sg_resp = &task->smp_task.smp_resp;
1887 tstat->stat = SAM_STAT_GOOD; 1887 tstat->stat = SAM_STAT_GOOD;
1888 to = kmap_atomic(sg_page(sg_resp), KM_IRQ0); 1888 to = kmap_atomic(sg_page(sg_resp));
1889 memcpy(to + sg_resp->offset, 1889 memcpy(to + sg_resp->offset,
1890 slot->response + sizeof(struct mvs_err_info), 1890 slot->response + sizeof(struct mvs_err_info),
1891 sg_dma_len(sg_resp)); 1891 sg_dma_len(sg_resp));
1892 kunmap_atomic(to, KM_IRQ0); 1892 kunmap_atomic(to);
1893 break; 1893 break;
1894 } 1894 }
1895 1895
diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c
index 6888b2ca5bfc..68da6c092f65 100644
--- a/drivers/scsi/scsi_debug.c
+++ b/drivers/scsi/scsi_debug.c
@@ -1778,7 +1778,7 @@ static int prot_verify_read(struct scsi_cmnd *SCpnt, sector_t start_sec,
1778 scsi_for_each_prot_sg(SCpnt, psgl, scsi_prot_sg_count(SCpnt), i) { 1778 scsi_for_each_prot_sg(SCpnt, psgl, scsi_prot_sg_count(SCpnt), i) {
1779 int len = min(psgl->length, resid); 1779 int len = min(psgl->length, resid);
1780 1780
1781 paddr = kmap_atomic(sg_page(psgl), KM_IRQ0) + psgl->offset; 1781 paddr = kmap_atomic(sg_page(psgl)) + psgl->offset;
1782 memcpy(paddr, dif_storep + dif_offset(sector), len); 1782 memcpy(paddr, dif_storep + dif_offset(sector), len);
1783 1783
1784 sector += len >> 3; 1784 sector += len >> 3;
@@ -1788,7 +1788,7 @@ static int prot_verify_read(struct scsi_cmnd *SCpnt, sector_t start_sec,
1788 sector = do_div(tmp_sec, sdebug_store_sectors); 1788 sector = do_div(tmp_sec, sdebug_store_sectors);
1789 } 1789 }
1790 resid -= len; 1790 resid -= len;
1791 kunmap_atomic(paddr, KM_IRQ0); 1791 kunmap_atomic(paddr);
1792 } 1792 }
1793 1793
1794 dix_reads++; 1794 dix_reads++;
@@ -1881,12 +1881,12 @@ static int prot_verify_write(struct scsi_cmnd *SCpnt, sector_t start_sec,
1881 BUG_ON(scsi_sg_count(SCpnt) == 0); 1881 BUG_ON(scsi_sg_count(SCpnt) == 0);
1882 BUG_ON(scsi_prot_sg_count(SCpnt) == 0); 1882 BUG_ON(scsi_prot_sg_count(SCpnt) == 0);
1883 1883
1884 paddr = kmap_atomic(sg_page(psgl), KM_IRQ1) + psgl->offset; 1884 paddr = kmap_atomic(sg_page(psgl)) + psgl->offset;
1885 ppage_offset = 0; 1885 ppage_offset = 0;
1886 1886
1887 /* For each data page */ 1887 /* For each data page */
1888 scsi_for_each_sg(SCpnt, dsgl, scsi_sg_count(SCpnt), i) { 1888 scsi_for_each_sg(SCpnt, dsgl, scsi_sg_count(SCpnt), i) {
1889 daddr = kmap_atomic(sg_page(dsgl), KM_IRQ0) + dsgl->offset; 1889 daddr = kmap_atomic(sg_page(dsgl)) + dsgl->offset;
1890 1890
1891 /* For each sector-sized chunk in data page */ 1891 /* For each sector-sized chunk in data page */
1892 for (j = 0 ; j < dsgl->length ; j += scsi_debug_sector_size) { 1892 for (j = 0 ; j < dsgl->length ; j += scsi_debug_sector_size) {
@@ -1895,10 +1895,10 @@ static int prot_verify_write(struct scsi_cmnd *SCpnt, sector_t start_sec,
1895 * protection page advance to the next one 1895 * protection page advance to the next one
1896 */ 1896 */
1897 if (ppage_offset >= psgl->length) { 1897 if (ppage_offset >= psgl->length) {
1898 kunmap_atomic(paddr, KM_IRQ1); 1898 kunmap_atomic(paddr);
1899 psgl = sg_next(psgl); 1899 psgl = sg_next(psgl);
1900 BUG_ON(psgl == NULL); 1900 BUG_ON(psgl == NULL);
1901 paddr = kmap_atomic(sg_page(psgl), KM_IRQ1) 1901 paddr = kmap_atomic(sg_page(psgl))
1902 + psgl->offset; 1902 + psgl->offset;
1903 ppage_offset = 0; 1903 ppage_offset = 0;
1904 } 1904 }
@@ -1971,10 +1971,10 @@ static int prot_verify_write(struct scsi_cmnd *SCpnt, sector_t start_sec,
1971 ppage_offset += sizeof(struct sd_dif_tuple); 1971 ppage_offset += sizeof(struct sd_dif_tuple);
1972 } 1972 }
1973 1973
1974 kunmap_atomic(daddr, KM_IRQ0); 1974 kunmap_atomic(daddr);
1975 } 1975 }
1976 1976
1977 kunmap_atomic(paddr, KM_IRQ1); 1977 kunmap_atomic(paddr);
1978 1978
1979 dix_writes++; 1979 dix_writes++;
1980 1980
@@ -1982,8 +1982,8 @@ static int prot_verify_write(struct scsi_cmnd *SCpnt, sector_t start_sec,
1982 1982
1983out: 1983out:
1984 dif_errors++; 1984 dif_errors++;
1985 kunmap_atomic(daddr, KM_IRQ0); 1985 kunmap_atomic(daddr);
1986 kunmap_atomic(paddr, KM_IRQ1); 1986 kunmap_atomic(paddr);
1987 return ret; 1987 return ret;
1988} 1988}
1989 1989
@@ -2303,7 +2303,7 @@ static int resp_xdwriteread(struct scsi_cmnd *scp, unsigned long long lba,
2303 2303
2304 offset = 0; 2304 offset = 0;
2305 for_each_sg(sdb->table.sgl, sg, sdb->table.nents, i) { 2305 for_each_sg(sdb->table.sgl, sg, sdb->table.nents, i) {
2306 kaddr = (unsigned char *)kmap_atomic(sg_page(sg), KM_USER0); 2306 kaddr = (unsigned char *)kmap_atomic(sg_page(sg));
2307 if (!kaddr) 2307 if (!kaddr)
2308 goto out; 2308 goto out;
2309 2309
@@ -2311,7 +2311,7 @@ static int resp_xdwriteread(struct scsi_cmnd *scp, unsigned long long lba,
2311 *(kaddr + sg->offset + j) ^= *(buf + offset + j); 2311 *(kaddr + sg->offset + j) ^= *(buf + offset + j);
2312 2312
2313 offset += sg->length; 2313 offset += sg->length;
2314 kunmap_atomic(kaddr, KM_USER0); 2314 kunmap_atomic(kaddr);
2315 } 2315 }
2316 ret = 0; 2316 ret = 0;
2317out: 2317out:
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index b2c95dbe9d65..a33b2b66da67 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -2567,7 +2567,7 @@ void *scsi_kmap_atomic_sg(struct scatterlist *sgl, int sg_count,
2567 if (*len > sg_len) 2567 if (*len > sg_len)
2568 *len = sg_len; 2568 *len = sg_len;
2569 2569
2570 return kmap_atomic(page, KM_BIO_SRC_IRQ); 2570 return kmap_atomic(page);
2571} 2571}
2572EXPORT_SYMBOL(scsi_kmap_atomic_sg); 2572EXPORT_SYMBOL(scsi_kmap_atomic_sg);
2573 2573
@@ -2577,6 +2577,6 @@ EXPORT_SYMBOL(scsi_kmap_atomic_sg);
2577 */ 2577 */
2578void scsi_kunmap_atomic_sg(void *virt) 2578void scsi_kunmap_atomic_sg(void *virt)
2579{ 2579{
2580 kunmap_atomic(virt, KM_BIO_SRC_IRQ); 2580 kunmap_atomic(virt);
2581} 2581}
2582EXPORT_SYMBOL(scsi_kunmap_atomic_sg); 2582EXPORT_SYMBOL(scsi_kunmap_atomic_sg);
diff --git a/drivers/scsi/sd_dif.c b/drivers/scsi/sd_dif.c
index f8fb2d691c0a..e52d5bc42bc4 100644
--- a/drivers/scsi/sd_dif.c
+++ b/drivers/scsi/sd_dif.c
@@ -392,7 +392,7 @@ int sd_dif_prepare(struct request *rq, sector_t hw_sector, unsigned int sector_s
392 virt = bio->bi_integrity->bip_sector & 0xffffffff; 392 virt = bio->bi_integrity->bip_sector & 0xffffffff;
393 393
394 bip_for_each_vec(iv, bio->bi_integrity, i) { 394 bip_for_each_vec(iv, bio->bi_integrity, i) {
395 sdt = kmap_atomic(iv->bv_page, KM_USER0) 395 sdt = kmap_atomic(iv->bv_page)
396 + iv->bv_offset; 396 + iv->bv_offset;
397 397
398 for (j = 0 ; j < iv->bv_len ; j += tuple_sz, sdt++) { 398 for (j = 0 ; j < iv->bv_len ; j += tuple_sz, sdt++) {
@@ -405,7 +405,7 @@ int sd_dif_prepare(struct request *rq, sector_t hw_sector, unsigned int sector_s
405 phys++; 405 phys++;
406 } 406 }
407 407
408 kunmap_atomic(sdt, KM_USER0); 408 kunmap_atomic(sdt);
409 } 409 }
410 410
411 bio->bi_flags |= (1 << BIO_MAPPED_INTEGRITY); 411 bio->bi_flags |= (1 << BIO_MAPPED_INTEGRITY);
@@ -414,7 +414,7 @@ int sd_dif_prepare(struct request *rq, sector_t hw_sector, unsigned int sector_s
414 return 0; 414 return 0;
415 415
416error: 416error:
417 kunmap_atomic(sdt, KM_USER0); 417 kunmap_atomic(sdt);
418 sd_printk(KERN_ERR, sdkp, "%s: virt %u, phys %u, ref %u, app %4x\n", 418 sd_printk(KERN_ERR, sdkp, "%s: virt %u, phys %u, ref %u, app %4x\n",
419 __func__, virt, phys, be32_to_cpu(sdt->ref_tag), 419 __func__, virt, phys, be32_to_cpu(sdt->ref_tag),
420 be16_to_cpu(sdt->app_tag)); 420 be16_to_cpu(sdt->app_tag));
@@ -453,13 +453,13 @@ void sd_dif_complete(struct scsi_cmnd *scmd, unsigned int good_bytes)
453 virt = bio->bi_integrity->bip_sector & 0xffffffff; 453 virt = bio->bi_integrity->bip_sector & 0xffffffff;
454 454
455 bip_for_each_vec(iv, bio->bi_integrity, i) { 455 bip_for_each_vec(iv, bio->bi_integrity, i) {
456 sdt = kmap_atomic(iv->bv_page, KM_USER0) 456 sdt = kmap_atomic(iv->bv_page)
457 + iv->bv_offset; 457 + iv->bv_offset;
458 458
459 for (j = 0 ; j < iv->bv_len ; j += tuple_sz, sdt++) { 459 for (j = 0 ; j < iv->bv_len ; j += tuple_sz, sdt++) {
460 460
461 if (sectors == 0) { 461 if (sectors == 0) {
462 kunmap_atomic(sdt, KM_USER0); 462 kunmap_atomic(sdt);
463 return; 463 return;
464 } 464 }
465 465
@@ -474,7 +474,7 @@ void sd_dif_complete(struct scsi_cmnd *scmd, unsigned int good_bytes)
474 sectors--; 474 sectors--;
475 } 475 }
476 476
477 kunmap_atomic(sdt, KM_USER0); 477 kunmap_atomic(sdt);
478 } 478 }
479 } 479 }
480} 480}