I'm a little skeptical about dev_pm_set_dedicated_wake_irq(), not
because I know anything at all about it, but because there are only
five callers in the whole tree, three of which are in UART code, and
none in anything resembling PCI code.
Is Rockchip really that special, or are we going about this the wrong
way?
there's no need to call dev_pm_clear_wake_irq when dev_pm_set_dedicated_wake_irq failed...and i agree the device_init_wakeup part, i'll add that in the next version(with brian's comment too)
> >+ if (err)
> >+ dev_err(dev, "failed to setup PCIe wakeup IRQ\n");
> >+ }
> >+
> > return 0;
The above could be structured as:
irq = platform_get_irq_byname(pdev, "wakeup");
if (irq < 0)
return 0;
device_init_wakeup(dev, true);
err = dev_pm_set_dedicated_wake_irq(dev, irq);
if (err) {
dev_pm_clear_wake_irq(dev);
device_init_wakeup(dev, false);
}
return 0;
to unindent the mainline non-error code.
> > }
> >
> >@@ -1542,11 +1552,11 @@ static int rockchip_pcie_probe(struct platform_device *pdev)
> >
> > err = rockchip_pcie_parse_dt(rockchip);
> > if (err)
> >- return err;
> >+ goto err_disable_wake;
> >
> > err = rockchip_pcie_enable_clocks(rockchip);
> > if (err)
> >- return err;
> >+ goto err_disable_wake;
> >
> > err = rockchip_pcie_set_vpcie(rockchip);
> > if (err) {
> >@@ -1656,6 +1666,9 @@ static int rockchip_pcie_probe(struct platform_device *pdev)
> > regulator_disable(rockchip->vpcie0v9);
> > err_set_vpcie:
> > rockchip_pcie_disable_clocks(rockchip);
> >+err_disable_wake:
> >+ dev_pm_clear_wake_irq(dev);
> >+ device_init_wakeup(dev, false);
I think this error cleanup should be done in rockchip_pcie_setup_irq()
as shown above. There's no real connection between
rockchip_pcie_probe() and the wake setup.