Re: [PATCH v9 5/5] usb: dwc3: core: cleanup IRQ resources
From: Felipe Balbi <balbi@kernel.org>
Date: 2016-06-10 09:19:28
Also in:
lkml
Attachments
- signature.asc [application/pgp-signature] 818 bytes
From: Felipe Balbi <balbi@kernel.org>
Date: 2016-06-10 09:19:28
Also in:
lkml
Hi, Roger Quadros [off-list ref] writes:
On 10/06/16 11:18, Felipe Balbi wrote:quoted
Hi, Roger Quadros [off-list ref] writes:quoted
quoted
dwc->xhci_resource[1] = *res;Probably not as we don't want to change parent/child members.oh, you had already replied. Sorry. This is correctnp :). So what i'll do is get the irq via platform_get_irq() and friends and if it was a success use platform_get_resource() and friends to get struct resource and just edit the relevant parts for the XHCI irq resource. Sounds OK? something like this. + int ret, irq; + struct resource *res; + struct platform_device *dwc3_pdev = to_platform_device(dwc->dev); + + irq = platform_get_irq_byname(dwc3_pdev, "host"); + if (irq == -EPROBE_DEFER) + return irq; + + if (irq <= 0) { + irq = platform_get_irq_byname(dwc3_pdev, "dwc_usb3"); + if (irq == -EPROBE_DEFER) + return irq; + + if (irq <= 0) { + irq = platform_get_irq(dwc3_pdev, 0); + if (irq <= 0) { + if (irq != -EPROBE_DEFER) { + dev_err(dwc->dev, + "missing host IRQ\n"); + } + return irq; + } else { + res = platform_get_resource(dwc3_pdev, + IORESOURCE_IRQ, 0); + } + } else { + res = platform_get_resource_byname(dwc3_pdev, + IORESOURCE_IRQ, + "dwc_usb3"); + } + + } else { + res = platform_get_resource_byname(dwc3_pdev, IORESOURCE_IRQ, + "host"); + } + + dwc->xhci_resources[1].start = irq; + dwc->xhci_resources[1].end = irq; + dwc->xhci_resources[1].flags = res->flags; + dwc->xhci_resources[1].name = res->name;
looks okay to me. -- balbi