diff mbox series

PM: domains: Fix build error for genpd notifiers

Message ID 20201020081035.563849-1-ulf.hansson@linaro.org
State New
Headers show
Series PM: domains: Fix build error for genpd notifiers | expand

Commit Message

Ulf Hansson Oct. 20, 2020, 8:10 a.m. UTC
The __raw_notifier_call_chain() was recently removed and replaced with
raw_notifier_call_chain_robust(). Recent changes to genpd didn't take that
into account, which causes a build error. Let's fix this by converting to
the raw_notifier_call_chain_robust() in genpd.

Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Lina Iyer <ilina@codeaurora.org>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
---

Rafael, feel free to to squash this into the patch "PM: domains: Add support
for PM domain on/off notifiers for genpd".

Kind regards
Uffe

---
 drivers/base/power/domain.c | 25 +++++++++++--------------
 1 file changed, 11 insertions(+), 14 deletions(-)

Comments

Rafael J. Wysocki Oct. 20, 2020, 5:44 p.m. UTC | #1
On Tue, Oct 20, 2020 at 10:10 AM Ulf Hansson <ulf.hansson@linaro.org> wrote:
>
> The __raw_notifier_call_chain() was recently removed and replaced with
> raw_notifier_call_chain_robust(). Recent changes to genpd didn't take that
> into account, which causes a build error. Let's fix this by converting to
> the raw_notifier_call_chain_robust() in genpd.
>
> Reported-by: kernel test robot <lkp@intel.com>
> Reported-by: Lina Iyer <ilina@codeaurora.org>
> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
> ---
>
> Rafael, feel free to to squash this into the patch "PM: domains: Add support
> for PM domain on/off notifiers for genpd".

Applied separately, thanks!

> ---
>  drivers/base/power/domain.c | 25 +++++++++++--------------
>  1 file changed, 11 insertions(+), 14 deletions(-)
>
> diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c
> index 859cdb207010..743268996336 100644
> --- a/drivers/base/power/domain.c
> +++ b/drivers/base/power/domain.c
> @@ -413,15 +413,15 @@ static int _genpd_power_on(struct generic_pm_domain *genpd, bool timed)
>         unsigned int state_idx = genpd->state_idx;
>         ktime_t time_start;
>         s64 elapsed_ns;
> -       int ret, nr_calls = 0;
> +       int ret;
>
>         /* Notify consumers that we are about to power on. */
> -       ret = __raw_notifier_call_chain(&genpd->power_notifiers,
> -                                       GENPD_NOTIFY_PRE_ON, NULL, -1,
> -                                       &nr_calls);
> +       ret = raw_notifier_call_chain_robust(&genpd->power_notifiers,
> +                                            GENPD_NOTIFY_PRE_ON,
> +                                            GENPD_NOTIFY_OFF, NULL);
>         ret = notifier_to_errno(ret);
>         if (ret)
> -               goto err;
> +               return ret;
>
>         if (!genpd->power_on)
>                 goto out;
> @@ -462,15 +462,15 @@ static int _genpd_power_off(struct generic_pm_domain *genpd, bool timed)
>         unsigned int state_idx = genpd->state_idx;
>         ktime_t time_start;
>         s64 elapsed_ns;
> -       int ret, nr_calls = 0;
> +       int ret;
>
>         /* Notify consumers that we are about to power off. */
> -       ret = __raw_notifier_call_chain(&genpd->power_notifiers,
> -                                       GENPD_NOTIFY_PRE_OFF, NULL, -1,
> -                                       &nr_calls);
> +       ret = raw_notifier_call_chain_robust(&genpd->power_notifiers,
> +                                            GENPD_NOTIFY_PRE_OFF,
> +                                            GENPD_NOTIFY_ON, NULL);
>         ret = notifier_to_errno(ret);
>         if (ret)
> -               goto busy;
> +               return ret;
>
>         if (!genpd->power_off)
>                 goto out;
> @@ -502,10 +502,7 @@ static int _genpd_power_off(struct generic_pm_domain *genpd, bool timed)
>                                 NULL);
>         return 0;
>  busy:
> -       if (nr_calls)
> -               __raw_notifier_call_chain(&genpd->power_notifiers,
> -                                         GENPD_NOTIFY_ON, NULL, nr_calls - 1,
> -                                         NULL);
> +       raw_notifier_call_chain(&genpd->power_notifiers, GENPD_NOTIFY_ON, NULL);
>         return ret;
>  }
>
> --
> 2.25.1
>
diff mbox series

Patch

diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c
index 859cdb207010..743268996336 100644
--- a/drivers/base/power/domain.c
+++ b/drivers/base/power/domain.c
@@ -413,15 +413,15 @@  static int _genpd_power_on(struct generic_pm_domain *genpd, bool timed)
 	unsigned int state_idx = genpd->state_idx;
 	ktime_t time_start;
 	s64 elapsed_ns;
-	int ret, nr_calls = 0;
+	int ret;
 
 	/* Notify consumers that we are about to power on. */
-	ret = __raw_notifier_call_chain(&genpd->power_notifiers,
-					GENPD_NOTIFY_PRE_ON, NULL, -1,
-					&nr_calls);
+	ret = raw_notifier_call_chain_robust(&genpd->power_notifiers,
+					     GENPD_NOTIFY_PRE_ON,
+					     GENPD_NOTIFY_OFF, NULL);
 	ret = notifier_to_errno(ret);
 	if (ret)
-		goto err;
+		return ret;
 
 	if (!genpd->power_on)
 		goto out;
@@ -462,15 +462,15 @@  static int _genpd_power_off(struct generic_pm_domain *genpd, bool timed)
 	unsigned int state_idx = genpd->state_idx;
 	ktime_t time_start;
 	s64 elapsed_ns;
-	int ret, nr_calls = 0;
+	int ret;
 
 	/* Notify consumers that we are about to power off. */
-	ret = __raw_notifier_call_chain(&genpd->power_notifiers,
-					GENPD_NOTIFY_PRE_OFF, NULL, -1,
-					&nr_calls);
+	ret = raw_notifier_call_chain_robust(&genpd->power_notifiers,
+					     GENPD_NOTIFY_PRE_OFF,
+					     GENPD_NOTIFY_ON, NULL);
 	ret = notifier_to_errno(ret);
 	if (ret)
-		goto busy;
+		return ret;
 
 	if (!genpd->power_off)
 		goto out;
@@ -502,10 +502,7 @@  static int _genpd_power_off(struct generic_pm_domain *genpd, bool timed)
 				NULL);
 	return 0;
 busy:
-	if (nr_calls)
-		__raw_notifier_call_chain(&genpd->power_notifiers,
-					  GENPD_NOTIFY_ON, NULL, nr_calls - 1,
-					  NULL);
+	raw_notifier_call_chain(&genpd->power_notifiers, GENPD_NOTIFY_ON, NULL);
 	return ret;
 }