hc
2023-12-09 b22da3d8526a935aa31e086e63f60ff3246cb61c
kernel/drivers/net/wireless/intersil/prism54/islpci_dev.c
....@@ -1,20 +1,8 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * Copyright (C) 2002 Intersil Americas Inc.
34 * Copyright (C) 2003 Herbert Valerio Riedel <hvr@gnu.org>
45 * 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
- *
186 */
197
208 #include <linux/hardirq.h>
....@@ -648,10 +636,10 @@
648636 */
649637
650638 /* 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);
655643
656644 if (!priv->driver_mem_address) {
657645 /* error allocating the block of PCI memory */
....@@ -704,11 +692,9 @@
704692
705693 /* map the allocated skb data area to pci */
706694 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])) {
712698 priv->pci_map_rx_address[counter] = 0;
713699 /* error mapping the buffer to device
714700 accessible memory address */
....@@ -739,9 +725,9 @@
739725
740726 /* free consistent DMA area... */
741727 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);
745731
746732 /* clear some dangling pointers */
747733 priv->driver_mem_address = NULL;
....@@ -753,8 +739,8 @@
753739 for (counter = 0; counter < ISL38XX_CB_MGMT_QSIZE; counter++) {
754740 struct islpci_membuf *buf = &priv->mgmt_rx[counter];
755741 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);
758744 buf->pci_addr = 0;
759745 kfree(buf->mem);
760746 buf->size = 0;
....@@ -764,10 +750,10 @@
764750 /* clean up data rx buffers */
765751 for (counter = 0; counter < ISL38XX_CB_RX_QSIZE; counter++) {
766752 if (priv->pci_map_rx_address[counter])
767
- pci_unmap_single(priv->pdev,
753
+ dma_unmap_single(&priv->pdev->dev,
768754 priv->pci_map_rx_address[counter],
769755 MAX_FRAGMENT_SIZE_RX + 2,
770
- PCI_DMA_FROMDEVICE);
756
+ DMA_FROM_DEVICE);
771757 priv->pci_map_rx_address[counter] = 0;
772758
773759 if (priv->data_low_rx[counter])
....@@ -932,6 +918,7 @@
932918 switch (new_state) {
933919 case PRV_STATE_OFF:
934920 priv->state_off++;
921
+ fallthrough;
935922 default:
936923 priv->state = new_state;
937924 break;