linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/4] ARM: dts: s5pv210: Enable cpufreq support
@ 2019-01-08 20:05 Paweł Chmiel
  2019-01-08 20:05 ` [PATCH 1/4] ARM: dts: s5pv210: Add dmc nodes Paweł Chmiel
                   ` (3 more replies)
  0 siblings, 4 replies; 10+ messages in thread
From: Paweł Chmiel @ 2019-01-08 20:05 UTC (permalink / raw)
  To: kgene
  Cc: krzk, robh+dt, mark.rutland, linux, viresh.kumar, rjw,
	linux-arm-kernel, linux-samsung-soc, devicetree, linux-kernel,
	linux-pm, Paweł Chmiel

This patchset enables cpufreq support using s5pv210-cpufreq driver.

First patch adds missing dmc nodes, which are required by driver.

Second patch is cosmetic, it stops driver from flooding kernel log with
 messages, after every change of freq.

Third patch adds defer probe support for regulators, needed by driver.
It was observed, that those regulators can be no yet initialized, when
 driver is probed, so we should wait till we can get them.

Last patch enables required kernel config options.

Paweł Chmiel (4):
  ARM: dts: s5pv210: Add dmc nodes
  cpufreq: s5pv210: Don't flood kernel log after cpufreq change
  cpufreq: s5pv210: Defer probe if getting regulators fail
  ARM: defconfig: s5pv210: Add cpufreq support

 arch/arm/boot/dts/s5pv210.dtsi     | 12 ++++++++++
 arch/arm/configs/s5pv210_defconfig |  6 +++++
 drivers/cpufreq/s5pv210-cpufreq.c  | 35 ++++++++++++++++++------------
 3 files changed, 39 insertions(+), 14 deletions(-)

-- 
2.17.1


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH 1/4] ARM: dts: s5pv210: Add dmc nodes
  2019-01-08 20:05 [PATCH 0/4] ARM: dts: s5pv210: Enable cpufreq support Paweł Chmiel
@ 2019-01-08 20:05 ` Paweł Chmiel
  2019-01-08 20:05 ` [PATCH 2/4] cpufreq: s5pv210: Don't flood kernel log after cpufreq change Paweł Chmiel
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 10+ messages in thread
From: Paweł Chmiel @ 2019-01-08 20:05 UTC (permalink / raw)
  To: kgene
  Cc: krzk, robh+dt, mark.rutland, linux, viresh.kumar, rjw,
	linux-arm-kernel, linux-samsung-soc, devicetree, linux-kernel,
	linux-pm, Paweł Chmiel

This commit adds dmc nodes, which are needed by s5pv210 cpufreq driver
to work.

Signed-off-by: Paweł Chmiel <pawel.mikolaj.chmiel@gmail.com>
---
 arch/arm/boot/dts/s5pv210.dtsi | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/arch/arm/boot/dts/s5pv210.dtsi b/arch/arm/boot/dts/s5pv210.dtsi
index e9613418228d..2d55a3a6e79e 100644
--- a/arch/arm/boot/dts/s5pv210.dtsi
+++ b/arch/arm/boot/dts/s5pv210.dtsi
@@ -25,6 +25,8 @@
 
 	aliases {
 		csis0 = &csis0;
+		dmc0 = &dmc0;
+		dmc1 = &dmc1;
 		fimc0 = &fimc0;
 		fimc1 = &fimc1;
 		fimc2 = &fimc2;
@@ -521,6 +523,16 @@
 			status = "disabled";
 		};
 
+		dmc0: dmc@f0000000 {
+			compatible = "samsung,s5pv210-dmc";
+			reg = <0xf0000000 0x1000>;
+		};
+
+		dmc1: dmc@f1400000 {
+			compatible = "samsung,s5pv210-dmc";
+			reg = <0xf1400000 0x1000>;
+		};
+
 		g2d: g2d@fa000000 {
 			compatible = "samsung,s5pv210-g2d";
 			reg = <0xfa000000 0x1000>;
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 2/4] cpufreq: s5pv210: Don't flood kernel log after cpufreq change
  2019-01-08 20:05 [PATCH 0/4] ARM: dts: s5pv210: Enable cpufreq support Paweł Chmiel
  2019-01-08 20:05 ` [PATCH 1/4] ARM: dts: s5pv210: Add dmc nodes Paweł Chmiel
@ 2019-01-08 20:05 ` Paweł Chmiel
  2019-01-09 10:27   ` Krzysztof Kozlowski
  2019-01-08 20:05 ` [PATCH 3/4] cpufreq: s5pv210: Defer probe if getting regulators fail Paweł Chmiel
  2019-01-08 20:05 ` [PATCH 4/4] ARM: defconfig: s5pv210: Add cpufreq support Paweł Chmiel
  3 siblings, 1 reply; 10+ messages in thread
From: Paweł Chmiel @ 2019-01-08 20:05 UTC (permalink / raw)
  To: kgene
  Cc: krzk, robh+dt, mark.rutland, linux, viresh.kumar, rjw,
	linux-arm-kernel, linux-samsung-soc, devicetree, linux-kernel,
	linux-pm, Paweł Chmiel

This commit replaces printk with pr_debug, so we don't flood kernel log.

Signed-off-by: Paweł Chmiel <pawel.mikolaj.chmiel@gmail.com>
---
 drivers/cpufreq/s5pv210-cpufreq.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/cpufreq/s5pv210-cpufreq.c b/drivers/cpufreq/s5pv210-cpufreq.c
index dbecd7667db2..f51697f1e0b3 100644
--- a/drivers/cpufreq/s5pv210-cpufreq.c
+++ b/drivers/cpufreq/s5pv210-cpufreq.c
@@ -481,7 +481,7 @@ static int s5pv210_target(struct cpufreq_policy *policy, unsigned int index)
 				arm_volt, arm_volt_max);
 	}
 
-	printk(KERN_DEBUG "Perf changed[L%d]\n", index);
+	pr_debug("Perf changed[L%d]\n", index);
 
 exit:
 	mutex_unlock(&set_freq_lock);
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 3/4] cpufreq: s5pv210: Defer probe if getting regulators fail
  2019-01-08 20:05 [PATCH 0/4] ARM: dts: s5pv210: Enable cpufreq support Paweł Chmiel
  2019-01-08 20:05 ` [PATCH 1/4] ARM: dts: s5pv210: Add dmc nodes Paweł Chmiel
  2019-01-08 20:05 ` [PATCH 2/4] cpufreq: s5pv210: Don't flood kernel log after cpufreq change Paweł Chmiel
@ 2019-01-08 20:05 ` Paweł Chmiel
  2019-01-10  7:01   ` Viresh Kumar
  2019-01-08 20:05 ` [PATCH 4/4] ARM: defconfig: s5pv210: Add cpufreq support Paweł Chmiel
  3 siblings, 1 reply; 10+ messages in thread
From: Paweł Chmiel @ 2019-01-08 20:05 UTC (permalink / raw)
  To: kgene
  Cc: krzk, robh+dt, mark.rutland, linux, viresh.kumar, rjw,
	linux-arm-kernel, linux-samsung-soc, devicetree, linux-kernel,
	linux-pm, Paweł Chmiel

There is possibility, that when probing driver, regulators are not yet
initialized. In this case we should return EPROBE_DEFER and wait till
they're initialized, since they're required currently for cpufreq driver
to work. Also move regulator initialization code at beginning of probe,
so we can defer as fast as posibble.

Signed-off-by: Paweł Chmiel <pawel.mikolaj.chmiel@gmail.com>
---
 drivers/cpufreq/s5pv210-cpufreq.c | 33 +++++++++++++++++++------------
 1 file changed, 20 insertions(+), 13 deletions(-)

diff --git a/drivers/cpufreq/s5pv210-cpufreq.c b/drivers/cpufreq/s5pv210-cpufreq.c
index f51697f1e0b3..2d0e4dc7ede7 100644
--- a/drivers/cpufreq/s5pv210-cpufreq.c
+++ b/drivers/cpufreq/s5pv210-cpufreq.c
@@ -594,6 +594,26 @@ static int s5pv210_cpufreq_probe(struct platform_device *pdev)
 	 * this whole driver as soon as S5PV210 gets migrated to use
 	 * cpufreq-dt driver.
 	 */
+	arm_regulator = regulator_get(NULL, "vddarm");
+	if (PTR_ERR(arm_regulator) == -EPROBE_DEFER) {
+		pr_dbg("vddarm regulator not ready, defer\n");
+		return -EPROBE_DEFER;
+	} else if (IS_ERR(arm_regulator)) {
+		pr_err("failed to get regulator vddarm\n");
+		return PTR_ERR(arm_regulator);
+	}
+
+	int_regulator = regulator_get(NULL, "vddint");
+	if (PTR_ERR(int_regulator == -EPROBE_DEFER) {
+		regulator_put(arm_regulator);
+		pr_dbg("vddint regulator not ready, defer\n");
+		return -EPROBE_DEFER;
+	} else if (IS_ERR(int_regulator)) {
+		regulator_put(arm_regulator);
+		pr_err("failed to get regulator vddint\n");
+		return PTR_ERR(int_regulator);
+	}
+
 	np = of_find_compatible_node(NULL, NULL, "samsung,s5pv210-clock");
 	if (!np) {
 		pr_err("%s: failed to find clock controller DT node\n",
@@ -633,19 +653,6 @@ static int s5pv210_cpufreq_probe(struct platform_device *pdev)
 		}
 	}
 
-	arm_regulator = regulator_get(NULL, "vddarm");
-	if (IS_ERR(arm_regulator)) {
-		pr_err("failed to get regulator vddarm\n");
-		return PTR_ERR(arm_regulator);
-	}
-
-	int_regulator = regulator_get(NULL, "vddint");
-	if (IS_ERR(int_regulator)) {
-		pr_err("failed to get regulator vddint\n");
-		regulator_put(arm_regulator);
-		return PTR_ERR(int_regulator);
-	}
-
 	register_reboot_notifier(&s5pv210_cpufreq_reboot_notifier);
 
 	return cpufreq_register_driver(&s5pv210_driver);
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH 4/4] ARM: defconfig: s5pv210: Add cpufreq support
  2019-01-08 20:05 [PATCH 0/4] ARM: dts: s5pv210: Enable cpufreq support Paweł Chmiel
                   ` (2 preceding siblings ...)
  2019-01-08 20:05 ` [PATCH 3/4] cpufreq: s5pv210: Defer probe if getting regulators fail Paweł Chmiel
@ 2019-01-08 20:05 ` Paweł Chmiel
  2019-01-10  7:02   ` Viresh Kumar
  3 siblings, 1 reply; 10+ messages in thread
From: Paweł Chmiel @ 2019-01-08 20:05 UTC (permalink / raw)
  To: kgene
  Cc: krzk, robh+dt, mark.rutland, linux, viresh.kumar, rjw,
	linux-arm-kernel, linux-samsung-soc, devicetree, linux-kernel,
	linux-pm, Paweł Chmiel

This commit enables cpufreq support for all s5pv210 devices.

Signed-off-by: Paweł Chmiel <pawel.mikolaj.chmiel@gmail.com>
---
 arch/arm/configs/s5pv210_defconfig | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/arch/arm/configs/s5pv210_defconfig b/arch/arm/configs/s5pv210_defconfig
index 951196bdf008..fd4f28aabda6 100644
--- a/arch/arm/configs/s5pv210_defconfig
+++ b/arch/arm/configs/s5pv210_defconfig
@@ -11,6 +11,12 @@ CONFIG_ARCH_S5PV210=y
 CONFIG_VMSPLIT_2G=y
 CONFIG_ARM_APPENDED_DTB=y
 CONFIG_CMDLINE="root=/dev/ram0 rw ramdisk=8192 initrd=0x20800000,8M console=ttySAC1,115200 init=/linuxrc"
+CONFIG_CPU_FREQ=y
+CONFIG_CPU_FREQ_STAT=y
+CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND=y
+CONFIG_CPU_FREQ_GOV_POWERSAVE=m
+CONFIG_CPU_FREQ_GOV_USERSPACE=m
+CONFIG_CPU_FREQ_GOV_CONSERVATIVE=m
 CONFIG_VFP=y
 CONFIG_NEON=y
 CONFIG_MODULES=y
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH 2/4] cpufreq: s5pv210: Don't flood kernel log after cpufreq change
  2019-01-08 20:05 ` [PATCH 2/4] cpufreq: s5pv210: Don't flood kernel log after cpufreq change Paweł Chmiel
@ 2019-01-09 10:27   ` Krzysztof Kozlowski
  0 siblings, 0 replies; 10+ messages in thread
From: Krzysztof Kozlowski @ 2019-01-09 10:27 UTC (permalink / raw)
  To: Paweł Chmiel
  Cc: kgene, robh+dt, mark.rutland, linux, viresh.kumar, rjw,
	linux-arm-kernel, linux-samsung-soc, devicetree, linux-kernel,
	linux-pm

On Tue, 8 Jan 2019 at 21:05, Paweł Chmiel
<pawel.mikolaj.chmiel@gmail.com> wrote:
>
> This commit replaces printk with pr_debug, so we don't flood kernel log.
>
> Signed-off-by: Paweł Chmiel <pawel.mikolaj.chmiel@gmail.com>
> ---
>  drivers/cpufreq/s5pv210-cpufreq.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Acked-by: Krzysztof Kozlowski <krzk@kernel.org>

Best regards,
Krzysztof

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 3/4] cpufreq: s5pv210: Defer probe if getting regulators fail
  2019-01-08 20:05 ` [PATCH 3/4] cpufreq: s5pv210: Defer probe if getting regulators fail Paweł Chmiel
@ 2019-01-10  7:01   ` Viresh Kumar
  2019-01-10  8:03     ` Paweł Chmiel
  0 siblings, 1 reply; 10+ messages in thread
From: Viresh Kumar @ 2019-01-10  7:01 UTC (permalink / raw)
  To: Paweł Chmiel
  Cc: kgene, krzk, robh+dt, mark.rutland, linux, rjw, linux-arm-kernel,
	linux-samsung-soc, devicetree, linux-kernel, linux-pm

On 08-01-19, 21:05, Paweł Chmiel wrote:
> There is possibility, that when probing driver, regulators are not yet
> initialized. In this case we should return EPROBE_DEFER and wait till
> they're initialized, since they're required currently for cpufreq driver
> to work. Also move regulator initialization code at beginning of probe,
> so we can defer as fast as posibble.
> 
> Signed-off-by: Paweł Chmiel <pawel.mikolaj.chmiel@gmail.com>
> ---
>  drivers/cpufreq/s5pv210-cpufreq.c | 33 +++++++++++++++++++------------
>  1 file changed, 20 insertions(+), 13 deletions(-)
> 
> diff --git a/drivers/cpufreq/s5pv210-cpufreq.c b/drivers/cpufreq/s5pv210-cpufreq.c
> index f51697f1e0b3..2d0e4dc7ede7 100644
> --- a/drivers/cpufreq/s5pv210-cpufreq.c
> +++ b/drivers/cpufreq/s5pv210-cpufreq.c
> @@ -594,6 +594,26 @@ static int s5pv210_cpufreq_probe(struct platform_device *pdev)
>  	 * this whole driver as soon as S5PV210 gets migrated to use
>  	 * cpufreq-dt driver.
>  	 */
> +	arm_regulator = regulator_get(NULL, "vddarm");
> +	if (PTR_ERR(arm_regulator) == -EPROBE_DEFER) {
> +		pr_dbg("vddarm regulator not ready, defer\n");
> +		return -EPROBE_DEFER;
> +	} else if (IS_ERR(arm_regulator)) {
> +		pr_err("failed to get regulator vddarm\n");
> +		return PTR_ERR(arm_regulator);
> +	}

The only difference between the two cases is pr_dbg vs pr_err, its
ugly that we have to add special code for that :(

Maybe write it as:

        if (IS_ERR(arm_regulator)) {
                if (PTR_ERR(arm_regulator) == -EPROBE_DEFER)
                        pr_dbg...
                else
                        pr_err
                return PTR_ERR(arm_regulator);
        }

> +
> +	int_regulator = regulator_get(NULL, "vddint");
> +	if (PTR_ERR(int_regulator == -EPROBE_DEFER) {

Does this even compile ?

> +		regulator_put(arm_regulator);
> +		pr_dbg("vddint regulator not ready, defer\n");
> +		return -EPROBE_DEFER;
> +	} else if (IS_ERR(int_regulator)) {
> +		regulator_put(arm_regulator);
> +		pr_err("failed to get regulator vddint\n");
> +		return PTR_ERR(int_regulator);
> +	}
> +
>  	np = of_find_compatible_node(NULL, NULL, "samsung,s5pv210-clock");
>  	if (!np) {
>  		pr_err("%s: failed to find clock controller DT node\n",
> @@ -633,19 +653,6 @@ static int s5pv210_cpufreq_probe(struct platform_device *pdev)
>  		}
>  	}
>  
> -	arm_regulator = regulator_get(NULL, "vddarm");
> -	if (IS_ERR(arm_regulator)) {
> -		pr_err("failed to get regulator vddarm\n");
> -		return PTR_ERR(arm_regulator);
> -	}
> -
> -	int_regulator = regulator_get(NULL, "vddint");
> -	if (IS_ERR(int_regulator)) {
> -		pr_err("failed to get regulator vddint\n");
> -		regulator_put(arm_regulator);
> -		return PTR_ERR(int_regulator);
> -	}
> -
>  	register_reboot_notifier(&s5pv210_cpufreq_reboot_notifier);
>  
>  	return cpufreq_register_driver(&s5pv210_driver);
> -- 
> 2.17.1

-- 
viresh

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 4/4] ARM: defconfig: s5pv210: Add cpufreq support
  2019-01-08 20:05 ` [PATCH 4/4] ARM: defconfig: s5pv210: Add cpufreq support Paweł Chmiel
@ 2019-01-10  7:02   ` Viresh Kumar
  2019-01-10  7:55     ` Paweł Chmiel
  0 siblings, 1 reply; 10+ messages in thread
From: Viresh Kumar @ 2019-01-10  7:02 UTC (permalink / raw)
  To: Paweł Chmiel
  Cc: kgene, krzk, robh+dt, mark.rutland, linux, rjw, linux-arm-kernel,
	linux-samsung-soc, devicetree, linux-kernel, linux-pm

On 08-01-19, 21:05, Paweł Chmiel wrote:
> This commit enables cpufreq support for all s5pv210 devices.
> 
> Signed-off-by: Paweł Chmiel <pawel.mikolaj.chmiel@gmail.com>
> ---
>  arch/arm/configs/s5pv210_defconfig | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/arch/arm/configs/s5pv210_defconfig b/arch/arm/configs/s5pv210_defconfig
> index 951196bdf008..fd4f28aabda6 100644
> --- a/arch/arm/configs/s5pv210_defconfig
> +++ b/arch/arm/configs/s5pv210_defconfig
> @@ -11,6 +11,12 @@ CONFIG_ARCH_S5PV210=y
>  CONFIG_VMSPLIT_2G=y
>  CONFIG_ARM_APPENDED_DTB=y
>  CONFIG_CMDLINE="root=/dev/ram0 rw ramdisk=8192 initrd=0x20800000,8M console=ttySAC1,115200 init=/linuxrc"
> +CONFIG_CPU_FREQ=y
> +CONFIG_CPU_FREQ_STAT=y
> +CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND=y
> +CONFIG_CPU_FREQ_GOV_POWERSAVE=m
> +CONFIG_CPU_FREQ_GOV_USERSPACE=m
> +CONFIG_CPU_FREQ_GOV_CONSERVATIVE=m

You don't want to use schedutil ? That is the default governor for
everyone now a days.

-- 
viresh

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 4/4] ARM: defconfig: s5pv210: Add cpufreq support
  2019-01-10  7:02   ` Viresh Kumar
@ 2019-01-10  7:55     ` Paweł Chmiel
  0 siblings, 0 replies; 10+ messages in thread
From: Paweł Chmiel @ 2019-01-10  7:55 UTC (permalink / raw)
  To: Viresh Kumar
  Cc: Kukjin Kim, Krzysztof Kozlowski, Rob Herring, Mark Rutland,
	linux, rjw, linux-arm-kernel,
	moderated list:SAMSUNG SOC CLOCK DRIVERS, DTML, linux-kernel,
	linux-pm

czw., 10 sty 2019 o 08:02 Viresh Kumar <viresh.kumar@linaro.org> napisał(a):
>
> On 08-01-19, 21:05, Paweł Chmiel wrote:
> > This commit enables cpufreq support for all s5pv210 devices.
> >
> > Signed-off-by: Paweł Chmiel <pawel.mikolaj.chmiel@gmail.com>
> > ---
> >  arch/arm/configs/s5pv210_defconfig | 6 ++++++
> >  1 file changed, 6 insertions(+)
> >
> > diff --git a/arch/arm/configs/s5pv210_defconfig b/arch/arm/configs/s5pv210_defconfig
> > index 951196bdf008..fd4f28aabda6 100644
> > --- a/arch/arm/configs/s5pv210_defconfig
> > +++ b/arch/arm/configs/s5pv210_defconfig
> > @@ -11,6 +11,12 @@ CONFIG_ARCH_S5PV210=y
> >  CONFIG_VMSPLIT_2G=y
> >  CONFIG_ARM_APPENDED_DTB=y
> >  CONFIG_CMDLINE="root=/dev/ram0 rw ramdisk=8192 initrd=0x20800000,8M console=ttySAC1,115200 init=/linuxrc"
> > +CONFIG_CPU_FREQ=y
> > +CONFIG_CPU_FREQ_STAT=y
> > +CONFIG_CPU_FREQ_DEFAULT_GOV_ONDEMAND=y
> > +CONFIG_CPU_FREQ_GOV_POWERSAVE=m
> > +CONFIG_CPU_FREQ_GOV_USERSPACE=m
> > +CONFIG_CPU_FREQ_GOV_CONSERVATIVE=m
>
> You don't want to use schedutil ? That is the default governor for
> everyone now a days.
schedutil depends on SMP, which is not enabled on s5pv210 (it has only
one cpu core).
>
> --
> viresh

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH 3/4] cpufreq: s5pv210: Defer probe if getting regulators fail
  2019-01-10  7:01   ` Viresh Kumar
@ 2019-01-10  8:03     ` Paweł Chmiel
  0 siblings, 0 replies; 10+ messages in thread
From: Paweł Chmiel @ 2019-01-10  8:03 UTC (permalink / raw)
  To: Viresh Kumar
  Cc: Kukjin Kim, Krzysztof Kozlowski, Rob Herring, Mark Rutland,
	linux, rjw, linux-arm-kernel,
	moderated list:SAMSUNG SOC CLOCK DRIVERS, DTML, linux-kernel,
	linux-pm

czw., 10 sty 2019 o 08:01 Viresh Kumar <viresh.kumar@linaro.org> napisał(a):
>
> On 08-01-19, 21:05, Paweł Chmiel wrote:
> > There is possibility, that when probing driver, regulators are not yet
> > initialized. In this case we should return EPROBE_DEFER and wait till
> > they're initialized, since they're required currently for cpufreq driver
> > to work. Also move regulator initialization code at beginning of probe,
> > so we can defer as fast as posibble.
> >
> > Signed-off-by: Paweł Chmiel <pawel.mikolaj.chmiel@gmail.com>
> > ---
> >  drivers/cpufreq/s5pv210-cpufreq.c | 33 +++++++++++++++++++------------
> >  1 file changed, 20 insertions(+), 13 deletions(-)
> >
> > diff --git a/drivers/cpufreq/s5pv210-cpufreq.c b/drivers/cpufreq/s5pv210-cpufreq.c
> > index f51697f1e0b3..2d0e4dc7ede7 100644
> > --- a/drivers/cpufreq/s5pv210-cpufreq.c
> > +++ b/drivers/cpufreq/s5pv210-cpufreq.c
> > @@ -594,6 +594,26 @@ static int s5pv210_cpufreq_probe(struct platform_device *pdev)
> >        * this whole driver as soon as S5PV210 gets migrated to use
> >        * cpufreq-dt driver.
> >        */
> > +     arm_regulator = regulator_get(NULL, "vddarm");
> > +     if (PTR_ERR(arm_regulator) == -EPROBE_DEFER) {
> > +             pr_dbg("vddarm regulator not ready, defer\n");
> > +             return -EPROBE_DEFER;
> > +     } else if (IS_ERR(arm_regulator)) {
> > +             pr_err("failed to get regulator vddarm\n");
> > +             return PTR_ERR(arm_regulator);
> > +     }
>
> The only difference between the two cases is pr_dbg vs pr_err, its
> ugly that we have to add special code for that :(
>
> Maybe write it as:
>
>         if (IS_ERR(arm_regulator)) {
>                 if (PTR_ERR(arm_regulator) == -EPROBE_DEFER)
>                         pr_dbg...
>                 else
>                         pr_err
>                 return PTR_ERR(arm_regulator);
>         }
>
> > +
> > +     int_regulator = regulator_get(NULL, "vddint");
> > +     if (PTR_ERR(int_regulator == -EPROBE_DEFER) {
>
> Does this even compile ?
Looks like i broke it after testing (where it was working fine - was
able to change freq and gov),
and didn't catch this before sending patch for review :/.
Sorry, this (and first issue) will be fixed in v2.

Thanks for review
>
> > +             regulator_put(arm_regulator);
> > +             pr_dbg("vddint regulator not ready, defer\n");
> > +             return -EPROBE_DEFER;
> > +     } else if (IS_ERR(int_regulator)) {
> > +             regulator_put(arm_regulator);
> > +             pr_err("failed to get regulator vddint\n");
> > +             return PTR_ERR(int_regulator);
> > +     }
> > +
> >       np = of_find_compatible_node(NULL, NULL, "samsung,s5pv210-clock");
> >       if (!np) {
> >               pr_err("%s: failed to find clock controller DT node\n",
> > @@ -633,19 +653,6 @@ static int s5pv210_cpufreq_probe(struct platform_device *pdev)
> >               }
> >       }
> >
> > -     arm_regulator = regulator_get(NULL, "vddarm");
> > -     if (IS_ERR(arm_regulator)) {
> > -             pr_err("failed to get regulator vddarm\n");
> > -             return PTR_ERR(arm_regulator);
> > -     }
> > -
> > -     int_regulator = regulator_get(NULL, "vddint");
> > -     if (IS_ERR(int_regulator)) {
> > -             pr_err("failed to get regulator vddint\n");
> > -             regulator_put(arm_regulator);
> > -             return PTR_ERR(int_regulator);
> > -     }
> > -
> >       register_reboot_notifier(&s5pv210_cpufreq_reboot_notifier);
> >
> >       return cpufreq_register_driver(&s5pv210_driver);
> > --
> > 2.17.1
>
> --
> viresh

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2019-01-10  8:03 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-08 20:05 [PATCH 0/4] ARM: dts: s5pv210: Enable cpufreq support Paweł Chmiel
2019-01-08 20:05 ` [PATCH 1/4] ARM: dts: s5pv210: Add dmc nodes Paweł Chmiel
2019-01-08 20:05 ` [PATCH 2/4] cpufreq: s5pv210: Don't flood kernel log after cpufreq change Paweł Chmiel
2019-01-09 10:27   ` Krzysztof Kozlowski
2019-01-08 20:05 ` [PATCH 3/4] cpufreq: s5pv210: Defer probe if getting regulators fail Paweł Chmiel
2019-01-10  7:01   ` Viresh Kumar
2019-01-10  8:03     ` Paweł Chmiel
2019-01-08 20:05 ` [PATCH 4/4] ARM: defconfig: s5pv210: Add cpufreq support Paweł Chmiel
2019-01-10  7:02   ` Viresh Kumar
2019-01-10  7:55     ` Paweł Chmiel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).