Skip to content

Commit 369af20

Browse files
committed
Merge tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi
Pull more SCSI updates from James Bottomley: "This series is all the stragglers that didn't quite make the first merge window pull. It's mostly minor updates and bug fixes of merge window code" * tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi: scsi: nsp_cs: Check of ioremap return value scsi: ufs: ufs-mediatek: Fix error checking in ufs_mtk_init_va09_pwr_ctrl() scsi: ufs: Modify Tactive time setting conditions scsi: efct: Remove useless DMA-32 fallback configuration scsi: message: fusion: mptctl: Use dma_alloc_coherent() scsi: message: fusion: mptsas: Use dma_alloc_coherent() scsi: message: fusion: Use dma_alloc_coherent() in mptsas_exp_repmanufacture_info() scsi: message: fusion: mptbase: Use dma_alloc_coherent() scsi: message: fusion: Use dma_alloc_coherent() in mpt_alloc_fw_memory() scsi: message: fusion: Remove usage of the deprecated "pci-dma-compat.h" API scsi: megaraid: Avoid mismatched storage type sizes scsi: hisi_sas: Remove unused variable and check in hisi_sas_send_ata_reset_each_phy() scsi: aic79xx: Remove redundant error variable scsi: pm80xx: Port reset timeout error handling correction scsi: mpi3mr: Fix formatting problems in some kernel-doc comments scsi: mpi3mr: Fix some spelling mistakes scsi: mpt3sas: Update persistent trigger pages from sysfs interface scsi: core: Fix scsi_mode_select() interface scsi: aacraid: Fix spelling of "its" scsi: qedf: Fix potential dereference of NULL pointer
2 parents b087788 + 2576e15 commit 369af20

File tree

22 files changed

+386
-280
lines changed

22 files changed

+386
-280
lines changed

drivers/message/fusion/mptbase.c

Lines changed: 84 additions & 65 deletions
Large diffs are not rendered by default.

drivers/message/fusion/mptctl.c

Lines changed: 49 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1041,14 +1041,15 @@ kbuf_alloc_2_sgl(int bytes, u32 sgdir, int sge_offset, int *frags,
10411041
* copying the data in this array into the correct place in the
10421042
* request and chain buffers.
10431043
*/
1044-
sglbuf = pci_alloc_consistent(ioc->pcidev, MAX_SGL_BYTES, sglbuf_dma);
1044+
sglbuf = dma_alloc_coherent(&ioc->pcidev->dev, MAX_SGL_BYTES,
1045+
sglbuf_dma, GFP_KERNEL);
10451046
if (sglbuf == NULL)
10461047
goto free_and_fail;
10471048

10481049
if (sgdir & 0x04000000)
1049-
dir = PCI_DMA_TODEVICE;
1050+
dir = DMA_TO_DEVICE;
10501051
else
1051-
dir = PCI_DMA_FROMDEVICE;
1052+
dir = DMA_FROM_DEVICE;
10521053

10531054
/* At start:
10541055
* sgl = sglbuf = point to beginning of sg buffer
@@ -1062,9 +1063,9 @@ kbuf_alloc_2_sgl(int bytes, u32 sgdir, int sge_offset, int *frags,
10621063
while (bytes_allocd < bytes) {
10631064
this_alloc = min(alloc_sz, bytes-bytes_allocd);
10641065
buflist[buflist_ent].len = this_alloc;
1065-
buflist[buflist_ent].kptr = pci_alloc_consistent(ioc->pcidev,
1066-
this_alloc,
1067-
&pa);
1066+
buflist[buflist_ent].kptr = dma_alloc_coherent(&ioc->pcidev->dev,
1067+
this_alloc,
1068+
&pa, GFP_KERNEL);
10681069
if (buflist[buflist_ent].kptr == NULL) {
10691070
alloc_sz = alloc_sz / 2;
10701071
if (alloc_sz == 0) {
@@ -1080,8 +1081,9 @@ kbuf_alloc_2_sgl(int bytes, u32 sgdir, int sge_offset, int *frags,
10801081

10811082
bytes_allocd += this_alloc;
10821083
sgl->FlagsLength = (0x10000000|sgdir|this_alloc);
1083-
dma_addr = pci_map_single(ioc->pcidev,
1084-
buflist[buflist_ent].kptr, this_alloc, dir);
1084+
dma_addr = dma_map_single(&ioc->pcidev->dev,
1085+
buflist[buflist_ent].kptr,
1086+
this_alloc, dir);
10851087
sgl->Address = dma_addr;
10861088

10871089
fragcnt++;
@@ -1140,9 +1142,11 @@ kbuf_alloc_2_sgl(int bytes, u32 sgdir, int sge_offset, int *frags,
11401142
kptr = buflist[i].kptr;
11411143
len = buflist[i].len;
11421144

1143-
pci_free_consistent(ioc->pcidev, len, kptr, dma_addr);
1145+
dma_free_coherent(&ioc->pcidev->dev, len, kptr,
1146+
dma_addr);
11441147
}
1145-
pci_free_consistent(ioc->pcidev, MAX_SGL_BYTES, sglbuf, *sglbuf_dma);
1148+
dma_free_coherent(&ioc->pcidev->dev, MAX_SGL_BYTES, sglbuf,
1149+
*sglbuf_dma);
11461150
}
11471151
kfree(buflist);
11481152
return NULL;
@@ -1162,9 +1166,9 @@ kfree_sgl(MptSge_t *sgl, dma_addr_t sgl_dma, struct buflist *buflist, MPT_ADAPTE
11621166
int n = 0;
11631167

11641168
if (sg->FlagsLength & 0x04000000)
1165-
dir = PCI_DMA_TODEVICE;
1169+
dir = DMA_TO_DEVICE;
11661170
else
1167-
dir = PCI_DMA_FROMDEVICE;
1171+
dir = DMA_FROM_DEVICE;
11681172

11691173
nib = (sg->FlagsLength & 0xF0000000) >> 28;
11701174
while (! (nib & 0x4)) { /* eob */
@@ -1179,8 +1183,10 @@ kfree_sgl(MptSge_t *sgl, dma_addr_t sgl_dma, struct buflist *buflist, MPT_ADAPTE
11791183
dma_addr = sg->Address;
11801184
kptr = bl->kptr;
11811185
len = bl->len;
1182-
pci_unmap_single(ioc->pcidev, dma_addr, len, dir);
1183-
pci_free_consistent(ioc->pcidev, len, kptr, dma_addr);
1186+
dma_unmap_single(&ioc->pcidev->dev, dma_addr, len,
1187+
dir);
1188+
dma_free_coherent(&ioc->pcidev->dev, len, kptr,
1189+
dma_addr);
11841190
n++;
11851191
}
11861192
sg++;
@@ -1197,12 +1203,12 @@ kfree_sgl(MptSge_t *sgl, dma_addr_t sgl_dma, struct buflist *buflist, MPT_ADAPTE
11971203
dma_addr = sg->Address;
11981204
kptr = bl->kptr;
11991205
len = bl->len;
1200-
pci_unmap_single(ioc->pcidev, dma_addr, len, dir);
1201-
pci_free_consistent(ioc->pcidev, len, kptr, dma_addr);
1206+
dma_unmap_single(&ioc->pcidev->dev, dma_addr, len, dir);
1207+
dma_free_coherent(&ioc->pcidev->dev, len, kptr, dma_addr);
12021208
n++;
12031209
}
12041210

1205-
pci_free_consistent(ioc->pcidev, MAX_SGL_BYTES, sgl, sgl_dma);
1211+
dma_free_coherent(&ioc->pcidev->dev, MAX_SGL_BYTES, sgl, sgl_dma);
12061212
kfree(buflist);
12071213
dctlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "-SG: Free'd 1 SGL buf + %d kbufs!\n",
12081214
ioc->name, n));
@@ -2100,8 +2106,9 @@ mptctl_do_mpt_command (MPT_ADAPTER *ioc, struct mpt_ioctl_command karg, void __u
21002106
}
21012107
flagsLength |= karg.dataOutSize;
21022108
bufOut.len = karg.dataOutSize;
2103-
bufOut.kptr = pci_alloc_consistent(
2104-
ioc->pcidev, bufOut.len, &dma_addr_out);
2109+
bufOut.kptr = dma_alloc_coherent(&ioc->pcidev->dev,
2110+
bufOut.len,
2111+
&dma_addr_out, GFP_KERNEL);
21052112

21062113
if (bufOut.kptr == NULL) {
21072114
rc = -ENOMEM;
@@ -2134,8 +2141,9 @@ mptctl_do_mpt_command (MPT_ADAPTER *ioc, struct mpt_ioctl_command karg, void __u
21342141
flagsLength |= karg.dataInSize;
21352142

21362143
bufIn.len = karg.dataInSize;
2137-
bufIn.kptr = pci_alloc_consistent(ioc->pcidev,
2138-
bufIn.len, &dma_addr_in);
2144+
bufIn.kptr = dma_alloc_coherent(&ioc->pcidev->dev,
2145+
bufIn.len,
2146+
&dma_addr_in, GFP_KERNEL);
21392147

21402148
if (bufIn.kptr == NULL) {
21412149
rc = -ENOMEM;
@@ -2283,13 +2291,13 @@ mptctl_do_mpt_command (MPT_ADAPTER *ioc, struct mpt_ioctl_command karg, void __u
22832291
/* Free the allocated memory.
22842292
*/
22852293
if (bufOut.kptr != NULL) {
2286-
pci_free_consistent(ioc->pcidev,
2287-
bufOut.len, (void *) bufOut.kptr, dma_addr_out);
2294+
dma_free_coherent(&ioc->pcidev->dev, bufOut.len,
2295+
(void *)bufOut.kptr, dma_addr_out);
22882296
}
22892297

22902298
if (bufIn.kptr != NULL) {
2291-
pci_free_consistent(ioc->pcidev,
2292-
bufIn.len, (void *) bufIn.kptr, dma_addr_in);
2299+
dma_free_coherent(&ioc->pcidev->dev, bufIn.len,
2300+
(void *)bufIn.kptr, dma_addr_in);
22932301
}
22942302

22952303
/* mf is null if command issued successfully
@@ -2395,7 +2403,9 @@ mptctl_hp_hostinfo(MPT_ADAPTER *ioc, unsigned long arg, unsigned int data_size)
23952403
/* Issue the second config page request */
23962404
cfg.action = MPI_CONFIG_ACTION_PAGE_READ_CURRENT;
23972405

2398-
pbuf = pci_alloc_consistent(ioc->pcidev, hdr.PageLength * 4, &buf_dma);
2406+
pbuf = dma_alloc_coherent(&ioc->pcidev->dev,
2407+
hdr.PageLength * 4,
2408+
&buf_dma, GFP_KERNEL);
23992409
if (pbuf) {
24002410
cfg.physAddr = buf_dma;
24012411
if (mpt_config(ioc, &cfg) == 0) {
@@ -2405,7 +2415,9 @@ mptctl_hp_hostinfo(MPT_ADAPTER *ioc, unsigned long arg, unsigned int data_size)
24052415
pdata->BoardTracerNumber, 24);
24062416
}
24072417
}
2408-
pci_free_consistent(ioc->pcidev, hdr.PageLength * 4, pbuf, buf_dma);
2418+
dma_free_coherent(&ioc->pcidev->dev,
2419+
hdr.PageLength * 4, pbuf,
2420+
buf_dma);
24092421
pbuf = NULL;
24102422
}
24112423
}
@@ -2470,7 +2482,7 @@ mptctl_hp_hostinfo(MPT_ADAPTER *ioc, unsigned long arg, unsigned int data_size)
24702482
else
24712483
IstwiRWRequest->DeviceAddr = 0xB0;
24722484

2473-
pbuf = pci_alloc_consistent(ioc->pcidev, 4, &buf_dma);
2485+
pbuf = dma_alloc_coherent(&ioc->pcidev->dev, 4, &buf_dma, GFP_KERNEL);
24742486
if (!pbuf)
24752487
goto out;
24762488
ioc->add_sge((char *)&IstwiRWRequest->SGL,
@@ -2519,7 +2531,7 @@ mptctl_hp_hostinfo(MPT_ADAPTER *ioc, unsigned long arg, unsigned int data_size)
25192531
SET_MGMT_MSG_CONTEXT(ioc->ioctl_cmds.msg_context, 0);
25202532

25212533
if (pbuf)
2522-
pci_free_consistent(ioc->pcidev, 4, pbuf, buf_dma);
2534+
dma_free_coherent(&ioc->pcidev->dev, 4, pbuf, buf_dma);
25232535

25242536
/* Copy the data from kernel memory to user memory
25252537
*/
@@ -2585,7 +2597,8 @@ mptctl_hp_targetinfo(MPT_ADAPTER *ioc, unsigned long arg)
25852597
/* Get the data transfer speeds
25862598
*/
25872599
data_sz = ioc->spi_data.sdp0length * 4;
2588-
pg0_alloc = pci_alloc_consistent(ioc->pcidev, data_sz, &page_dma);
2600+
pg0_alloc = dma_alloc_coherent(&ioc->pcidev->dev, data_sz, &page_dma,
2601+
GFP_KERNEL);
25892602
if (pg0_alloc) {
25902603
hdr.PageVersion = ioc->spi_data.sdp0version;
25912604
hdr.PageLength = data_sz;
@@ -2623,7 +2636,8 @@ mptctl_hp_targetinfo(MPT_ADAPTER *ioc, unsigned long arg)
26232636
karg.negotiated_speed = HP_DEV_SPEED_ASYNC;
26242637
}
26252638

2626-
pci_free_consistent(ioc->pcidev, data_sz, (u8 *) pg0_alloc, page_dma);
2639+
dma_free_coherent(&ioc->pcidev->dev, data_sz, (u8 *)pg0_alloc,
2640+
page_dma);
26272641
}
26282642

26292643
/* Set defaults
@@ -2649,7 +2663,8 @@ mptctl_hp_targetinfo(MPT_ADAPTER *ioc, unsigned long arg)
26492663
/* Issue the second config page request */
26502664
cfg.action = MPI_CONFIG_ACTION_PAGE_READ_CURRENT;
26512665
data_sz = (int) cfg.cfghdr.hdr->PageLength * 4;
2652-
pg3_alloc = pci_alloc_consistent(ioc->pcidev, data_sz, &page_dma);
2666+
pg3_alloc = dma_alloc_coherent(&ioc->pcidev->dev, data_sz,
2667+
&page_dma, GFP_KERNEL);
26532668
if (pg3_alloc) {
26542669
cfg.physAddr = page_dma;
26552670
cfg.pageAddr = (karg.hdr.channel << 8) | karg.hdr.id;
@@ -2658,7 +2673,8 @@ mptctl_hp_targetinfo(MPT_ADAPTER *ioc, unsigned long arg)
26582673
karg.phase_errors = (u32) le16_to_cpu(pg3_alloc->PhaseErrorCount);
26592674
karg.parity_errors = (u32) le16_to_cpu(pg3_alloc->ParityErrorCount);
26602675
}
2661-
pci_free_consistent(ioc->pcidev, data_sz, (u8 *) pg3_alloc, page_dma);
2676+
dma_free_coherent(&ioc->pcidev->dev, data_sz,
2677+
(u8 *)pg3_alloc, page_dma);
26622678
}
26632679
}
26642680
hd = shost_priv(ioc->sh);

0 commit comments

Comments
 (0)