Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1424410 > unrolled thread
| Started by | Daniel Lezcano <daniel.lezcano@linaro.org> |
|---|---|
| First post | 2016-06-16 23:30 +0200 |
| Last post | 2016-06-20 20:00 +0200 |
| Articles | 6 — 2 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
[PATCH V2 14/63] clocksource/drivers/bcm_kona: Convert init function to return error Daniel Lezcano <daniel.lezcano@linaro.org> - 2016-06-16 23:30 +0200
Re: [PATCH V2 14/63] clocksource/drivers/bcm_kona: Convert init function to return error Ray Jui <ray.jui@broadcom.com> - 2016-06-20 19:30 +0200
Re: [PATCH V2 14/63] clocksource/drivers/bcm_kona: Convert init function to return error Daniel Lezcano <daniel.lezcano@linaro.org> - 2016-06-20 19:50 +0200
Re: [PATCH V3] clocksource/drivers/bcm_kona: Convert init function to return error Ray Jui <ray.jui@broadcom.com> - 2016-06-20 20:00 +0200
Re: [PATCH V3] clocksource/drivers/bcm_kona: Convert init function to return error Daniel Lezcano <daniel.lezcano@linaro.org> - 2016-06-20 22:20 +0200
[PATCH V3] clocksource/drivers/bcm_kona: Convert init function to return error Daniel Lezcano <daniel.lezcano@linaro.org> - 2016-06-20 20:00 +0200
| From | Daniel Lezcano <daniel.lezcano@linaro.org> |
|---|---|
| Date | 2016-06-16 23:30 +0200 |
| Subject | [PATCH V2 14/63] clocksource/drivers/bcm_kona: Convert init function to return error |
| Message-ID | <rKN1o-53x-9@gated-at.bofh.it> |
The init functions do not return any error. They behave as the following:
- panic, thus leading to a kernel crash while another timer may work and
make the system boot up correctly
or
- print an error and let the caller unaware if the state of the system
Change that by converting the init functions to return an error conforming
to the CLOCKSOURCE_OF_RET prototype.
Proper error handling (rollback, errno value) will be changed later case
by case, thus this change just return back an error or success in the init
function.
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
---
drivers/clocksource/bcm_kona_timer.c | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/drivers/clocksource/bcm_kona_timer.c b/drivers/clocksource/bcm_kona_timer.c
index e717e87..98bc2a2 100644
--- a/drivers/clocksource/bcm_kona_timer.c
+++ b/drivers/clocksource/bcm_kona_timer.c
@@ -163,14 +163,14 @@ static struct irqaction kona_timer_irq = {
.handler = kona_timer_interrupt,
};
-static void __init kona_timer_init(struct device_node *node)
+static int __init kona_timer_init(struct device_node *node)
{
u32 freq;
struct clk *external_clk;
if (!of_device_is_available(node)) {
pr_info("Kona Timer v1 marked as disabled in device tree\n");
- return;
+ return 0;
}
external_clk = of_clk_get_by_name(node, NULL);
@@ -182,7 +182,7 @@ static void __init kona_timer_init(struct device_node *node)
arch_timer_rate = freq;
} else {
pr_err("Kona Timer v1 unable to determine clock-frequency");
- return;
+ return -EINVAL;
}
/* Setup IRQ numbers */
@@ -196,11 +196,13 @@ static void __init kona_timer_init(struct device_node *node)
kona_timer_clockevents_init();
setup_irq(timers.tmr_irq, &kona_timer_irq);
kona_timer_set_next_event((arch_timer_rate / HZ), NULL);
+
+ return 0;
}
-CLOCKSOURCE_OF_DECLARE(brcm_kona, "brcm,kona-timer", kona_timer_init);
+CLOCKSOURCE_OF_DECLARE_RET(brcm_kona, "brcm,kona-timer", kona_timer_init);
/*
* bcm,kona-timer is deprecated by brcm,kona-timer
* being kept here for driver compatibility
*/
-CLOCKSOURCE_OF_DECLARE(bcm_kona, "bcm,kona-timer", kona_timer_init);
+CLOCKSOURCE_OF_DECLARE_RET(bcm_kona, "bcm,kona-timer", kona_timer_init);
--
1.9.1
[toc] | [next] | [standalone]
| From | Ray Jui <ray.jui@broadcom.com> |
|---|---|
| Date | 2016-06-20 19:30 +0200 |
| Subject | Re: [PATCH V2 14/63] clocksource/drivers/bcm_kona: Convert init function to return error |
| Message-ID | <rMbbk-2Hq-7@gated-at.bofh.it> |
| In reply to | #1424410 |
Hi Daniel,
On 6/16/2016 2:26 PM, Daniel Lezcano wrote:
> The init functions do not return any error. They behave as the following:
>
> - panic, thus leading to a kernel crash while another timer may work and
> make the system boot up correctly
>
> or
>
> - print an error and let the caller unaware if the state of the system
>
> Change that by converting the init functions to return an error conforming
> to the CLOCKSOURCE_OF_RET prototype.
>
> Proper error handling (rollback, errno value) will be changed later case
> by case, thus this change just return back an error or success in the init
> function.
>
> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
> ---
> drivers/clocksource/bcm_kona_timer.c | 12 +++++++-----
> 1 file changed, 7 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/clocksource/bcm_kona_timer.c b/drivers/clocksource/bcm_kona_timer.c
> index e717e87..98bc2a2 100644
> --- a/drivers/clocksource/bcm_kona_timer.c
> +++ b/drivers/clocksource/bcm_kona_timer.c
> @@ -163,14 +163,14 @@ static struct irqaction kona_timer_irq = {
> .handler = kona_timer_interrupt,
> };
>
> -static void __init kona_timer_init(struct device_node *node)
> +static int __init kona_timer_init(struct device_node *node)
> {
> u32 freq;
> struct clk *external_clk;
>
> if (!of_device_is_available(node)) {
> pr_info("Kona Timer v1 marked as disabled in device tree\n");
> - return;
> + return 0;
I thought we should return -ENODEV here.
Moreover, if this device node is not enabled, kona_timer_init won't even
be invoked. Can we simply get rid of this check here?
> }
>
> external_clk = of_clk_get_by_name(node, NULL);
> @@ -182,7 +182,7 @@ static void __init kona_timer_init(struct device_node *node)
> arch_timer_rate = freq;
> } else {
> pr_err("Kona Timer v1 unable to determine clock-frequency");
> - return;
> + return -EINVAL;
> }
>
> /* Setup IRQ numbers */
> @@ -196,11 +196,13 @@ static void __init kona_timer_init(struct device_node *node)
> kona_timer_clockevents_init();
> setup_irq(timers.tmr_irq, &kona_timer_irq);
> kona_timer_set_next_event((arch_timer_rate / HZ), NULL);
> +
> + return 0;
> }
>
> -CLOCKSOURCE_OF_DECLARE(brcm_kona, "brcm,kona-timer", kona_timer_init);
> +CLOCKSOURCE_OF_DECLARE_RET(brcm_kona, "brcm,kona-timer", kona_timer_init);
> /*
> * bcm,kona-timer is deprecated by brcm,kona-timer
> * being kept here for driver compatibility
> */
> -CLOCKSOURCE_OF_DECLARE(bcm_kona, "bcm,kona-timer", kona_timer_init);
> +CLOCKSOURCE_OF_DECLARE_RET(bcm_kona, "bcm,kona-timer", kona_timer_init);
>
Thanks,
Ray
[toc] | [prev] | [next] | [standalone]
| From | Daniel Lezcano <daniel.lezcano@linaro.org> |
|---|---|
| Date | 2016-06-20 19:50 +0200 |
| Subject | Re: [PATCH V2 14/63] clocksource/drivers/bcm_kona: Convert init function to return error |
| Message-ID | <rMbuF-2Oc-15@gated-at.bofh.it> |
| In reply to | #1426841 |
On 06/20/2016 07:22 PM, Ray Jui wrote:
[ ... ]
>> -static void __init kona_timer_init(struct device_node *node)
>> +static int __init kona_timer_init(struct device_node *node)
>> {
>> u32 freq;
>> struct clk *external_clk;
>>
>> if (!of_device_is_available(node)) {
>> pr_info("Kona Timer v1 marked as disabled in device tree\n");
>> - return;
>> + return 0;
>
> I thought we should return -ENODEV here.
>
> Moreover, if this device node is not enabled, kona_timer_init won't even
> be invoked. Can we simply get rid of this check here?
Yes, absolutely :)
--
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs
Follow Linaro: <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog
[toc] | [prev] | [next] | [standalone]
| From | Ray Jui <ray.jui@broadcom.com> |
|---|---|
| Date | 2016-06-20 20:00 +0200 |
| Subject | Re: [PATCH V3] clocksource/drivers/bcm_kona: Convert init function to return error |
| Message-ID | <rMbEl-2RX-15@gated-at.bofh.it> |
| In reply to | #1426841 |
Hi Daniel,
On 6/20/2016 10:48 AM, Daniel Lezcano wrote:
> The init functions do not return any error. They behave as the following:
>
> - panic, thus leading to a kernel crash while another timer may work and
> make the system boot up correctly
>
> or
>
> - print an error and let the caller unaware if the state of the system
>
> Change that by converting the init functions to return an error conforming
> to the CLOCKSOURCE_OF_RET prototype.
>
> Proper error handling (rollback, errno value) will be changed later case
> by case, thus this change just return back an error or success in the init
> function.
>
> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
> ---
> drivers/clocksource/bcm_kona_timer.c | 15 ++++++---------
> 1 file changed, 6 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/clocksource/bcm_kona_timer.c b/drivers/clocksource/bcm_kona_timer.c
> index e717e87..c251aa6 100644
> --- a/drivers/clocksource/bcm_kona_timer.c
> +++ b/drivers/clocksource/bcm_kona_timer.c
> @@ -163,16 +163,11 @@ static struct irqaction kona_timer_irq = {
> .handler = kona_timer_interrupt,
> };
>
> -static void __init kona_timer_init(struct device_node *node)
> +static int __init kona_timer_init(struct device_node *node)
> {
> u32 freq;
> struct clk *external_clk;
>
> - if (!of_device_is_available(node)) {
> - pr_info("Kona Timer v1 marked as disabled in device tree\n");
> - return;
> - }
> -
> external_clk = of_clk_get_by_name(node, NULL);
>
> if (!IS_ERR(external_clk)) {
> @@ -182,7 +177,7 @@ static void __init kona_timer_init(struct device_node *node)
> arch_timer_rate = freq;
> } else {
> pr_err("Kona Timer v1 unable to determine clock-frequency");
> - return;
> + return -EINVAL;
> }
>
> /* Setup IRQ numbers */
> @@ -196,11 +191,13 @@ static void __init kona_timer_init(struct device_node *node)
> kona_timer_clockevents_init();
> setup_irq(timers.tmr_irq, &kona_timer_irq);
> kona_timer_set_next_event((arch_timer_rate / HZ), NULL);
> +
> + return 0;
> }
>
> -CLOCKSOURCE_OF_DECLARE(brcm_kona, "brcm,kona-timer", kona_timer_init);
> +CLOCKSOURCE_OF_DECLARE_RET(brcm_kona, "brcm,kona-timer", kona_timer_init);
> /*
> * bcm,kona-timer is deprecated by brcm,kona-timer
> * being kept here for driver compatibility
> */
> -CLOCKSOURCE_OF_DECLARE(bcm_kona, "bcm,kona-timer", kona_timer_init);
> +CLOCKSOURCE_OF_DECLARE_RET(bcm_kona, "bcm,kona-timer", kona_timer_init);
Looks good to me!
Acked-by: Ray Jui <ray.jui@broadcom.com>
Thanks,
Ray
[toc] | [prev] | [next] | [standalone]
| From | Daniel Lezcano <daniel.lezcano@linaro.org> |
|---|---|
| Date | 2016-06-20 22:20 +0200 |
| Subject | Re: [PATCH V3] clocksource/drivers/bcm_kona: Convert init function to return error |
| Message-ID | <rMdPQ-4rx-33@gated-at.bofh.it> |
| In reply to | #1426875 |
On 06/20/2016 07:50 PM, Ray Jui wrote: [ ... ] >> -CLOCKSOURCE_OF_DECLARE(bcm_kona, "bcm,kona-timer", kona_timer_init); >> +CLOCKSOURCE_OF_DECLARE_RET(bcm_kona, "bcm,kona-timer", kona_timer_init); > > Looks good to me! > > Acked-by: Ray Jui <ray.jui@broadcom.com> Can you have a quick look at the patch [63/63] for the kona part where CLOCKSOURCE_OF_DECLARE_RET is renamed back to CLOCKSOURCE_OF_DECLARE ? Thanks ! -- Daniel -- <http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs Follow Linaro: <http://www.facebook.com/pages/Linaro> Facebook | <http://twitter.com/#!/linaroorg> Twitter | <http://www.linaro.org/linaro-blog/> Blog
[toc] | [prev] | [next] | [standalone]
| From | Daniel Lezcano <daniel.lezcano@linaro.org> |
|---|---|
| Date | 2016-06-20 20:00 +0200 |
| Subject | [PATCH V3] clocksource/drivers/bcm_kona: Convert init function to return error |
| Message-ID | <rMbEl-2RX-17@gated-at.bofh.it> |
| In reply to | #1426841 |
The init functions do not return any error. They behave as the following:
- panic, thus leading to a kernel crash while another timer may work and
make the system boot up correctly
or
- print an error and let the caller unaware if the state of the system
Change that by converting the init functions to return an error conforming
to the CLOCKSOURCE_OF_RET prototype.
Proper error handling (rollback, errno value) will be changed later case
by case, thus this change just return back an error or success in the init
function.
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
---
drivers/clocksource/bcm_kona_timer.c | 15 ++++++---------
1 file changed, 6 insertions(+), 9 deletions(-)
diff --git a/drivers/clocksource/bcm_kona_timer.c b/drivers/clocksource/bcm_kona_timer.c
index e717e87..c251aa6 100644
--- a/drivers/clocksource/bcm_kona_timer.c
+++ b/drivers/clocksource/bcm_kona_timer.c
@@ -163,16 +163,11 @@ static struct irqaction kona_timer_irq = {
.handler = kona_timer_interrupt,
};
-static void __init kona_timer_init(struct device_node *node)
+static int __init kona_timer_init(struct device_node *node)
{
u32 freq;
struct clk *external_clk;
- if (!of_device_is_available(node)) {
- pr_info("Kona Timer v1 marked as disabled in device tree\n");
- return;
- }
-
external_clk = of_clk_get_by_name(node, NULL);
if (!IS_ERR(external_clk)) {
@@ -182,7 +177,7 @@ static void __init kona_timer_init(struct device_node *node)
arch_timer_rate = freq;
} else {
pr_err("Kona Timer v1 unable to determine clock-frequency");
- return;
+ return -EINVAL;
}
/* Setup IRQ numbers */
@@ -196,11 +191,13 @@ static void __init kona_timer_init(struct device_node *node)
kona_timer_clockevents_init();
setup_irq(timers.tmr_irq, &kona_timer_irq);
kona_timer_set_next_event((arch_timer_rate / HZ), NULL);
+
+ return 0;
}
-CLOCKSOURCE_OF_DECLARE(brcm_kona, "brcm,kona-timer", kona_timer_init);
+CLOCKSOURCE_OF_DECLARE_RET(brcm_kona, "brcm,kona-timer", kona_timer_init);
/*
* bcm,kona-timer is deprecated by brcm,kona-timer
* being kept here for driver compatibility
*/
-CLOCKSOURCE_OF_DECLARE(bcm_kona, "bcm,kona-timer", kona_timer_init);
+CLOCKSOURCE_OF_DECLARE_RET(bcm_kona, "bcm,kona-timer", kona_timer_init);
--
1.9.1
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web