Re: [PATCH v9 5/5] usb: dwc3: core: cleanup IRQ resources

From: Felipe Balbi
Date: Fri Jun 10 2016 - 05:19:32 EST



Hi,

Roger Quadros <rogerq@xxxxxx> writes:
> On 10/06/16 11:18, Felipe Balbi wrote:
>>
>> Hi,
>>
>> Roger Quadros <rogerq@xxxxxx> writes:
>>>> 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 correct
>>
> np :).
>
> 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

Attachment: signature.asc
Description: PGP signature