Skip to content

Commit 03dcede

Browse files
Philipp StannerJiri Kosina
authored andcommitted
HID: intel-thc-hid: Remove deprecated PCI API calls
intel-thc-hid reintroduced the already deprecated PCI API functions pcim_iomap_table(), pcim_iomap_regions(), pcim_iounmap_regions(), none of which should be used anymore. Furthermore, calling managed (pcim_*) functions in remove() and probe() for cleanup is not necessary, since the managed functions clean up automatically. Replace / remove the deprecated functions. Fixes: 61bb271 ("HID: intel-thc-hid: intel-quicki2c: Add THC QuickI2C driver skeleton") Signed-off-by: Philipp Stanner <phasta@kernel.org> Reviewed-by: Even Xu <even.xu@intel.com> Signed-off-by: Jiri Kosina <jkosina@suse.com>
1 parent 27c0278 commit 03dcede

File tree

2 files changed

+10
-18
lines changed

2 files changed

+10
-18
lines changed

drivers/hid/intel-thc-hid/intel-quicki2c/pci-quicki2c.c

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -557,28 +557,27 @@ static int quicki2c_probe(struct pci_dev *pdev,
557557

558558
pci_set_master(pdev);
559559

560-
ret = pcim_iomap_regions(pdev, BIT(0), KBUILD_MODNAME);
560+
mem_addr = pcim_iomap_region(pdev, 0, KBUILD_MODNAME);
561+
ret = PTR_ERR_OR_ZERO(mem_addr);
561562
if (ret) {
562563
dev_err_once(&pdev->dev, "Failed to get PCI regions, ret = %d.\n", ret);
563564
goto disable_pci_device;
564565
}
565566

566-
mem_addr = pcim_iomap_table(pdev)[0];
567-
568567
ret = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64));
569568
if (ret) {
570569
ret = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
571570
if (ret) {
572571
dev_err_once(&pdev->dev, "No usable DMA configuration %d\n", ret);
573-
goto unmap_io_region;
572+
goto disable_pci_device;
574573
}
575574
}
576575

577576
ret = pci_alloc_irq_vectors(pdev, 1, 1, PCI_IRQ_ALL_TYPES);
578577
if (ret < 0) {
579578
dev_err_once(&pdev->dev,
580579
"Failed to allocate IRQ vectors. ret = %d\n", ret);
581-
goto unmap_io_region;
580+
goto disable_pci_device;
582581
}
583582

584583
pdev->irq = pci_irq_vector(pdev, 0);
@@ -587,7 +586,7 @@ static int quicki2c_probe(struct pci_dev *pdev,
587586
if (IS_ERR(qcdev)) {
588587
dev_err_once(&pdev->dev, "QuickI2C device init failed\n");
589588
ret = PTR_ERR(qcdev);
590-
goto unmap_io_region;
589+
goto disable_pci_device;
591590
}
592591

593592
pci_set_drvdata(pdev, qcdev);
@@ -666,8 +665,6 @@ static int quicki2c_probe(struct pci_dev *pdev,
666665
quicki2c_dma_deinit(qcdev);
667666
dev_deinit:
668667
quicki2c_dev_deinit(qcdev);
669-
unmap_io_region:
670-
pcim_iounmap_regions(pdev, BIT(0));
671668
disable_pci_device:
672669
pci_clear_master(pdev);
673670

@@ -697,7 +694,6 @@ static void quicki2c_remove(struct pci_dev *pdev)
697694

698695
quicki2c_dev_deinit(qcdev);
699696

700-
pcim_iounmap_regions(pdev, BIT(0));
701697
pci_clear_master(pdev);
702698
}
703699

drivers/hid/intel-thc-hid/intel-quickspi/pci-quickspi.c

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -575,28 +575,27 @@ static int quickspi_probe(struct pci_dev *pdev,
575575

576576
pci_set_master(pdev);
577577

578-
ret = pcim_iomap_regions(pdev, BIT(0), KBUILD_MODNAME);
578+
mem_addr = pcim_iomap_region(pdev, 0, KBUILD_MODNAME);
579+
ret = PTR_ERR_OR_ZERO(mem_addr);
579580
if (ret) {
580581
dev_err(&pdev->dev, "Failed to get PCI regions, ret = %d.\n", ret);
581582
goto disable_pci_device;
582583
}
583584

584-
mem_addr = pcim_iomap_table(pdev)[0];
585-
586585
ret = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64));
587586
if (ret) {
588587
ret = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
589588
if (ret) {
590589
dev_err(&pdev->dev, "No usable DMA configuration %d\n", ret);
591-
goto unmap_io_region;
590+
goto disable_pci_device;
592591
}
593592
}
594593

595594
ret = pci_alloc_irq_vectors(pdev, 1, 1, PCI_IRQ_ALL_TYPES);
596595
if (ret < 0) {
597596
dev_err(&pdev->dev,
598597
"Failed to allocate IRQ vectors. ret = %d\n", ret);
599-
goto unmap_io_region;
598+
goto disable_pci_device;
600599
}
601600

602601
pdev->irq = pci_irq_vector(pdev, 0);
@@ -605,7 +604,7 @@ static int quickspi_probe(struct pci_dev *pdev,
605604
if (IS_ERR(qsdev)) {
606605
dev_err(&pdev->dev, "QuickSPI device init failed\n");
607606
ret = PTR_ERR(qsdev);
608-
goto unmap_io_region;
607+
goto disable_pci_device;
609608
}
610609

611610
pci_set_drvdata(pdev, qsdev);
@@ -668,8 +667,6 @@ static int quickspi_probe(struct pci_dev *pdev,
668667
quickspi_dma_deinit(qsdev);
669668
dev_deinit:
670669
quickspi_dev_deinit(qsdev);
671-
unmap_io_region:
672-
pcim_iounmap_regions(pdev, BIT(0));
673670
disable_pci_device:
674671
pci_clear_master(pdev);
675672

@@ -699,7 +696,6 @@ static void quickspi_remove(struct pci_dev *pdev)
699696

700697
quickspi_dev_deinit(qsdev);
701698

702-
pcim_iounmap_regions(pdev, BIT(0));
703699
pci_clear_master(pdev);
704700
}
705701

0 commit comments

Comments
 (0)