cpufreq: s5pv210: Simplify with dev_err_probe()
Subsystems (2)
Krzysztof Kozlowski
maintainerPATCH 1/2 cpufreq: s5pv210: Simplify with dev_err_probe()
Common pattern of handling deferred probe can be simplified with dev_err_probe(). Less code and also it prints the error value.
Signed-off-by Krzysztof Kozlowski <[email protected]>
--- drivers/cpufreq/s5pv210-cpufreq.c | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-)
drivers/cpufreq/s5pv210-cpufreq.c +6 -12
@@ -590,6 +590,7 @@ static struct notifier_block s5pv210_cpufreq_reboot_notifier = {static int s5pv210_cpufreq_probe (struct platform_device *pdev) { +struct device *dev = &pdev->dev;struct device_node *np;int id, result =0 ;
@@ -602,21 +603,14 @@ static int s5pv210_cpufreq_probe(struct platform_device *pdev)* cpufreq-dt driver. */ arm_regulator =regulator_get (NULL ,"vddarm" ); -if (IS_ERR (arm_regulator)) { -if (PTR_ERR (arm_regulator) == -EPROBE_DEFER ) -pr_debug ("vddarm regulator not ready, defer\n" ); -else -pr_err ("failed to get regulator vddarm\n" ); -return PTR_ERR (arm_regulator); - } +if (IS_ERR (arm_regulator)) +return dev_err_probe (dev,PTR_ERR (arm_regulator), +"failed to get regulator vddarm\n" ); int_regulator =regulator_get (NULL ,"vddint" );if (IS_ERR (int_regulator)) { -if (PTR_ERR (int_regulator) == -EPROBE_DEFER ) -pr_debug ("vddint regulator not ready, defer\n" ); -else -pr_err ("failed to get regulator vddint\n" ); - result =PTR_ERR (int_regulator); + result =dev_err_probe (dev,PTR_ERR (int_regulator), +"failed to get regulator vddint\n" ); goto err_int_regulator; }
Signature · 1 line
2.17.1
Krzysztof Kozlowski
maintainerPATCH 2/2 cpufreq: s5pv210: Use dev_err instead of pr_err in probe
dev_err() allows easily to identify the device printing the message so no need for __func__.
Signed-off-by Krzysztof Kozlowski <[email protected]>
--- drivers/cpufreq/s5pv210-cpufreq.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-)
drivers/cpufreq/s5pv210-cpufreq.c +5 -9
@@ -616,8 +616,7 @@ static int s5pv210_cpufreq_probe(struct platform_device *pdev) np =of_find_compatible_node (NULL ,NULL ,"samsung,s5pv210-clock" );if (!np) { -pr_err ("%s: failed to find clock controller DT node\n" , - __func__); +dev_err (dev,"failed to find clock controller DT node\n" ); result = -ENODEV ; goto err_clock; }
@@ -625,16 +624,14 @@ static int s5pv210_cpufreq_probe(struct platform_device *pdev) clk_base =of_iomap (np,0 );of_node_put (np);if (!clk_base) { -pr_err ("%s: failed to map clock registers\n" , __func__); - result = -EFAULT ; +dev_err (dev,"failed to map clock registers\n" ); goto err_clock; }for_each_compatible_node (np,NULL ,"samsung,s5pv210-dmc" ) { id =of_alias_get_id (np,"dmc" );if (id <0 || id >=ARRAY_SIZE (dmc_base)) { -pr_err ("%s: failed to get alias of dmc node '%pOFn'\n" , - __func__, np); +dev_err (dev,"failed to get alias of dmc node '%pOFn'\n" , np);of_node_put (np); result = id; goto err_clk_base;
@@ -642,8 +639,7 @@ static int s5pv210_cpufreq_probe(struct platform_device *pdev) dmc_base[id] =of_iomap (np,0 );if (!dmc_base[id]) { -pr_err ("%s: failed to map dmc%d registers\n" , - __func__, id); +dev_err (dev,"failed to map dmc%d registers\n" , id);of_node_put (np); result = -EFAULT ; goto err_dmc;
@@ -652,7 +648,7 @@ static int s5pv210_cpufreq_probe(struct platform_device *pdev)for (id =0 ; id <ARRAY_SIZE (dmc_base); ++id) {if (!dmc_base[id]) { -pr_err ("%s: failed to find dmc%d node\n" , __func__, id); +dev_err (dev,"failed to find dmc%d node\n" , id); result = -ENODEV ; goto err_dmc; }
Signature · 1 line
2.17.1
Re: [PATCH 2/2] cpufreq: s5pv210: Use dev_err instead of pr_err in probe
Quoted 23 lines · Krzysztof Kozlowski
dev_err()allows easily to identify the device printing the message so no need for__func__.Signed-off-by Krzysztof Kozlowski <[email protected]>--- drivers/cpufreq/s5pv210-cpufreq.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-)drivers/cpufreq/s5pv210-cpufreq.c +1
-2@@ -616,8 +616,7 @@ static int s5pv210_cpufreq_probe(struct platform_device *pdev) np =of_find_compatible_node (NULL ,NULL ,"samsung,s5pv210-clock" );if (!np) { -pr_err ("%s: failed to find clock controller DT node\n" , - __func__); +dev_err (dev,"failed to find clock controller DT node\n" ); result = -ENODEV ; goto err_clock; }
drivers/cpufreq/s5pv210-cpufreq.c static int s5pv210_cpufreq_probe(struct platform_device *pdev) · line 629
Quoted 5 lines
drivers/cpufreq/s5pv210-cpufreq.c +0
-2@@ -625,16 +624,14 @@ static int s5pv210_cpufreq_probe(struct platform_device *pdev) clk_base =of_iomap (np,0 );of_node_put (np);if (!clk_base) { -pr_err ("%s: failed to map clock registers\n" , __func__); - result = -EFAULT ;
I have restored this back as it didn't look intentional.
Applied both. Thanks.
Signature · 1 line
viresh