Skip to content

Commit 2ef4bb2

Browse files
Minghao ChiDominik Brodowski
authored andcommitted
pcmcia: Use platform_get_irq() to get the interrupt
It is not recommened to use platform_get_resource(pdev, IORESOURCE_IRQ) for requesting IRQ's resources any more, as they can be not ready yet in case of DT-booting. platform_get_irq() instead is a recommended way for getting IRQ even if it was not retrieved earlier. It also makes code simpler because we're getting "int" value right away and no conversion from resource to int is required. Reported-by: Zeal Robot <[email protected]> Signed-off-by: Minghao Chi <[email protected]> Signed-off-by: Dominik Brodowski <[email protected]>
1 parent 3928cf0 commit 2ef4bb2

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

drivers/pcmcia/bcm63xx_pcmcia.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -327,10 +327,11 @@ static int bcm63xx_drv_pcmcia_probe(struct platform_device *pdev)
327327
{
328328
struct bcm63xx_pcmcia_socket *skt;
329329
struct pcmcia_socket *sock;
330-
struct resource *res, *irq_res;
330+
struct resource *res;
331331
unsigned int regmem_size = 0, iomem_size = 0;
332332
u32 val;
333333
int ret;
334+
int irq;
334335

335336
skt = kzalloc(sizeof(*skt), GFP_KERNEL);
336337
if (!skt)
@@ -342,9 +343,9 @@ static int bcm63xx_drv_pcmcia_probe(struct platform_device *pdev)
342343
/* make sure we have all resources we need */
343344
skt->common_res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
344345
skt->attr_res = platform_get_resource(pdev, IORESOURCE_MEM, 2);
345-
irq_res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
346+
irq = platform_get_irq(pdev, 0);
346347
skt->pd = pdev->dev.platform_data;
347-
if (!skt->common_res || !skt->attr_res || !irq_res || !skt->pd) {
348+
if (!skt->common_res || !skt->attr_res || (irq < 0) || !skt->pd) {
348349
ret = -EINVAL;
349350
goto err;
350351
}
@@ -380,7 +381,7 @@ static int bcm63xx_drv_pcmcia_probe(struct platform_device *pdev)
380381
sock->dev.parent = &pdev->dev;
381382
sock->features = SS_CAP_STATIC_MAP | SS_CAP_PCCARD;
382383
sock->io_offset = (unsigned long)skt->io_base;
383-
sock->pci_irq = irq_res->start;
384+
sock->pci_irq = irq;
384385

385386
#ifdef CONFIG_CARDBUS
386387
sock->cb_dev = bcm63xx_cb_dev;

0 commit comments

Comments
 (0)