Skip to content

Commit a4af122

Browse files
nehebdamien-lemoal
authored andcommitted
ata: sata_dwc_460ex: use platform_get_irq()
Replace irq_of_parse_and_map() with platform_get_irq() in both sata_dwc_dma_init_old() and sata_dwc_probe(). This is the preferred way to obtain IRQs for platform devices and provides better error reporting. Remove the now-unnecessary #include <linux/of_irq.h>. irq_of_parse_and_map() requires irq_dispose_mapping(), which is missing. Also fix unused variable when CONFIG_SATA_DWC_OLD_DMA is disabled. Fixes: 6293600 ("[libata] Add 460EX on-chip SATA driver, sata_dwc_460ex") Assisted-by: opencode:big-pickle Signed-off-by: Rosen Penev <rosenp@gmail.com> Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
1 parent 4bbc16a commit a4af122

1 file changed

Lines changed: 7 additions & 14 deletions

File tree

drivers/ata/sata_dwc_460ex.c

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
#include <linux/device.h>
2020
#include <linux/dmaengine.h>
2121
#include <linux/of.h>
22-
#include <linux/of_irq.h>
2322
#include <linux/platform_device.h>
2423
#include <linux/phy/phy.h>
2524
#include <linux/libata.h>
@@ -226,7 +225,6 @@ static int sata_dwc_dma_init_old(struct platform_device *pdev,
226225
struct sata_dwc_device *hsdev)
227226
{
228227
struct device *dev = &pdev->dev;
229-
struct device_node *np = dev->of_node;
230228

231229
hsdev->dma = devm_kzalloc(dev, sizeof(*hsdev->dma), GFP_KERNEL);
232230
if (!hsdev->dma)
@@ -236,11 +234,9 @@ static int sata_dwc_dma_init_old(struct platform_device *pdev,
236234
hsdev->dma->id = pdev->id;
237235

238236
/* Get SATA DMA interrupt number */
239-
hsdev->dma->irq = irq_of_parse_and_map(np, 1);
240-
if (!hsdev->dma->irq) {
241-
dev_err(dev, "no SATA DMA irq\n");
242-
return -ENODEV;
243-
}
237+
hsdev->dma->irq = platform_get_irq(pdev, 1);
238+
if (hsdev->dma->irq < 0)
239+
return hsdev->dma->irq;
244240

245241
/* Get physical SATA DMA register base address */
246242
hsdev->dma->regs = devm_platform_ioremap_resource(pdev, 1);
@@ -1126,7 +1122,6 @@ static const struct ata_port_info sata_dwc_port_info[] = {
11261122
static int sata_dwc_probe(struct platform_device *ofdev)
11271123
{
11281124
struct device *dev = &ofdev->dev;
1129-
struct device_node *np = dev->of_node;
11301125
struct sata_dwc_device *hsdev;
11311126
u32 idr, versionr;
11321127
char *ver = (char *)&versionr;
@@ -1170,14 +1165,12 @@ static int sata_dwc_probe(struct platform_device *ofdev)
11701165
hsdev->dev = dev;
11711166

11721167
/* Get SATA interrupt number */
1173-
irq = irq_of_parse_and_map(np, 0);
1174-
if (!irq) {
1175-
dev_err(dev, "no SATA DMA irq\n");
1176-
return -ENODEV;
1177-
}
1168+
irq = platform_get_irq(ofdev, 0);
1169+
if (irq < 0)
1170+
return irq;
11781171

11791172
#ifdef CONFIG_SATA_DWC_OLD_DMA
1180-
if (!of_property_present(np, "dmas")) {
1173+
if (!of_property_present(dev->of_node, "dmas")) {
11811174
err = sata_dwc_dma_init_old(ofdev, hsdev);
11821175
if (err)
11831176
return err;

0 commit comments

Comments
 (0)