[PATCH 3/4] PM / Domains: Improve error handling while adding/removing devices

Geert Uytterhoeven geert at linux-m68k.org
Tue Nov 4 23:47:50 PST 2014


On Tue, Oct 28, 2014 at 3:38 PM, Ulf Hansson <ulf.hansson at linaro.org> wrote:
> --- a/drivers/base/power/domain.c
> +++ b/drivers/base/power/domain.c
> @@ -1358,25 +1358,81 @@ EXPORT_SYMBOL_GPL(pm_genpd_syscore_poweron);
>
>  #endif /* CONFIG_PM_SLEEP */
>
> -static struct generic_pm_domain_data *__pm_genpd_alloc_dev_data(struct device *dev)
> +static int genpd_alloc_dev_data(struct generic_pm_domain *genpd,
> +                               struct device *dev, struct gpd_timing_data *td)
>  {

[...]

> +       if (genpd->attach_dev)
> +               genpd->attach_dev(dev);

Note that dev->pm_domain is not yet set at this point, so the callee
can no longer
know to which domain the device is being attached.
Should we re-add the parameter, or move the attach_dev() back to
__pm_genpd_add_device(), like Kevin suggested.

[...]

>  }

>  /**
> @@ -1388,7 +1444,7 @@ static void __pm_genpd_free_dev_data(struct device *dev,
>  int __pm_genpd_add_device(struct generic_pm_domain *genpd, struct device *dev,
>                           struct gpd_timing_data *td)
>  {

[...]

> -       ret = dev_pm_get_subsys_data(dev);
> +       ret = genpd_alloc_dev_data(genpd, dev, td);

[...]

>         dev->pm_domain = &genpd->domain;
> -
> +       gpd_data = to_gpd_data(dev->power.subsys_data->domain_data);
>         spin_unlock_irq(&dev->power.lock);
>
> -       if (genpd->attach_dev)
> -               genpd->attach_dev(dev);
> -

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert at linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds



More information about the linux-arm-kernel mailing list