.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
---|
1 | 2 | /* |
---|
2 | 3 | * Copyright (C) 2002 Intersil Americas Inc. |
---|
3 | 4 | * Copyright (C) 2003 Herbert Valerio Riedel <hvr@gnu.org> |
---|
4 | 5 | * Copyright (C) 2003 Luis R. Rodriguez <mcgrof@ruslug.rutgers.edu> |
---|
5 | | - * |
---|
6 | | - * This program is free software; you can redistribute it and/or modify |
---|
7 | | - * it under the terms of the GNU General Public License as published by |
---|
8 | | - * the Free Software Foundation; either version 2 of the License |
---|
9 | | - * |
---|
10 | | - * This program is distributed in the hope that it will be useful, |
---|
11 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
12 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
13 | | - * GNU General Public License for more details. |
---|
14 | | - * |
---|
15 | | - * You should have received a copy of the GNU General Public License |
---|
16 | | - * along with this program; if not, see <http://www.gnu.org/licenses/>. |
---|
17 | | - * |
---|
18 | 6 | */ |
---|
19 | 7 | |
---|
20 | 8 | #include <linux/hardirq.h> |
---|
.. | .. |
---|
648 | 636 | */ |
---|
649 | 637 | |
---|
650 | 638 | /* perform the allocation */ |
---|
651 | | - priv->driver_mem_address = pci_alloc_consistent(priv->pdev, |
---|
652 | | - HOST_MEM_BLOCK, |
---|
653 | | - &priv-> |
---|
654 | | - device_host_address); |
---|
| 639 | + priv->driver_mem_address = dma_alloc_coherent(&priv->pdev->dev, |
---|
| 640 | + HOST_MEM_BLOCK, |
---|
| 641 | + &priv->device_host_address, |
---|
| 642 | + GFP_KERNEL); |
---|
655 | 643 | |
---|
656 | 644 | if (!priv->driver_mem_address) { |
---|
657 | 645 | /* error allocating the block of PCI memory */ |
---|
.. | .. |
---|
704 | 692 | |
---|
705 | 693 | /* map the allocated skb data area to pci */ |
---|
706 | 694 | priv->pci_map_rx_address[counter] = |
---|
707 | | - pci_map_single(priv->pdev, (void *) skb->data, |
---|
708 | | - MAX_FRAGMENT_SIZE_RX + 2, |
---|
709 | | - PCI_DMA_FROMDEVICE); |
---|
710 | | - if (pci_dma_mapping_error(priv->pdev, |
---|
711 | | - priv->pci_map_rx_address[counter])) { |
---|
| 695 | + dma_map_single(&priv->pdev->dev, (void *)skb->data, |
---|
| 696 | + MAX_FRAGMENT_SIZE_RX + 2, DMA_FROM_DEVICE); |
---|
| 697 | + if (dma_mapping_error(&priv->pdev->dev, priv->pci_map_rx_address[counter])) { |
---|
712 | 698 | priv->pci_map_rx_address[counter] = 0; |
---|
713 | 699 | /* error mapping the buffer to device |
---|
714 | 700 | accessible memory address */ |
---|
.. | .. |
---|
739 | 725 | |
---|
740 | 726 | /* free consistent DMA area... */ |
---|
741 | 727 | if (priv->driver_mem_address) |
---|
742 | | - pci_free_consistent(priv->pdev, HOST_MEM_BLOCK, |
---|
743 | | - priv->driver_mem_address, |
---|
744 | | - priv->device_host_address); |
---|
| 728 | + dma_free_coherent(&priv->pdev->dev, HOST_MEM_BLOCK, |
---|
| 729 | + priv->driver_mem_address, |
---|
| 730 | + priv->device_host_address); |
---|
745 | 731 | |
---|
746 | 732 | /* clear some dangling pointers */ |
---|
747 | 733 | priv->driver_mem_address = NULL; |
---|
.. | .. |
---|
753 | 739 | for (counter = 0; counter < ISL38XX_CB_MGMT_QSIZE; counter++) { |
---|
754 | 740 | struct islpci_membuf *buf = &priv->mgmt_rx[counter]; |
---|
755 | 741 | if (buf->pci_addr) |
---|
756 | | - pci_unmap_single(priv->pdev, buf->pci_addr, |
---|
757 | | - buf->size, PCI_DMA_FROMDEVICE); |
---|
| 742 | + dma_unmap_single(&priv->pdev->dev, buf->pci_addr, |
---|
| 743 | + buf->size, DMA_FROM_DEVICE); |
---|
758 | 744 | buf->pci_addr = 0; |
---|
759 | 745 | kfree(buf->mem); |
---|
760 | 746 | buf->size = 0; |
---|
.. | .. |
---|
764 | 750 | /* clean up data rx buffers */ |
---|
765 | 751 | for (counter = 0; counter < ISL38XX_CB_RX_QSIZE; counter++) { |
---|
766 | 752 | if (priv->pci_map_rx_address[counter]) |
---|
767 | | - pci_unmap_single(priv->pdev, |
---|
| 753 | + dma_unmap_single(&priv->pdev->dev, |
---|
768 | 754 | priv->pci_map_rx_address[counter], |
---|
769 | 755 | MAX_FRAGMENT_SIZE_RX + 2, |
---|
770 | | - PCI_DMA_FROMDEVICE); |
---|
| 756 | + DMA_FROM_DEVICE); |
---|
771 | 757 | priv->pci_map_rx_address[counter] = 0; |
---|
772 | 758 | |
---|
773 | 759 | if (priv->data_low_rx[counter]) |
---|
.. | .. |
---|
932 | 918 | switch (new_state) { |
---|
933 | 919 | case PRV_STATE_OFF: |
---|
934 | 920 | priv->state_off++; |
---|
| 921 | + fallthrough; |
---|
935 | 922 | default: |
---|
936 | 923 | priv->state = new_state; |
---|
937 | 924 | break; |
---|