Re: [PATCH 5/9] i2c: move twl4030-usb to platform_device

David Brownell
2008-09-28T01:01:16Z

On Friday 26 Septemb.er 2008, Felipe Balbi wrote:
> +       if (twl_has_usb() && pdata->usb) {
> +               pdev = platform_device_alloc("twl4030_usb", -1);
> +               if (pdev) {
> +                       twl = &twl4030_modules[TWL4030_SLAVENUM_NUM0];
> +                       pdev->dev.parent = &twl->client->dev;
> +                       device_init_wakeup(&pdev->dev, 1);
> +                       status = platform_device_add_data(pdev, pdata->usb,
> +                                       sizeof(*pdata->usb));
> +                       if (status < 0) {
> +                               platform_device_put(pdev);
> +                               goto err;
> +                       }
> +                       status = platform_device_add(pdev);
> +                       if (status < 0)
> +                               platform_device_put(pdev);
> +               } else {
> +                       status = -ENOMEM;
> +                       goto err;
> +               }
> +       }

I notice that here -- and elsewhere! -- you're not adding an IRQ
resource. We should get rid of the TWL4030_MODIRQ_* and *_PWRIRQ_*
symbols ... I think you'll observe that the twl_has_gpio() branch
is a slightly better model than the original twl_has_rtc() code,
in terms of how to add each child that uses interrupts.

In this case you can add an IRQ resource 4 more than the base IRQ
(GPIO using 0 more), switch the relevant USB code over so that it's
using platform_get_irq(), and comment out TWL4030_MODIRQ_USB in
the header (now that nobody's using it).

I'll send a small IRQ cleanup patch doing that for the RTC in a
bit, after I sanity check it.

- Dave

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html