History

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.

Minghao Chi committed 4 years ago

Commit 2ef4bb21 parent 3928cf01 file · +5 −4Browse files

Unified · Split

drivers/pcmcia/bcm63xx_pcmcia.c+5−4
@@ -327,10 +327,11 @@ static int bcm63xx_drv_pcmcia_probe(struct platform_device *pdev) · 326 unmodified lines
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) · 5 unmodified lines
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) · 29 unmodified lines
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;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t