forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-05-13 9d77db3c730780c8ef5ccd4b66403ff5675cfe4e
kernel/drivers/net/wireless/intersil/prism54/islpci_mgt.c
....@@ -1,19 +1,7 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * Copyright (C) 2002 Intersil Americas Inc.
34 * Copyright 2004 Jens Maurer <Jens.Maurer@gmx.net>
4
- *
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License as published by
7
- * the Free Software Foundation; either version 2 of the License
8
- *
9
- * This program is distributed in the hope that it will be useful,
10
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
- * GNU General Public License for more details.
13
- *
14
- * You should have received a copy of the GNU General Public License
15
- * along with this program; if not, see <http://www.gnu.org/licenses/>.
16
- *
175 */
186
197 #include <linux/netdevice.h>
....@@ -127,10 +115,11 @@
127115 buf->size = MGMT_FRAME_SIZE;
128116 }
129117 if (buf->pci_addr == 0) {
130
- buf->pci_addr = pci_map_single(priv->pdev, buf->mem,
118
+ buf->pci_addr = dma_map_single(&priv->pdev->dev,
119
+ buf->mem,
131120 MGMT_FRAME_SIZE,
132
- PCI_DMA_FROMDEVICE);
133
- if (pci_dma_mapping_error(priv->pdev, buf->pci_addr)) {
121
+ DMA_FROM_DEVICE);
122
+ if (dma_mapping_error(&priv->pdev->dev, buf->pci_addr)) {
134123 printk(KERN_WARNING
135124 "Failed to make memory DMA'able.\n");
136125 return -ENOMEM;
....@@ -215,9 +204,9 @@
215204 #endif
216205
217206 err = -ENOMEM;
218
- buf.pci_addr = pci_map_single(priv->pdev, buf.mem, frag_len,
219
- PCI_DMA_TODEVICE);
220
- if (pci_dma_mapping_error(priv->pdev, buf.pci_addr)) {
207
+ buf.pci_addr = dma_map_single(&priv->pdev->dev, buf.mem, frag_len,
208
+ DMA_TO_DEVICE);
209
+ if (dma_mapping_error(&priv->pdev->dev, buf.pci_addr)) {
221210 printk(KERN_WARNING "%s: cannot map PCI memory for mgmt\n",
222211 ndev->name);
223212 goto error_free;
....@@ -314,8 +303,8 @@
314303 }
315304
316305 /* Ensure the results of device DMA are visible to the CPU. */
317
- pci_dma_sync_single_for_cpu(priv->pdev, buf->pci_addr,
318
- buf->size, PCI_DMA_FROMDEVICE);
306
+ dma_sync_single_for_cpu(&priv->pdev->dev, buf->pci_addr,
307
+ buf->size, DMA_FROM_DEVICE);
319308
320309 /* Perform endianess conversion for PIMFOR header in-place. */
321310 header = pimfor_decode_header(buf->mem, frag_len);
....@@ -426,8 +415,8 @@
426415 for (; priv->index_mgmt_tx < curr_frag; priv->index_mgmt_tx++) {
427416 int index = priv->index_mgmt_tx % ISL38XX_CB_MGMT_QSIZE;
428417 struct islpci_membuf *buf = &priv->mgmt_tx[index];
429
- pci_unmap_single(priv->pdev, buf->pci_addr, buf->size,
430
- PCI_DMA_TODEVICE);
418
+ dma_unmap_single(&priv->pdev->dev, buf->pci_addr, buf->size,
419
+ DMA_TO_DEVICE);
431420 buf->pci_addr = 0;
432421 kfree(buf->mem);
433422 buf->mem = NULL;