| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Copyright (C) 2002 Intersil Americas Inc. |
|---|
| 3 | 4 | * 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 | | - * |
|---|
| 17 | 5 | */ |
|---|
| 18 | 6 | |
|---|
| 19 | 7 | #include <linux/netdevice.h> |
|---|
| .. | .. |
|---|
| 127 | 115 | buf->size = MGMT_FRAME_SIZE; |
|---|
| 128 | 116 | } |
|---|
| 129 | 117 | 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, |
|---|
| 131 | 120 | 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)) { |
|---|
| 134 | 123 | printk(KERN_WARNING |
|---|
| 135 | 124 | "Failed to make memory DMA'able.\n"); |
|---|
| 136 | 125 | return -ENOMEM; |
|---|
| .. | .. |
|---|
| 215 | 204 | #endif |
|---|
| 216 | 205 | |
|---|
| 217 | 206 | 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)) { |
|---|
| 221 | 210 | printk(KERN_WARNING "%s: cannot map PCI memory for mgmt\n", |
|---|
| 222 | 211 | ndev->name); |
|---|
| 223 | 212 | goto error_free; |
|---|
| .. | .. |
|---|
| 314 | 303 | } |
|---|
| 315 | 304 | |
|---|
| 316 | 305 | /* 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); |
|---|
| 319 | 308 | |
|---|
| 320 | 309 | /* Perform endianess conversion for PIMFOR header in-place. */ |
|---|
| 321 | 310 | header = pimfor_decode_header(buf->mem, frag_len); |
|---|
| .. | .. |
|---|
| 426 | 415 | for (; priv->index_mgmt_tx < curr_frag; priv->index_mgmt_tx++) { |
|---|
| 427 | 416 | int index = priv->index_mgmt_tx % ISL38XX_CB_MGMT_QSIZE; |
|---|
| 428 | 417 | 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); |
|---|
| 431 | 420 | buf->pci_addr = 0; |
|---|
| 432 | 421 | kfree(buf->mem); |
|---|
| 433 | 422 | buf->mem = NULL; |
|---|