hc
2024-02-20 102a0743326a03cd1a1202ceda21e175b7d3575c
kernel/drivers/scsi/nsp32.c
....@@ -1,19 +1,9 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * NinjaSCSI-32Bi Cardbus, NinjaSCSI-32UDE PCI/CardBus SCSI driver
34 * Copyright (C) 2001, 2002, 2003
45 * YOKOTA Hiroshi <yokota@netlab.is.tsukuba.ac.jp>
56 * GOTO Masanori <gotom@debian.or.jp>, <gotom@debian.org>
6
- *
7
- * This program is free software; you can redistribute it and/or modify
8
- * it under the terms of the GNU General Public License as published by
9
- * the Free Software Foundation; either version 2, or (at your option)
10
- * any later version.
11
- *
12
- * This program is distributed in the hope that it will be useful,
13
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
- * GNU General Public License for more details.
16
- *
177 *
188 * Revision History:
199 * 1.0: Initial Release.
....@@ -274,7 +264,7 @@
274264 .sg_tablesize = NSP32_SG_SIZE,
275265 .max_sectors = 128,
276266 .this_id = NSP32_HOST_SCSIID,
277
- .use_clustering = DISABLE_CLUSTERING,
267
+ .dma_boundary = PAGE_SIZE - 1,
278268 .eh_abort_handler = nsp32_eh_abort,
279269 .eh_host_reset_handler = nsp32_eh_host_reset,
280270 /* .highmem_io = 1, */
....@@ -1257,7 +1247,7 @@
12571247 * ---> AutoSCSI with MSGOUTreg is processed.
12581248 */
12591249 data->msgout_len = 0;
1260
- };
1250
+ }
12611251
12621252 nsp32_dbg(NSP32_DEBUG_INTR, "MsgOut phase processed");
12631253 }
....@@ -1552,7 +1542,7 @@
15521542 * with ACK reply when below condition is matched:
15531543 * MsgIn 00: Command Complete.
15541544 * MsgIn 02: Save Data Pointer.
1555
- * MsgIn 04: Diconnect.
1545
+ * MsgIn 04: Disconnect.
15561546 * In other case, unexpected BUSFREE is detected.
15571547 */
15581548 static int nsp32_busfree_occur(struct scsi_cmnd *SCpnt, unsigned short execph)
....@@ -1849,7 +1839,7 @@
18491839
18501840 nsp32_dbg(NSP32_DEBUG_MSGOUTOCCUR, "bus: 0x%x\n",
18511841 nsp32_read1(base, SCSI_BUS_MONITOR));
1852
- };
1842
+ }
18531843
18541844 data->msgout_len = 0;
18551845
....@@ -2441,7 +2431,6 @@
24412431
24422432 period = data->synct[entry].period_num;
24432433 ackwidth = data->synct[entry].ackwidth;
2444
- offset = offset;
24452434 sample_rate = data->synct[entry].sample_rate;
24462435
24472436 target->syncreg = TO_SYNCREG(period, offset);
....@@ -2638,7 +2627,7 @@
26382627 /*
26392628 * setup DMA
26402629 */
2641
- if (pci_set_dma_mask(pdev, DMA_BIT_MASK(32)) != 0) {
2630
+ if (dma_set_mask(&pdev->dev, DMA_BIT_MASK(32)) != 0) {
26422631 nsp32_msg (KERN_ERR, "failed to set PCI DMA mask");
26432632 goto scsi_unregister;
26442633 }
....@@ -2646,7 +2635,9 @@
26462635 /*
26472636 * allocate autoparam DMA resource.
26482637 */
2649
- data->autoparam = pci_alloc_consistent(pdev, sizeof(nsp32_autoparam), &(data->auto_paddr));
2638
+ data->autoparam = dma_alloc_coherent(&pdev->dev,
2639
+ sizeof(nsp32_autoparam), &(data->auto_paddr),
2640
+ GFP_KERNEL);
26502641 if (data->autoparam == NULL) {
26512642 nsp32_msg(KERN_ERR, "failed to allocate DMA memory");
26522643 goto scsi_unregister;
....@@ -2655,8 +2646,8 @@
26552646 /*
26562647 * allocate scatter-gather DMA resource.
26572648 */
2658
- data->sg_list = pci_alloc_consistent(pdev, NSP32_SG_TABLE_SIZE,
2659
- &(data->sg_paddr));
2649
+ data->sg_list = dma_alloc_coherent(&pdev->dev, NSP32_SG_TABLE_SIZE,
2650
+ &data->sg_paddr, GFP_KERNEL);
26602651 if (data->sg_list == NULL) {
26612652 nsp32_msg(KERN_ERR, "failed to allocate DMA memory");
26622653 goto free_autoparam;
....@@ -2761,11 +2752,11 @@
27612752 free_irq(host->irq, data);
27622753
27632754 free_sg_list:
2764
- pci_free_consistent(pdev, NSP32_SG_TABLE_SIZE,
2755
+ dma_free_coherent(&pdev->dev, NSP32_SG_TABLE_SIZE,
27652756 data->sg_list, data->sg_paddr);
27662757
27672758 free_autoparam:
2768
- pci_free_consistent(pdev, sizeof(nsp32_autoparam),
2759
+ dma_free_coherent(&pdev->dev, sizeof(nsp32_autoparam),
27692760 data->autoparam, data->auto_paddr);
27702761
27712762 scsi_unregister:
....@@ -2780,12 +2771,12 @@
27802771 nsp32_hw_data *data = (nsp32_hw_data *)host->hostdata;
27812772
27822773 if (data->autoparam) {
2783
- pci_free_consistent(data->Pci, sizeof(nsp32_autoparam),
2774
+ dma_free_coherent(&data->Pci->dev, sizeof(nsp32_autoparam),
27842775 data->autoparam, data->auto_paddr);
27852776 }
27862777
27872778 if (data->sg_list) {
2788
- pci_free_consistent(data->Pci, NSP32_SG_TABLE_SIZE,
2779
+ dma_free_coherent(&data->Pci->dev, NSP32_SG_TABLE_SIZE,
27892780 data->sg_list, data->sg_paddr);
27902781 }
27912782