Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

dmaengine: hsu: Finish conversion to managed resources

With help of devm_add_action_or_reset() we may finish conversion
the driver to use managed resources.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20220713172235.22611-1-andriy.shevchenko@linux.intel.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>

authored by

Andy Shevchenko and committed by
Vinod Koul
d5988dcc 69687432

+12 -15
+12 -15
drivers/dma/hsu/pci.c
··· 47 47 return IRQ_RETVAL(ret); 48 48 } 49 49 50 + static void hsu_pci_dma_remove(void *chip) 51 + { 52 + hsu_dma_remove(chip); 53 + } 54 + 50 55 static int hsu_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) 51 56 { 57 + struct device *dev = &pdev->dev; 52 58 struct hsu_dma_chip *chip; 53 59 int ret; 54 60 ··· 93 87 if (ret) 94 88 return ret; 95 89 96 - ret = request_irq(chip->irq, hsu_pci_irq, 0, "hsu_dma_pci", chip); 90 + ret = devm_add_action_or_reset(dev, hsu_pci_dma_remove, chip); 97 91 if (ret) 98 - goto err_register_irq; 92 + return ret; 93 + 94 + ret = devm_request_irq(dev, chip->irq, hsu_pci_irq, 0, "hsu_dma_pci", chip); 95 + if (ret) 96 + return ret; 99 97 100 98 /* 101 99 * On Intel Tangier B0 and Anniedale the interrupt line, disregarding ··· 115 105 pci_set_drvdata(pdev, chip); 116 106 117 107 return 0; 118 - 119 - err_register_irq: 120 - hsu_dma_remove(chip); 121 - return ret; 122 - } 123 - 124 - static void hsu_pci_remove(struct pci_dev *pdev) 125 - { 126 - struct hsu_dma_chip *chip = pci_get_drvdata(pdev); 127 - 128 - free_irq(chip->irq, chip); 129 - hsu_dma_remove(chip); 130 108 } 131 109 132 110 static const struct pci_device_id hsu_pci_id_table[] = { ··· 128 130 .name = "hsu_dma_pci", 129 131 .id_table = hsu_pci_id_table, 130 132 .probe = hsu_pci_probe, 131 - .remove = hsu_pci_remove, 132 133 }; 133 134 134 135 module_pci_driver(hsu_pci_driver);