Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1424418 > unrolled thread
| Started by | Daniel Lezcano <daniel.lezcano@linaro.org> |
|---|---|
| First post | 2016-06-16 23:30 +0200 |
| Last post | 2016-06-17 16:40 +0200 |
| Articles | 20 on this page of 89 — 19 participants |
Back to article view | Back to linux.kernel
[PATCH V2 00/63] clocksource/drivers/clksrc-of: Improve error handling Daniel Lezcano <daniel.lezcano@linaro.org> - 2016-06-16 23:30 +0200
[PATCH V2 53/63] clocksource/drivers/vt8500_timer: Convert init function to return error Daniel Lezcano <daniel.lezcano@linaro.org> - 2016-06-16 23:30 +0200
[PATCH V2 59/63] clocksource/drivers/smp_twd: Convert init function to return error Daniel Lezcano <daniel.lezcano@linaro.org> - 2016-06-16 23:30 +0200
[PATCH V2 40/63] clocksource/drivers/timer-atmel-pit: Convert init function to return error Daniel Lezcano <daniel.lezcano@linaro.org> - 2016-06-16 23:30 +0200
[PATCH V2 24/63] clocksource/drivers/mps2-timer: Convert init function to return error Daniel Lezcano <daniel.lezcano@linaro.org> - 2016-06-16 23:30 +0200
[PATCH V2 30/63] clocksource/drivers/sun4i_time: Convert init function to return error Daniel Lezcano <daniel.lezcano@linaro.org> - 2016-06-16 23:30 +0200
[PATCH V2 19/63] clocksource/drivers/h8300_timer16: Convert init function to return error Daniel Lezcano <daniel.lezcano@linaro.org> - 2016-06-16 23:30 +0200
[PATCH V2 48/63] clocksource/drivers/timer-sun5i: Convert init function to return error Daniel Lezcano <daniel.lezcano@linaro.org> - 2016-06-16 23:30 +0200
[PATCH V2 26/63] clocksource/drivers/nomadik-mtu: Convert init function to return error Daniel Lezcano <daniel.lezcano@linaro.org> - 2016-06-16 23:30 +0200
[PATCH V2 09/63] clocksource/drivers/dw_apb_timer: Convert init function to return error Daniel Lezcano <daniel.lezcano@linaro.org> - 2016-06-16 23:30 +0200
[PATCH V2 36/63] clocksource/drivers/time-orion: Convert init function to return error Daniel Lezcano <daniel.lezcano@linaro.org> - 2016-06-16 23:30 +0200
Re: [PATCH V2 36/63] clocksource/drivers/time-orion: Convert init function to return error Sylvain Lemieux <slemieux.tyco@gmail.com> - 2016-06-20 19:10 +0200
[PATCH V2 34/63] clocksource/drivers/time-efm32: Convert init function to return error Daniel Lezcano <daniel.lezcano@linaro.org> - 2016-06-16 23:40 +0200
[PATCH V2 58/63] clocksource/drivers/nios2: Convert init function to return error Daniel Lezcano <daniel.lezcano@linaro.org> - 2016-06-16 23:40 +0200
[PATCH V2 28/63] clocksource/drivers/qcom-timer: Convert init function to return error Daniel Lezcano <daniel.lezcano@linaro.org> - 2016-06-16 23:40 +0200
[PATCH V2 41/63] clocksource/drivers/timer-atmel-st: Convert init function to return error Daniel Lezcano <daniel.lezcano@linaro.org> - 2016-06-16 23:40 +0200
[PATCH V2 27/63] clocksource/drivers/pxa_timer: Convert init function to return error Daniel Lezcano <daniel.lezcano@linaro.org> - 2016-06-16 23:40 +0200
[PATCH V2 35/63] clocksource/drivers/time-lpc32xx: Convert init function to return error Daniel Lezcano <daniel.lezcano@linaro.org> - 2016-06-16 23:40 +0200
Re: [PATCH V2 35/63] clocksource/drivers/time-lpc32xx: Convert init function to return error Uwe Kleine-König <u.kleine-koenig@pengutronix.de> - 2016-06-17 09:00 +0200
[PATCH V3] clocksource/drivers/time-efm32: Convert init function to return error Daniel Lezcano <daniel.lezcano@linaro.org> - 2016-06-17 10:50 +0200
Re: [PATCH V3] clocksource/drivers/time-efm32: Convert init function to return error Uwe Kleine-König <u.kleine-koenig@pengutronix.de> - 2016-06-17 11:50 +0200
[PATCH V2 39/63] clocksource/drivers/timer-atlas7: Convert init function to return error Daniel Lezcano <daniel.lezcano@linaro.org> - 2016-06-16 23:40 +0200
[PATCH V2 45/63] clocksource/drivers/timer-keystone: Convert init function to return error Daniel Lezcano <daniel.lezcano@linaro.org> - 2016-06-16 23:40 +0200
Re: [PATCH V2 45/63] clocksource/drivers/timer-keystone: Convert init function to return error Santosh Shilimkar <santosh.shilimkar@oracle.com> - 2016-06-17 18:10 +0200
[PATCH V2 43/63] clocksource/drivers/timer-imx-gpt: Convert init function to return error Daniel Lezcano <daniel.lezcano@linaro.org> - 2016-06-16 23:40 +0200
[PATCH V2 62/63] clocksource/drivers/oxnas-rps: Convert init function to return error Daniel Lezcano <daniel.lezcano@linaro.org> - 2016-06-16 23:40 +0200
Re: [PATCH V2 62/63] clocksource/drivers/oxnas-rps: Convert init function to return error Neil Armstrong <narmstrong@baylibre.com> - 2016-06-17 09:00 +0200
[PATCH V2 38/63] clocksource/drivers/time-pistachio: Convert init function to return error Daniel Lezcano <daniel.lezcano@linaro.org> - 2016-06-16 23:40 +0200
[PATCH V2 49/63] clocksource/drivers/timer-ti-32k: Convert init function to return error Daniel Lezcano <daniel.lezcano@linaro.org> - 2016-06-16 23:40 +0200
[PATCH V2 32/63] clocksource/drivers/tegra20_timer: Convert init function to return error Daniel Lezcano <daniel.lezcano@linaro.org> - 2016-06-16 23:40 +0200
[PATCH V2 55/63] clocksource/drivers/timer-sp804: Convert init function to return error Daniel Lezcano <daniel.lezcano@linaro.org> - 2016-06-16 23:40 +0200
[PATCH V2 31/63] clocksource/drivers/tango_xtal: Convert init function to return error Daniel Lezcano <daniel.lezcano@linaro.org> - 2016-06-16 23:40 +0200
Re: [PATCH V2 31/63] clocksource/drivers/tango_xtal: Convert init function to return error Mason <slash.tmp@free.fr> - 2016-06-17 11:30 +0200
[PATCH V3] clocksource/drivers/tango_xtal: Convert init function to return error Daniel Lezcano <daniel.lezcano@linaro.org> - 2016-06-17 12:30 +0200
Re: [PATCH V3] clocksource/drivers/tango_xtal: Convert init function to return error Daniel Lezcano <daniel.lezcano@linaro.org> - 2016-06-17 14:50 +0200
Re: [PATCH V3] clocksource/drivers/tango_xtal: Convert init function to return error Marc Gonzalez <marc_gonzalez@sigmadesigns.com> - 2016-06-17 15:00 +0200
[PATCH V2 50/63] clocksource/drivers/timer-u300: Convert init function to return error Daniel Lezcano <daniel.lezcano@linaro.org> - 2016-06-16 23:40 +0200
Re: [PATCH V2 50/63] clocksource/drivers/timer-u300: Convert init function to return error Linus Walleij <linus.walleij@linaro.org> - 2016-06-17 18:20 +0200
[PATCH V2 54/63] clocksource/drivers/zevio-timer: Convert init function to return error Daniel Lezcano <daniel.lezcano@linaro.org> - 2016-06-16 23:40 +0200
[PATCH V2 56/63] clocksource/drivers/microblaze: Convert init function to return error Daniel Lezcano <daniel.lezcano@linaro.org> - 2016-06-16 23:40 +0200
[PATCH V2 42/63] clocksource/drivers/prima2: Convert init function to return error Daniel Lezcano <daniel.lezcano@linaro.org> - 2016-06-16 23:40 +0200
[PATCH V2 51/63] clocksource/drivers/versatile: Convert init function to return error Daniel Lezcano <daniel.lezcano@linaro.org> - 2016-06-16 23:40 +0200
Re: [PATCH V2 51/63] clocksource/drivers/versatile: Convert init function to return error Liviu Dudau <liviu.dudau@arm.com> - 2016-06-20 11:20 +0200
[PATCH V2 60/63] clocksource/drivers/nps: Convert init function to return error Daniel Lezcano <daniel.lezcano@linaro.org> - 2016-06-16 23:40 +0200
[PATCH V2 47/63] clocksource/drivers/timer-stm32: Convert init function to return error Daniel Lezcano <daniel.lezcano@linaro.org> - 2016-06-16 23:40 +0200
Re: [PATCH V2 47/63] clocksource/drivers/timer-stm32: Convert init function to return error Maxime Coquelin <mcoquelin.stm32@gmail.com> - 2016-06-20 13:40 +0200
[PATCH V2 37/63] clocksource/drivers/time-pistachio: Convert init function to return error Daniel Lezcano <daniel.lezcano@linaro.org> - 2016-06-16 23:40 +0200
[PATCH V2 52/63] clocksource/drivers/vf_pit_timer: Convert init function to return error Daniel Lezcano <daniel.lezcano@linaro.org> - 2016-06-16 23:40 +0200
[PATCH V2 16/63] clocksource/drivers/fsl_ftm_timer: Convert init function to return error Daniel Lezcano <daniel.lezcano@linaro.org> - 2016-06-16 23:40 +0200
[PATCH V2 57/63] clocksource/drivers/ralink: Convert init function to return error Daniel Lezcano <daniel.lezcano@linaro.org> - 2016-06-16 23:40 +0200
Re: [PATCH V2 57/63] clocksource/drivers/ralink: Convert init function to return error John Crispin <john@phrozen.org> - 2016-06-17 11:00 +0200
[PATCH V2 46/63] clocksource/drivers/timer-sp804: Convert init function to return error Daniel Lezcano <daniel.lezcano@linaro.org> - 2016-06-16 23:40 +0200
[PATCH V2 29/63] clocksource/drivers/samsung_pwm_timer: Convert init function to return error Daniel Lezcano <daniel.lezcano@linaro.org> - 2016-06-16 23:40 +0200
[PATCH V2 12/63] clocksource/drivers/armv7m_systick: Convert init function to return error Daniel Lezcano <daniel.lezcano@linaro.org> - 2016-06-16 23:50 +0200
Re: [PATCH V2 12/63] clocksource/drivers/armv7m_systick: Convert init function to return error Maxime Coquelin <mcoquelin.stm32@gmail.com> - 2016-06-20 14:30 +0200
[PATCH V2 10/63] clocksource/drivers/clps711x: Convert init function to return error Daniel Lezcano <daniel.lezcano@linaro.org> - 2016-06-16 23:50 +0200
[PATCH V2 23/63] clocksource/drivers/moxart_timer: Convert init function to return error Daniel Lezcano <daniel.lezcano@linaro.org> - 2016-06-16 23:50 +0200
[PATCH V2 01/63] of: Add a new macro to declare_of for one parameter function returning a value Daniel Lezcano <daniel.lezcano@linaro.org> - 2016-06-16 23:50 +0200
Re: [PATCH V2 01/63] of: Add a new macro to declare_of for one parameter function returning a value Rob Herring <robh+dt@kernel.org> - 2016-06-20 23:30 +0200
[PATCH V2 05/63] clocksource/drivers/exynos_mct: Convert init function to return error Daniel Lezcano <daniel.lezcano@linaro.org> - 2016-06-16 23:50 +0200
[PATCH V2 07/63] clocksource/drivers/cadence_ttc: Convert init function to return error Daniel Lezcano <daniel.lezcano@linaro.org> - 2016-06-16 23:50 +0200
Re: [PATCH V2 07/63] clocksource/drivers/cadence_ttc: Convert init function to return error Sören Brinkmann <soren.brinkmann@xilinx.com> - 2016-06-16 23:50 +0200
[PATCH V2 02/63] clocksource/drivers/clksrc-probe: Introduce init functions with return code Daniel Lezcano <daniel.lezcano@linaro.org> - 2016-06-16 23:50 +0200
[PATCH V2 22/63] clocksource/drivers/mips-gic-timer: Convert init function to return error Daniel Lezcano <daniel.lezcano@linaro.org> - 2016-06-16 23:50 +0200
[PATCH V2 03/63] clocksource/drivers/rockchip_timer: Convert init function to return error Daniel Lezcano <daniel.lezcano@linaro.org> - 2016-06-16 23:50 +0200
Re: [PATCH V2 03/63] clocksource/drivers/rockchip_timer: Convert init function to return error Heiko Stübner <heiko@sntech.de> - 2016-06-18 12:40 +0200
[PATCH V3] clocksource/drivers/rockchip_timer: Convert init function to return error Daniel Lezcano <daniel.lezcano@linaro.org> - 2016-06-18 15:00 +0200
Re: [PATCH V3] clocksource/drivers/rockchip_timer: Convert init function to return error Heiko Stübner <heiko@sntech.de> - 2016-06-18 15:50 +0200
[PATCH V2 20/63] clocksource/drivers/h8300_tpu: Convert init function to return error Daniel Lezcano <daniel.lezcano@linaro.org> - 2016-06-16 23:50 +0200
[PATCH V2 15/63] clocksource/drivers/clksrc-dbx500: Convert init function to return error Daniel Lezcano <daniel.lezcano@linaro.org> - 2016-06-16 23:50 +0200
Re: [PATCH V2 15/63] clocksource/drivers/clksrc-dbx500: Convert init function to return error Linus Walleij <linus.walleij@linaro.org> - 2016-06-17 18:20 +0200
[PATCH V2 21/63] clocksource/drivers/h8300_tpu: Convert init function to return error Daniel Lezcano <daniel.lezcano@linaro.org> - 2016-06-16 23:50 +0200
[PATCH V2 18/63] clocksource/drivers/arm_global_timer: Convert init function to return error Daniel Lezcano <daniel.lezcano@linaro.org> - 2016-06-16 23:50 +0200
Re: [PATCH V2 18/63] clocksource/drivers/arm_global_timer: Convert init function to return error Maxime Coquelin <maxime.coquelin@st.com> - 2016-06-20 13:40 +0200
[PATCH V2 08/63] clocksource/drivers/st_lpc: Convert init function to return error Daniel Lezcano <daniel.lezcano@linaro.org> - 2016-06-16 23:50 +0200
Re: [PATCH V2 08/63] clocksource/drivers/st_lpc: Convert init function to return error Patrice Chotard <patrice.chotard@st.com> - 2016-06-20 10:10 +0200
Re: [PATCH V2 08/63] clocksource/drivers/st_lpc: Convert init function to return error Maxime Coquelin <maxime.coquelin@st.com> - 2016-06-20 14:20 +0200
[PATCH V2 13/63] clocksource/drivers/bcm2835_timer: Convert init function to return error Daniel Lezcano <daniel.lezcano@linaro.org> - 2016-06-16 23:50 +0200
[PATCH V2 04/63] clocksource/drivers/mkt_timer: Convert init function to return error Daniel Lezcano <daniel.lezcano@linaro.org> - 2016-06-16 23:50 +0200
Re: [PATCH V2 04/63] clocksource/drivers/mkt_timer: Convert init function to return error Matthias Brugger <matthias.bgg@gmail.com> - 2016-06-17 18:20 +0200
[PATCH V2 17/63] clocksource/drivers/arm_arch_timer: Convert init function to return error Daniel Lezcano <daniel.lezcano@linaro.org> - 2016-06-16 23:50 +0200
[PATCH V2 25/63] clocksource/drivers/mxs_timer: Convert init function to return error Daniel Lezcano <daniel.lezcano@linaro.org> - 2016-06-16 23:50 +0200
Re: [PATCH V2 25/63] clocksource/drivers/mxs_timer: Convert init function to return error Uwe Kleine-König <u.kleine-koenig@pengutronix.de> - 2016-06-17 08:40 +0200
[PATCH V3] clocksource/drivers/mxs: Convert init function to return error Daniel Lezcano <daniel.lezcano@linaro.org> - 2016-06-17 12:50 +0200
Re: [PATCH V2 25/63] clocksource/drivers/mxs_timer: Convert init function to return error Liviu Dudau <liviu.dudau@arm.com> - 2016-06-20 11:20 +0200
Re: [PATCH V2 25/63] clocksource/drivers/mxs_timer: Convert init function to return error Daniel Lezcano <daniel.lezcano@linaro.org> - 2016-06-20 11:30 +0200
[PATCH V3] clocksource/drivers/mps2-timer: Convert init function to return error Daniel Lezcano <daniel.lezcano@linaro.org> - 2016-06-20 11:40 +0200
Re: [PATCH V3] clocksource/drivers/mps2-timer: Convert init function to return error liviu.dudau@arm.com - 2016-06-20 11:50 +0200
Re: [PATCH V2 63/63] clocksources: Switch back to the clksrc table Vineet Gupta <Vineet.Gupta1@synopsys.com> - 2016-06-17 16:40 +0200
Page 4 of 5 — ← Prev page 1 2 3 [4] 5 Next page →
| From | Daniel Lezcano <daniel.lezcano@linaro.org> |
|---|---|
| Date | 2016-06-16 23:50 +0200 |
| Subject | [PATCH V2 07/63] clocksource/drivers/cadence_ttc: Convert init function to return error |
| Message-ID | <rKNkK-5aq-25@gated-at.bofh.it> |
| In reply to | #1424418 |
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/cadence_ttc_timer.c | 76 ++++++++++++++++++++-------------
1 file changed, 47 insertions(+), 29 deletions(-)
diff --git a/drivers/clocksource/cadence_ttc_timer.c b/drivers/clocksource/cadence_ttc_timer.c
index 9be6018..e2e7631 100644
--- a/drivers/clocksource/cadence_ttc_timer.c
+++ b/drivers/clocksource/cadence_ttc_timer.c
@@ -322,22 +322,22 @@ static int ttc_rate_change_clocksource_cb(struct notifier_block *nb,
return NOTIFY_DONE;
}
-static void __init ttc_setup_clocksource(struct clk *clk, void __iomem *base,
+static int __init ttc_setup_clocksource(struct clk *clk, void __iomem *base,
u32 timer_width)
{
struct ttc_timer_clocksource *ttccs;
int err;
ttccs = kzalloc(sizeof(*ttccs), GFP_KERNEL);
- if (WARN_ON(!ttccs))
- return;
+ if (!ttccs)
+ return -ENOMEM;
ttccs->ttc.clk = clk;
err = clk_prepare_enable(ttccs->ttc.clk);
- if (WARN_ON(err)) {
+ if (err) {
kfree(ttccs);
- return;
+ return err;
}
ttccs->ttc.freq = clk_get_rate(ttccs->ttc.clk);
@@ -345,8 +345,10 @@ static void __init ttc_setup_clocksource(struct clk *clk, void __iomem *base,
ttccs->ttc.clk_rate_change_nb.notifier_call =
ttc_rate_change_clocksource_cb;
ttccs->ttc.clk_rate_change_nb.next = NULL;
- if (clk_notifier_register(ttccs->ttc.clk,
- &ttccs->ttc.clk_rate_change_nb))
+
+ err = clk_notifier_register(ttccs->ttc.clk,
+ &ttccs->ttc.clk_rate_change_nb);
+ if (err)
pr_warn("Unable to register clock notifier.\n");
ttccs->ttc.base_addr = base;
@@ -368,14 +370,16 @@ static void __init ttc_setup_clocksource(struct clk *clk, void __iomem *base,
ttccs->ttc.base_addr + TTC_CNT_CNTRL_OFFSET);
err = clocksource_register_hz(&ttccs->cs, ttccs->ttc.freq / PRESCALE);
- if (WARN_ON(err)) {
+ if (err) {
kfree(ttccs);
- return;
+ return err;
}
ttc_sched_clock_val_reg = base + TTC_COUNT_VAL_OFFSET;
sched_clock_register(ttc_sched_clock_read, timer_width,
ttccs->ttc.freq / PRESCALE);
+
+ return 0;
}
static int ttc_rate_change_clockevent_cb(struct notifier_block *nb,
@@ -401,30 +405,35 @@ static int ttc_rate_change_clockevent_cb(struct notifier_block *nb,
}
}
-static void __init ttc_setup_clockevent(struct clk *clk,
- void __iomem *base, u32 irq)
+static int __init ttc_setup_clockevent(struct clk *clk,
+ void __iomem *base, u32 irq)
{
struct ttc_timer_clockevent *ttcce;
int err;
ttcce = kzalloc(sizeof(*ttcce), GFP_KERNEL);
- if (WARN_ON(!ttcce))
- return;
+ if (!ttcce)
+ return -ENOMEM;
ttcce->ttc.clk = clk;
err = clk_prepare_enable(ttcce->ttc.clk);
- if (WARN_ON(err)) {
+ if (err) {
kfree(ttcce);
- return;
+ return err;
}
ttcce->ttc.clk_rate_change_nb.notifier_call =
ttc_rate_change_clockevent_cb;
ttcce->ttc.clk_rate_change_nb.next = NULL;
- if (clk_notifier_register(ttcce->ttc.clk,
- &ttcce->ttc.clk_rate_change_nb))
+
+ err = clk_notifier_register(ttcce->ttc.clk,
+ &ttcce->ttc.clk_rate_change_nb);
+ if (err) {
pr_warn("Unable to register clock notifier.\n");
+ return err;
+ }
+
ttcce->ttc.freq = clk_get_rate(ttcce->ttc.clk);
ttcce->ttc.base_addr = base;
@@ -451,13 +460,15 @@ static void __init ttc_setup_clockevent(struct clk *clk,
err = request_irq(irq, ttc_clock_event_interrupt,
IRQF_TIMER, ttcce->ce.name, ttcce);
- if (WARN_ON(err)) {
+ if (err) {
kfree(ttcce);
- return;
+ return err;
}
clockevents_config_and_register(&ttcce->ce,
ttcce->ttc.freq / PRESCALE, 1, 0xfffe);
+
+ return 0;
}
/**
@@ -466,17 +477,17 @@ static void __init ttc_setup_clockevent(struct clk *clk,
* Initializes the timer hardware and register the clock source and clock event
* timers with Linux kernal timer framework
*/
-static void __init ttc_timer_init(struct device_node *timer)
+static int __init ttc_timer_init(struct device_node *timer)
{
unsigned int irq;
void __iomem *timer_baseaddr;
struct clk *clk_cs, *clk_ce;
static int initialized;
- int clksel;
+ int clksel, ret;
u32 timer_width = 16;
if (initialized)
- return;
+ return 0;
initialized = 1;
@@ -488,13 +499,13 @@ static void __init ttc_timer_init(struct device_node *timer)
timer_baseaddr = of_iomap(timer, 0);
if (!timer_baseaddr) {
pr_err("ERROR: invalid timer base address\n");
- BUG();
+ return -ENXIO;
}
irq = irq_of_parse_and_map(timer, 1);
if (irq <= 0) {
pr_err("ERROR: invalid interrupt number\n");
- BUG();
+ return -EINVAL;
}
of_property_read_u32(timer, "timer-width", &timer_width);
@@ -504,7 +515,7 @@ static void __init ttc_timer_init(struct device_node *timer)
clk_cs = of_clk_get(timer, clksel);
if (IS_ERR(clk_cs)) {
pr_err("ERROR: timer input clock not found\n");
- BUG();
+ return PTR_ERR(clk_cs);
}
clksel = readl_relaxed(timer_baseaddr + 4 + TTC_CLK_CNTRL_OFFSET);
@@ -512,13 +523,20 @@ static void __init ttc_timer_init(struct device_node *timer)
clk_ce = of_clk_get(timer, clksel);
if (IS_ERR(clk_ce)) {
pr_err("ERROR: timer input clock not found\n");
- BUG();
+ return PTR_ERR(clk_cs);
}
- ttc_setup_clocksource(clk_cs, timer_baseaddr, timer_width);
- ttc_setup_clockevent(clk_ce, timer_baseaddr + 4, irq);
+ ret = ttc_setup_clocksource(clk_cs, timer_baseaddr, timer_width);
+ if (ret)
+ return ret;
+
+ ret = ttc_setup_clockevent(clk_ce, timer_baseaddr + 4, irq);
+ if (ret)
+ return ret;
pr_info("%s #0 at %p, irq=%d\n", timer->name, timer_baseaddr, irq);
+
+ return 0;
}
-CLOCKSOURCE_OF_DECLARE(ttc, "cdns,ttc", ttc_timer_init);
+CLOCKSOURCE_OF_DECLARE_RET(ttc, "cdns,ttc", ttc_timer_init);
--
1.9.1
[toc] | [prev] | [next] | [standalone]
| From | Sören Brinkmann <soren.brinkmann@xilinx.com> |
|---|---|
| Date | 2016-06-16 23:50 +0200 |
| Subject | Re: [PATCH V2 07/63] clocksource/drivers/cadence_ttc: Convert init function to return error |
| Message-ID | <rKNkK-5aq-35@gated-at.bofh.it> |
| In reply to | #1424474 |
On Thu, 2016-06-16 at 23:26:26 +0200, 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> Acked-by: Sören Brinkmann <soren.brinkmann@xilinx.com> Sören
[toc] | [prev] | [next] | [standalone]
| From | Daniel Lezcano <daniel.lezcano@linaro.org> |
|---|---|
| Date | 2016-06-16 23:50 +0200 |
| Subject | [PATCH V2 02/63] clocksource/drivers/clksrc-probe: Introduce init functions with return code |
| Message-ID | <rKNkK-5aq-31@gated-at.bofh.it> |
| In reply to | #1424418 |
Currently, the clksrc-probe is not able to handle any error from the init
functions. There are different issues with the current code:
- the code is duplicated in the init functions by writing error
- every driver tends to panic in its own init function
- counting the number of clocksources is not reliable
This patch adds another table to store the functions returning an error.
The table is temporary while we convert all the drivers to return an error
and will disappear.
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
---
drivers/clocksource/clksrc-probe.c | 22 ++++++++++++++++++++++
include/asm-generic/vmlinux.lds.h | 2 ++
include/linux/clocksource.h | 3 +++
3 files changed, 27 insertions(+)
diff --git a/drivers/clocksource/clksrc-probe.c b/drivers/clocksource/clksrc-probe.c
index 7cb6c92..5fa6a55 100644
--- a/drivers/clocksource/clksrc-probe.c
+++ b/drivers/clocksource/clksrc-probe.c
@@ -20,16 +20,22 @@
#include <linux/clocksource.h>
extern struct of_device_id __clksrc_of_table[];
+extern struct of_device_id __clksrc_ret_of_table[];
static const struct of_device_id __clksrc_of_table_sentinel
__used __section(__clksrc_of_table_end);
+static const struct of_device_id __clksrc_ret_of_table_sentinel
+ __used __section(__clksrc_ret_of_table_end);
+
void __init clocksource_probe(void)
{
struct device_node *np;
const struct of_device_id *match;
of_init_fn_1 init_func;
+ of_init_fn_1_ret init_func_ret;
unsigned clocksources = 0;
+ int ret;
for_each_matching_node_and_match(np, __clksrc_of_table, &match) {
if (!of_device_is_available(np))
@@ -40,6 +46,22 @@ void __init clocksource_probe(void)
clocksources++;
}
+ for_each_matching_node_and_match(np, __clksrc_ret_of_table, &match) {
+ if (!of_device_is_available(np))
+ continue;
+
+ init_func_ret = match->data;
+
+ ret = init_func_ret(np);
+ if (ret) {
+ pr_err("Failed to initialize '%s': %d",
+ of_node_full_name(np), ret);
+ continue;
+ }
+
+ clocksources++;
+ }
+
clocksources += acpi_probe_device_table(clksrc);
if (!clocksources)
diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
index 6a67ab9..8c6c626 100644
--- a/include/asm-generic/vmlinux.lds.h
+++ b/include/asm-generic/vmlinux.lds.h
@@ -173,6 +173,7 @@
*(__##name##_of_table_end)
#define CLKSRC_OF_TABLES() OF_TABLE(CONFIG_CLKSRC_OF, clksrc)
+#define CLKSRC_RET_OF_TABLES() OF_TABLE(CONFIG_CLKSRC_OF, clksrc_ret)
#define IRQCHIP_OF_MATCH_TABLE() OF_TABLE(CONFIG_IRQCHIP, irqchip)
#define CLK_OF_TABLES() OF_TABLE(CONFIG_COMMON_CLK, clk)
#define IOMMU_OF_TABLES() OF_TABLE(CONFIG_OF_IOMMU, iommu)
@@ -531,6 +532,7 @@
CLK_OF_TABLES() \
RESERVEDMEM_OF_TABLES() \
CLKSRC_OF_TABLES() \
+ CLKSRC_RET_OF_TABLES() \
IOMMU_OF_TABLES() \
CPU_METHOD_OF_TABLES() \
CPUIDLE_METHOD_OF_TABLES() \
diff --git a/include/linux/clocksource.h b/include/linux/clocksource.h
index 44a1aff..15c3839 100644
--- a/include/linux/clocksource.h
+++ b/include/linux/clocksource.h
@@ -246,6 +246,9 @@ extern int clocksource_i8253_init(void);
#define CLOCKSOURCE_OF_DECLARE(name, compat, fn) \
OF_DECLARE_1(clksrc, name, compat, fn)
+#define CLOCKSOURCE_OF_DECLARE_RET(name, compat, fn) \
+ OF_DECLARE_1_RET(clksrc_ret, name, compat, fn)
+
#ifdef CONFIG_CLKSRC_PROBE
extern void clocksource_probe(void);
#else
--
1.9.1
[toc] | [prev] | [next] | [standalone]
| From | Daniel Lezcano <daniel.lezcano@linaro.org> |
|---|---|
| Date | 2016-06-16 23:50 +0200 |
| Subject | [PATCH V2 22/63] clocksource/drivers/mips-gic-timer: Convert init function to return error |
| Message-ID | <rKNkK-5aq-27@gated-at.bofh.it> |
| In reply to | #1424418 |
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/meson6_timer.c | 21 ++++++++++++++-------
1 file changed, 14 insertions(+), 7 deletions(-)
diff --git a/drivers/clocksource/meson6_timer.c b/drivers/clocksource/meson6_timer.c
index 1fa22c4..3a6e78f 100644
--- a/drivers/clocksource/meson6_timer.c
+++ b/drivers/clocksource/meson6_timer.c
@@ -126,18 +126,22 @@ static struct irqaction meson6_timer_irq = {
.dev_id = &meson6_clockevent,
};
-static void __init meson6_timer_init(struct device_node *node)
+static int __init meson6_timer_init(struct device_node *node)
{
u32 val;
int ret, irq;
timer_base = of_io_request_and_map(node, 0, "meson6-timer");
- if (IS_ERR(timer_base))
- panic("Can't map registers");
+ if (IS_ERR(timer_base)) {
+ pr_err("Can't map registers");
+ return -ENXIO;
+ }
irq = irq_of_parse_and_map(node, 0);
- if (irq <= 0)
- panic("Can't parse IRQ");
+ if (irq <= 0) {
+ pr_err("Can't parse IRQ");
+ return -EINVAL;
+ }
/* Set 1us for timer E */
val = readl(timer_base + TIMER_ISA_MUX);
@@ -158,14 +162,17 @@ static void __init meson6_timer_init(struct device_node *node)
meson6_clkevt_time_stop(CED_ID);
ret = setup_irq(irq, &meson6_timer_irq);
- if (ret)
+ if (ret) {
pr_warn("failed to setup irq %d\n", irq);
+ return ret;
+ }
meson6_clockevent.cpumask = cpu_possible_mask;
meson6_clockevent.irq = irq;
clockevents_config_and_register(&meson6_clockevent, USEC_PER_SEC,
1, 0xfffe);
+ return 0;
}
-CLOCKSOURCE_OF_DECLARE(meson6, "amlogic,meson6-timer",
+CLOCKSOURCE_OF_DECLARE_RET(meson6, "amlogic,meson6-timer",
meson6_timer_init);
--
1.9.1
[toc] | [prev] | [next] | [standalone]
| From | Daniel Lezcano <daniel.lezcano@linaro.org> |
|---|---|
| Date | 2016-06-16 23:50 +0200 |
| Subject | [PATCH V2 03/63] clocksource/drivers/rockchip_timer: Convert init function to return error |
| Message-ID | <rKNkK-5aq-29@gated-at.bofh.it> |
| In reply to | #1424418 |
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/rockchip_timer.c | 26 ++++++++++++++------------
1 file changed, 14 insertions(+), 12 deletions(-)
diff --git a/drivers/clocksource/rockchip_timer.c b/drivers/clocksource/rockchip_timer.c
index a3f22b0..d10bdee 100644
--- a/drivers/clocksource/rockchip_timer.c
+++ b/drivers/clocksource/rockchip_timer.c
@@ -113,17 +113,17 @@ static irqreturn_t rk_timer_interrupt(int irq, void *dev_id)
return IRQ_HANDLED;
}
-static void __init rk_timer_init(struct device_node *np, u32 ctrl_reg)
+static int __init rk_timer_init(struct device_node *np, u32 ctrl_reg)
{
struct clock_event_device *ce = &bc_timer.ce;
struct clk *timer_clk;
struct clk *pclk;
- int ret, irq;
+ int ret = -EINVAL, irq;
bc_timer.base = of_iomap(np, 0);
if (!bc_timer.base) {
pr_err("Failed to get base address for '%s'\n", TIMER_NAME);
- return;
+ return -ENXIO;
}
bc_timer.ctrl = bc_timer.base + ctrl_reg;
@@ -178,7 +178,7 @@ static void __init rk_timer_init(struct device_node *np, u32 ctrl_reg)
clockevents_config_and_register(ce, bc_timer.freq, 1, UINT_MAX);
- return;
+ return 0;
out_irq:
clk_disable_unprepare(timer_clk);
@@ -186,19 +186,21 @@ out_timer_clk:
clk_disable_unprepare(pclk);
out_unmap:
iounmap(bc_timer.base);
+
+ return ret;
}
-static void __init rk3288_timer_init(struct device_node *np)
+static int __init rk3288_timer_init(struct device_node *np)
{
- rk_timer_init(np, TIMER_CONTROL_REG3288);
+ return rk_timer_init(np, TIMER_CONTROL_REG3288);
}
-static void __init rk3399_timer_init(struct device_node *np)
+static int __init rk3399_timer_init(struct device_node *np)
{
- rk_timer_init(np, TIMER_CONTROL_REG3399);
+ return rk_timer_init(np, TIMER_CONTROL_REG3399);
}
-CLOCKSOURCE_OF_DECLARE(rk3288_timer, "rockchip,rk3288-timer",
- rk3288_timer_init);
-CLOCKSOURCE_OF_DECLARE(rk3399_timer, "rockchip,rk3399-timer",
- rk3399_timer_init);
+CLOCKSOURCE_OF_DECLARE_RET(rk3288_timer, "rockchip,rk3288-timer",
+ rk3288_timer_init);
+CLOCKSOURCE_OF_DECLARE_RET(rk3399_timer, "rockchip,rk3399-timer",
+ rk3399_timer_init);
--
1.9.1
[toc] | [prev] | [next] | [standalone]
| From | Heiko Stübner <heiko@sntech.de> |
|---|---|
| Date | 2016-06-18 12:40 +0200 |
| Subject | Re: [PATCH V2 03/63] clocksource/drivers/rockchip_timer: Convert init function to return error |
| Message-ID | <rLlPr-2Q1-1@gated-at.bofh.it> |
| In reply to | #1424477 |
Am Donnerstag, 16. Juni 2016, 23:26:22 schrieb Daniel Lezcano:
> 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/rockchip_timer.c | 26 ++++++++++++++------------
> 1 file changed, 14 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/clocksource/rockchip_timer.c
> b/drivers/clocksource/rockchip_timer.c index a3f22b0..d10bdee 100644
> --- a/drivers/clocksource/rockchip_timer.c
> +++ b/drivers/clocksource/rockchip_timer.c
> @@ -113,17 +113,17 @@ static irqreturn_t rk_timer_interrupt(int irq, void
> *dev_id) return IRQ_HANDLED;
> }
>
> -static void __init rk_timer_init(struct device_node *np, u32 ctrl_reg)
> +static int __init rk_timer_init(struct device_node *np, u32 ctrl_reg)
> {
> struct clock_event_device *ce = &bc_timer.ce;
> struct clk *timer_clk;
> struct clk *pclk;
> - int ret, irq;
> + int ret = -EINVAL, irq;
>
> bc_timer.base = of_iomap(np, 0);
> if (!bc_timer.base) {
> pr_err("Failed to get base address for '%s'\n", TIMER_NAME);
> - return;
> + return -ENXIO;
> }
> bc_timer.ctrl = bc_timer.base + ctrl_reg;
wouldn't it be nicer to also save the error values from all the intermediate
clock calls (ret = PTR_ERR(pclk) and so on).
Right now it will be always -EINVAL for all those clk calls and also
the irq_of_parse_and_map.
Heiko
[toc] | [prev] | [next] | [standalone]
| From | Daniel Lezcano <daniel.lezcano@linaro.org> |
|---|---|
| Date | 2016-06-18 15:00 +0200 |
| Subject | [PATCH V3] clocksource/drivers/rockchip_timer: Convert init function to return error |
| Message-ID | <rLo0V-4ah-11@gated-at.bofh.it> |
| In reply to | #1425692 |
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/rockchip_timer.c | 35 +++++++++++++++++++++--------------
1 file changed, 21 insertions(+), 14 deletions(-)
diff --git a/drivers/clocksource/rockchip_timer.c b/drivers/clocksource/rockchip_timer.c
index a3f22b0..85aee69 100644
--- a/drivers/clocksource/rockchip_timer.c
+++ b/drivers/clocksource/rockchip_timer.c
@@ -113,38 +113,42 @@ static irqreturn_t rk_timer_interrupt(int irq, void *dev_id)
return IRQ_HANDLED;
}
-static void __init rk_timer_init(struct device_node *np, u32 ctrl_reg)
+static int __init rk_timer_init(struct device_node *np, u32 ctrl_reg)
{
struct clock_event_device *ce = &bc_timer.ce;
struct clk *timer_clk;
struct clk *pclk;
- int ret, irq;
+ int ret = -EINVAL, irq;
bc_timer.base = of_iomap(np, 0);
if (!bc_timer.base) {
pr_err("Failed to get base address for '%s'\n", TIMER_NAME);
- return;
+ return -ENXIO;
}
bc_timer.ctrl = bc_timer.base + ctrl_reg;
pclk = of_clk_get_by_name(np, "pclk");
if (IS_ERR(pclk)) {
+ ret = PTR_ERR(pclk);
pr_err("Failed to get pclk for '%s'\n", TIMER_NAME);
goto out_unmap;
}
- if (clk_prepare_enable(pclk)) {
+ ret = clk_prepare_enable(pclk);
+ if (ret) {
pr_err("Failed to enable pclk for '%s'\n", TIMER_NAME);
goto out_unmap;
}
timer_clk = of_clk_get_by_name(np, "timer");
if (IS_ERR(timer_clk)) {
+ ret = PTR_ERR(timer_clk);
pr_err("Failed to get timer clock for '%s'\n", TIMER_NAME);
goto out_timer_clk;
}
- if (clk_prepare_enable(timer_clk)) {
+ ret = clk_prepare_enable(timer_clk);
+ if (ret) {
pr_err("Failed to enable timer clock\n");
goto out_timer_clk;
}
@@ -153,6 +157,7 @@ static void __init rk_timer_init(struct device_node *np, u32 ctrl_reg)
irq = irq_of_parse_and_map(np, 0);
if (!irq) {
+ ret = -EINVAL;
pr_err("Failed to map interrupts for '%s'\n", TIMER_NAME);
goto out_irq;
}
@@ -178,7 +183,7 @@ static void __init rk_timer_init(struct device_node *np, u32 ctrl_reg)
clockevents_config_and_register(ce, bc_timer.freq, 1, UINT_MAX);
- return;
+ return 0;
out_irq:
clk_disable_unprepare(timer_clk);
@@ -186,19 +191,21 @@ out_timer_clk:
clk_disable_unprepare(pclk);
out_unmap:
iounmap(bc_timer.base);
+
+ return ret;
}
-static void __init rk3288_timer_init(struct device_node *np)
+static int __init rk3288_timer_init(struct device_node *np)
{
- rk_timer_init(np, TIMER_CONTROL_REG3288);
+ return rk_timer_init(np, TIMER_CONTROL_REG3288);
}
-static void __init rk3399_timer_init(struct device_node *np)
+static int __init rk3399_timer_init(struct device_node *np)
{
- rk_timer_init(np, TIMER_CONTROL_REG3399);
+ return rk_timer_init(np, TIMER_CONTROL_REG3399);
}
-CLOCKSOURCE_OF_DECLARE(rk3288_timer, "rockchip,rk3288-timer",
- rk3288_timer_init);
-CLOCKSOURCE_OF_DECLARE(rk3399_timer, "rockchip,rk3399-timer",
- rk3399_timer_init);
+CLOCKSOURCE_OF_DECLARE_RET(rk3288_timer, "rockchip,rk3288-timer",
+ rk3288_timer_init);
+CLOCKSOURCE_OF_DECLARE_RET(rk3399_timer, "rockchip,rk3399-timer",
+ rk3399_timer_init);
--
1.9.1
[toc] | [prev] | [next] | [standalone]
| From | Heiko Stübner <heiko@sntech.de> |
|---|---|
| Date | 2016-06-18 15:50 +0200 |
| Subject | Re: [PATCH V3] clocksource/drivers/rockchip_timer: Convert init function to return error |
| Message-ID | <rLoNj-4GW-1@gated-at.bofh.it> |
| In reply to | #1425714 |
Am Samstag, 18. Juni 2016, 14:54:07 schrieb Daniel Lezcano: > 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> looks good now :-) Reviewed-by: Heiko Stuebner <heiko@sntech.de> on a rk3399-evb Tested-by: Heiko Stuebner <heiko@sntech.de> Heiko
[toc] | [prev] | [next] | [standalone]
| From | Daniel Lezcano <daniel.lezcano@linaro.org> |
|---|---|
| Date | 2016-06-16 23:50 +0200 |
| Subject | [PATCH V2 20/63] clocksource/drivers/h8300_tpu: Convert init function to return error |
| Message-ID | <rKNkK-5aq-41@gated-at.bofh.it> |
| In reply to | #1424418 |
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/h8300_timer8.c | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
diff --git a/drivers/clocksource/h8300_timer8.c b/drivers/clocksource/h8300_timer8.c
index c151941..0292a19 100644
--- a/drivers/clocksource/h8300_timer8.c
+++ b/drivers/clocksource/h8300_timer8.c
@@ -164,24 +164,26 @@ static struct timer8_priv timer8_priv = {
},
};
-static void __init h8300_8timer_init(struct device_node *node)
+static int __init h8300_8timer_init(struct device_node *node)
{
void __iomem *base;
- int irq;
+ int irq, ret;
struct clk *clk;
clk = of_clk_get(node, 0);
if (IS_ERR(clk)) {
pr_err("failed to get clock for clockevent\n");
- return;
+ return PTR_ERR(clk);
}
+ ret = ENXIO;
base = of_iomap(node, 0);
if (!base) {
pr_err("failed to map registers for clockevent\n");
goto free_clk;
}
+ ret = -EINVAL;
irq = irq_of_parse_and_map(node, 0);
if (!irq) {
pr_err("failed to get irq for clockevent\n");
@@ -205,11 +207,12 @@ static void __init h8300_8timer_init(struct device_node *node)
clockevents_config_and_register(&timer8_priv.ced,
timer8_priv.rate, 1, 0x0000ffff);
- return;
+ return 0;
unmap_reg:
iounmap(base);
free_clk:
clk_put(clk);
+ return ret;
}
-CLOCKSOURCE_OF_DECLARE(h8300_8bit, "renesas,8bit-timer", h8300_8timer_init);
+CLOCKSOURCE_OF_DECLARE_RET(h8300_8bit, "renesas,8bit-timer", h8300_8timer_init);
--
1.9.1
[toc] | [prev] | [next] | [standalone]
| From | Daniel Lezcano <daniel.lezcano@linaro.org> |
|---|---|
| Date | 2016-06-16 23:50 +0200 |
| Subject | [PATCH V2 15/63] clocksource/drivers/clksrc-dbx500: Convert init function to return error |
| Message-ID | <rKNkK-5aq-45@gated-at.bofh.it> |
| In reply to | #1424418 |
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/clksrc-dbx500-prcmu.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/clocksource/clksrc-dbx500-prcmu.c b/drivers/clocksource/clksrc-dbx500-prcmu.c
index dfad6eb..5a59d29 100644
--- a/drivers/clocksource/clksrc-dbx500-prcmu.c
+++ b/drivers/clocksource/clksrc-dbx500-prcmu.c
@@ -64,7 +64,7 @@ static u64 notrace dbx500_prcmu_sched_clock_read(void)
#endif
-static void __init clksrc_dbx500_prcmu_init(struct device_node *node)
+static int __init clksrc_dbx500_prcmu_init(struct device_node *node)
{
clksrc_dbx500_timer_base = of_iomap(node, 0);
@@ -84,7 +84,7 @@ static void __init clksrc_dbx500_prcmu_init(struct device_node *node)
#ifdef CONFIG_CLKSRC_DBX500_PRCMU_SCHED_CLOCK
sched_clock_register(dbx500_prcmu_sched_clock_read, 32, RATE_32K);
#endif
- clocksource_register_hz(&clocksource_dbx500_prcmu, RATE_32K);
+ return clocksource_register_hz(&clocksource_dbx500_prcmu, RATE_32K);
}
-CLOCKSOURCE_OF_DECLARE(dbx500_prcmu, "stericsson,db8500-prcmu-timer-4",
+CLOCKSOURCE_OF_DECLARE_RET(dbx500_prcmu, "stericsson,db8500-prcmu-timer-4",
clksrc_dbx500_prcmu_init);
--
1.9.1
[toc] | [prev] | [next] | [standalone]
| From | Linus Walleij <linus.walleij@linaro.org> |
|---|---|
| Date | 2016-06-17 18:20 +0200 |
| Subject | Re: [PATCH V2 15/63] clocksource/drivers/clksrc-dbx500: Convert init function to return error |
| Message-ID | <rL4EW-my-35@gated-at.bofh.it> |
| In reply to | #1424483 |
On Thu, Jun 16, 2016 at 11:26 PM, Daniel Lezcano <daniel.lezcano@linaro.org> 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> Acked-by: Linus Walleij <linus.walleij@linaro.org> Yours, Linus Walleij
[toc] | [prev] | [next] | [standalone]
| From | Daniel Lezcano <daniel.lezcano@linaro.org> |
|---|---|
| Date | 2016-06-16 23:50 +0200 |
| Subject | [PATCH V2 21/63] clocksource/drivers/h8300_tpu: Convert init function to return error |
| Message-ID | <rKNkK-5aq-49@gated-at.bofh.it> |
| In reply to | #1424418 |
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/h8300_tpu.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/drivers/clocksource/h8300_tpu.c b/drivers/clocksource/h8300_tpu.c
index d4c1a28..4faf718 100644
--- a/drivers/clocksource/h8300_tpu.c
+++ b/drivers/clocksource/h8300_tpu.c
@@ -119,15 +119,16 @@ static struct tpu_priv tpu_priv = {
#define CH_L 0
#define CH_H 1
-static void __init h8300_tpu_init(struct device_node *node)
+static int __init h8300_tpu_init(struct device_node *node)
{
void __iomem *base[2];
struct clk *clk;
+ int ret = -ENXIO;
clk = of_clk_get(node, 0);
if (IS_ERR(clk)) {
pr_err("failed to get clock for clocksource\n");
- return;
+ return PTR_ERR(clk);
}
base[CH_L] = of_iomap(node, CH_L);
@@ -144,14 +145,13 @@ static void __init h8300_tpu_init(struct device_node *node)
tpu_priv.mapbase1 = base[CH_L];
tpu_priv.mapbase2 = base[CH_H];
- clocksource_register_hz(&tpu_priv.cs, clk_get_rate(clk) / 64);
-
- return;
+ return clocksource_register_hz(&tpu_priv.cs, clk_get_rate(clk) / 64);
unmap_L:
iounmap(base[CH_H]);
free_clk:
clk_put(clk);
+ return ret;
}
-CLOCKSOURCE_OF_DECLARE(h8300_tpu, "renesas,tpu", h8300_tpu_init);
+CLOCKSOURCE_OF_DECLARE_RET(h8300_tpu, "renesas,tpu", h8300_tpu_init);
--
1.9.1
[toc] | [prev] | [next] | [standalone]
| From | Daniel Lezcano <daniel.lezcano@linaro.org> |
|---|---|
| Date | 2016-06-16 23:50 +0200 |
| Subject | [PATCH V2 18/63] clocksource/drivers/arm_global_timer: Convert init function to return error |
| Message-ID | <rKNkK-5aq-47@gated-at.bofh.it> |
| In reply to | #1424418 |
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/arm_global_timer.c | 28 ++++++++++++++++++----------
1 file changed, 18 insertions(+), 10 deletions(-)
diff --git a/drivers/clocksource/arm_global_timer.c b/drivers/clocksource/arm_global_timer.c
index 9df0d16..40104fc 100644
--- a/drivers/clocksource/arm_global_timer.c
+++ b/drivers/clocksource/arm_global_timer.c
@@ -238,7 +238,7 @@ static void __init gt_delay_timer_init(void)
register_current_timer_delay(>_delay_timer);
}
-static void __init gt_clocksource_init(void)
+static int __init gt_clocksource_init(void)
{
writel(0, gt_base + GT_CONTROL);
writel(0, gt_base + GT_COUNTER0);
@@ -249,7 +249,7 @@ static void __init gt_clocksource_init(void)
#ifdef CONFIG_CLKSRC_ARM_GLOBAL_TIMER_SCHED_CLOCK
sched_clock_register(gt_sched_clock_read, 64, gt_clk_rate);
#endif
- clocksource_register_hz(>_clocksource, gt_clk_rate);
+ return clocksource_register_hz(>_clocksource, gt_clk_rate);
}
static int gt_cpu_notify(struct notifier_block *self, unsigned long action,
@@ -270,7 +270,7 @@ static struct notifier_block gt_cpu_nb = {
.notifier_call = gt_cpu_notify,
};
-static void __init global_timer_of_register(struct device_node *np)
+static int __init global_timer_of_register(struct device_node *np)
{
struct clk *gt_clk;
int err = 0;
@@ -283,19 +283,19 @@ static void __init global_timer_of_register(struct device_node *np)
if (read_cpuid_part() == ARM_CPU_PART_CORTEX_A9
&& (read_cpuid_id() & 0xf0000f) < 0x200000) {
pr_warn("global-timer: non support for this cpu version.\n");
- return;
+ return -ENOSYS;
}
gt_ppi = irq_of_parse_and_map(np, 0);
if (!gt_ppi) {
pr_warn("global-timer: unable to parse irq\n");
- return;
+ return -EINVAL;
}
gt_base = of_iomap(np, 0);
if (!gt_base) {
pr_warn("global-timer: invalid base address\n");
- return;
+ return -ENXIO;
}
gt_clk = of_clk_get(np, 0);
@@ -332,11 +332,17 @@ static void __init global_timer_of_register(struct device_node *np)
}
/* Immediately configure the timer on the boot CPU */
- gt_clocksource_init();
- gt_clockevents_init(this_cpu_ptr(gt_evt));
+ err = gt_clocksource_init();
+ if (err)
+ goto out_irq;
+
+ err = gt_clockevents_init(this_cpu_ptr(gt_evt));
+ if (err)
+ goto out_irq;
+
gt_delay_timer_init();
- return;
+ return 0;
out_irq:
free_percpu_irq(gt_ppi, gt_evt);
@@ -347,8 +353,10 @@ out_clk:
out_unmap:
iounmap(gt_base);
WARN(err, "ARM Global timer register failed (%d)\n", err);
+
+ return err;
}
/* Only tested on r2p2 and r3p0 */
-CLOCKSOURCE_OF_DECLARE(arm_gt, "arm,cortex-a9-global-timer",
+CLOCKSOURCE_OF_DECLARE_RET(arm_gt, "arm,cortex-a9-global-timer",
global_timer_of_register);
--
1.9.1
[toc] | [prev] | [next] | [standalone]
| From | Maxime Coquelin <maxime.coquelin@st.com> |
|---|---|
| Date | 2016-06-20 13:40 +0200 |
| Subject | Re: [PATCH V2 18/63] clocksource/drivers/arm_global_timer: Convert init function to return error |
| Message-ID | <rM5IC-7CS-1@gated-at.bofh.it> |
| In reply to | #1424485 |
On 06/16/2016 11: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/arm_global_timer.c | 28 ++++++++++++++++++---------- > 1 file changed, 18 insertions(+), 10 deletions(-) > > Acked-by: Maxime Coquelin <maxime.coquelin@st.com> Thanks! Maxime
[toc] | [prev] | [next] | [standalone]
| From | Daniel Lezcano <daniel.lezcano@linaro.org> |
|---|---|
| Date | 2016-06-16 23:50 +0200 |
| Subject | [PATCH V2 08/63] clocksource/drivers/st_lpc: Convert init function to return error |
| Message-ID | <rKNkK-5aq-51@gated-at.bofh.it> |
| In reply to | #1424418 |
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/clksrc_st_lpc.c | 22 +++++++++++++---------
1 file changed, 13 insertions(+), 9 deletions(-)
diff --git a/drivers/clocksource/clksrc_st_lpc.c b/drivers/clocksource/clksrc_st_lpc.c
index 65ec467..c9022a9 100644
--- a/drivers/clocksource/clksrc_st_lpc.c
+++ b/drivers/clocksource/clksrc_st_lpc.c
@@ -92,7 +92,7 @@ static int __init st_clksrc_setup_clk(struct device_node *np)
return 0;
}
-static void __init st_clksrc_of_register(struct device_node *np)
+static int __init st_clksrc_of_register(struct device_node *np)
{
int ret;
uint32_t mode;
@@ -100,32 +100,36 @@ static void __init st_clksrc_of_register(struct device_node *np)
ret = of_property_read_u32(np, "st,lpc-mode", &mode);
if (ret) {
pr_err("clksrc-st-lpc: An LPC mode must be provided\n");
- return;
+ return ret;
}
/* LPC can either run as a Clocksource or in RTC or WDT mode */
if (mode != ST_LPC_MODE_CLKSRC)
- return;
+ return 0;
ddata.base = of_iomap(np, 0);
if (!ddata.base) {
pr_err("clksrc-st-lpc: Unable to map iomem\n");
- return;
+ return -ENXIO;
}
- if (st_clksrc_setup_clk(np)) {
+ ret = st_clksrc_setup_clk(np);
+ if (ret) {
iounmap(ddata.base);
- return;
+ return ret;
}
- if (st_clksrc_init()) {
+ ret = st_clksrc_init();
+ if (ret) {
clk_disable_unprepare(ddata.clk);
clk_put(ddata.clk);
iounmap(ddata.base);
- return;
+ return ret;
}
pr_info("clksrc-st-lpc: clocksource initialised - running @ %luHz\n",
clk_get_rate(ddata.clk));
+
+ return ret;
}
-CLOCKSOURCE_OF_DECLARE(ddata, "st,stih407-lpc", st_clksrc_of_register);
+CLOCKSOURCE_OF_DECLARE_RET(ddata, "st,stih407-lpc", st_clksrc_of_register);
--
1.9.1
[toc] | [prev] | [next] | [standalone]
| From | Patrice Chotard <patrice.chotard@st.com> |
|---|---|
| Date | 2016-06-20 10:10 +0200 |
| Subject | Re: [PATCH V2 08/63] clocksource/drivers/st_lpc: Convert init function to return error |
| Message-ID | <rM2rp-5J9-43@gated-at.bofh.it> |
| In reply to | #1424486 |
Hi Daniel
On 06/16/2016 11: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/clksrc_st_lpc.c | 22 +++++++++++++---------
> 1 file changed, 13 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/clocksource/clksrc_st_lpc.c b/drivers/clocksource/clksrc_st_lpc.c
> index 65ec467..c9022a9 100644
> --- a/drivers/clocksource/clksrc_st_lpc.c
> +++ b/drivers/clocksource/clksrc_st_lpc.c
> @@ -92,7 +92,7 @@ static int __init st_clksrc_setup_clk(struct device_node *np)
> return 0;
> }
>
> -static void __init st_clksrc_of_register(struct device_node *np)
> +static int __init st_clksrc_of_register(struct device_node *np)
> {
> int ret;
> uint32_t mode;
> @@ -100,32 +100,36 @@ static void __init st_clksrc_of_register(struct device_node *np)
> ret = of_property_read_u32(np, "st,lpc-mode", &mode);
> if (ret) {
> pr_err("clksrc-st-lpc: An LPC mode must be provided\n");
> - return;
> + return ret;
> }
>
> /* LPC can either run as a Clocksource or in RTC or WDT mode */
> if (mode != ST_LPC_MODE_CLKSRC)
> - return;
> + return 0;
>
> ddata.base = of_iomap(np, 0);
> if (!ddata.base) {
> pr_err("clksrc-st-lpc: Unable to map iomem\n");
> - return;
> + return -ENXIO;
> }
>
> - if (st_clksrc_setup_clk(np)) {
> + ret = st_clksrc_setup_clk(np);
> + if (ret) {
> iounmap(ddata.base);
> - return;
> + return ret;
> }
>
> - if (st_clksrc_init()) {
> + ret = st_clksrc_init();
> + if (ret) {
> clk_disable_unprepare(ddata.clk);
> clk_put(ddata.clk);
> iounmap(ddata.base);
> - return;
> + return ret;
> }
>
> pr_info("clksrc-st-lpc: clocksource initialised - running @ %luHz\n",
> clk_get_rate(ddata.clk));
> +
> + return ret;
> }
> -CLOCKSOURCE_OF_DECLARE(ddata, "st,stih407-lpc", st_clksrc_of_register);
> +CLOCKSOURCE_OF_DECLARE_RET(ddata, "st,stih407-lpc", st_clksrc_of_register);
Acked-by: Patrice Chotard <patrice.chotard@st.com>
[toc] | [prev] | [next] | [standalone]
| From | Maxime Coquelin <maxime.coquelin@st.com> |
|---|---|
| Date | 2016-06-20 14:20 +0200 |
| Subject | Re: [PATCH V2 08/63] clocksource/drivers/st_lpc: Convert init function to return error |
| Message-ID | <rM6lj-86N-1@gated-at.bofh.it> |
| In reply to | #1424486 |
On 06/16/2016 11: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/clksrc_st_lpc.c | 22 +++++++++++++--------- > 1 file changed, 13 insertions(+), 9 deletions(-) > Acked-by: Maxime Coquelin <maxime.coquelin@st.com> Thanks! Maxime
[toc] | [prev] | [next] | [standalone]
| From | Daniel Lezcano <daniel.lezcano@linaro.org> |
|---|---|
| Date | 2016-06-16 23:50 +0200 |
| Subject | [PATCH V2 13/63] clocksource/drivers/bcm2835_timer: Convert init function to return error |
| Message-ID | <rKNkL-5aq-55@gated-at.bofh.it> |
| In reply to | #1424418 |
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/bcm2835_timer.c | 40 +++++++++++++++++++++++++------------
1 file changed, 27 insertions(+), 13 deletions(-)
diff --git a/drivers/clocksource/bcm2835_timer.c b/drivers/clocksource/bcm2835_timer.c
index 6f28229..2dcf896 100644
--- a/drivers/clocksource/bcm2835_timer.c
+++ b/drivers/clocksource/bcm2835_timer.c
@@ -80,19 +80,24 @@ static irqreturn_t bcm2835_time_interrupt(int irq, void *dev_id)
}
}
-static void __init bcm2835_timer_init(struct device_node *node)
+static int __init bcm2835_timer_init(struct device_node *node)
{
void __iomem *base;
u32 freq;
- int irq;
+ int irq, ret;
struct bcm2835_timer *timer;
base = of_iomap(node, 0);
- if (!base)
- panic("Can't remap registers");
+ if (!base) {
+ pr_err("Can't remap registers");
+ return -ENXIO;
+ }
- if (of_property_read_u32(node, "clock-frequency", &freq))
- panic("Can't read clock-frequency");
+ ret = of_property_read_u32(node, "clock-frequency", &freq);
+ if (ret) {
+ pr_err("Can't read clock-frequency");
+ return ret;
+ }
system_clock = base + REG_COUNTER_LO;
sched_clock_register(bcm2835_sched_read, 32, freq);
@@ -101,12 +106,16 @@ static void __init bcm2835_timer_init(struct device_node *node)
freq, 300, 32, clocksource_mmio_readl_up);
irq = irq_of_parse_and_map(node, DEFAULT_TIMER);
- if (irq <= 0)
- panic("Can't parse IRQ");
+ if (irq <= 0) {
+ pr_err("Can't parse IRQ");
+ return -EINVAL;
+ }
timer = kzalloc(sizeof(*timer), GFP_KERNEL);
- if (!timer)
- panic("Can't allocate timer struct\n");
+ if (!timer) {
+ pr_err("Can't allocate timer struct\n");
+ return -ENOMEM;
+ }
timer->control = base + REG_CONTROL;
timer->compare = base + REG_COMPARE(DEFAULT_TIMER);
@@ -121,12 +130,17 @@ static void __init bcm2835_timer_init(struct device_node *node)
timer->act.dev_id = timer;
timer->act.handler = bcm2835_time_interrupt;
- if (setup_irq(irq, &timer->act))
- panic("Can't set up timer IRQ\n");
+ ret = setup_irq(irq, &timer->act);
+ if (ret) {
+ pr_err("Can't set up timer IRQ\n");
+ return ret;
+ }
clockevents_config_and_register(&timer->evt, freq, 0xf, 0xffffffff);
pr_info("bcm2835: system timer (irq = %d)\n", irq);
+
+ return 0;
}
-CLOCKSOURCE_OF_DECLARE(bcm2835, "brcm,bcm2835-system-timer",
+CLOCKSOURCE_OF_DECLARE_RET(bcm2835, "brcm,bcm2835-system-timer",
bcm2835_timer_init);
--
1.9.1
[toc] | [prev] | [next] | [standalone]
| From | Daniel Lezcano <daniel.lezcano@linaro.org> |
|---|---|
| Date | 2016-06-16 23:50 +0200 |
| Subject | [PATCH V2 04/63] clocksource/drivers/mkt_timer: Convert init function to return error |
| Message-ID | <rKNkL-5aq-65@gated-at.bofh.it> |
| In reply to | #1424418 |
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/mtk_timer.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/drivers/clocksource/mtk_timer.c b/drivers/clocksource/mtk_timer.c
index 7e583f8..432a2c0 100644
--- a/drivers/clocksource/mtk_timer.c
+++ b/drivers/clocksource/mtk_timer.c
@@ -181,7 +181,7 @@ static void mtk_timer_enable_irq(struct mtk_clock_event_device *evt, u8 timer)
evt->gpt_base + GPT_IRQ_EN_REG);
}
-static void __init mtk_timer_init(struct device_node *node)
+static int __init mtk_timer_init(struct device_node *node)
{
struct mtk_clock_event_device *evt;
struct resource res;
@@ -190,7 +190,7 @@ static void __init mtk_timer_init(struct device_node *node)
evt = kzalloc(sizeof(*evt), GFP_KERNEL);
if (!evt)
- return;
+ return -ENOMEM;
evt->dev.name = "mtk_tick";
evt->dev.rating = 300;
@@ -248,7 +248,7 @@ static void __init mtk_timer_init(struct device_node *node)
mtk_timer_enable_irq(evt, GPT_CLK_EVT);
- return;
+ return 0;
err_clk_disable:
clk_disable_unprepare(clk);
@@ -262,5 +262,7 @@ err_mem:
release_mem_region(res.start, resource_size(&res));
err_kzalloc:
kfree(evt);
+
+ return -EINVAL;
}
-CLOCKSOURCE_OF_DECLARE(mtk_mt6577, "mediatek,mt6577-timer", mtk_timer_init);
+CLOCKSOURCE_OF_DECLARE_RET(mtk_mt6577, "mediatek,mt6577-timer", mtk_timer_init);
--
1.9.1
[toc] | [prev] | [next] | [standalone]
| From | Matthias Brugger <matthias.bgg@gmail.com> |
|---|---|
| Date | 2016-06-17 18:20 +0200 |
| Subject | Re: [PATCH V2 04/63] clocksource/drivers/mkt_timer: Convert init function to return error |
| Message-ID | <rL4EW-my-29@gated-at.bofh.it> |
| In reply to | #1424490 |
On 16/06/16 23:26, 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/mtk_timer.c | 10 ++++++----
> 1 file changed, 6 insertions(+), 4 deletions(-)
>
Acked-by: Matthias Brugger <matthias.bgg@gmail.com>
> diff --git a/drivers/clocksource/mtk_timer.c b/drivers/clocksource/mtk_timer.c
> index 7e583f8..432a2c0 100644
> --- a/drivers/clocksource/mtk_timer.c
> +++ b/drivers/clocksource/mtk_timer.c
> @@ -181,7 +181,7 @@ static void mtk_timer_enable_irq(struct mtk_clock_event_device *evt, u8 timer)
> evt->gpt_base + GPT_IRQ_EN_REG);
> }
>
> -static void __init mtk_timer_init(struct device_node *node)
> +static int __init mtk_timer_init(struct device_node *node)
> {
> struct mtk_clock_event_device *evt;
> struct resource res;
> @@ -190,7 +190,7 @@ static void __init mtk_timer_init(struct device_node *node)
>
> evt = kzalloc(sizeof(*evt), GFP_KERNEL);
> if (!evt)
> - return;
> + return -ENOMEM;
>
> evt->dev.name = "mtk_tick";
> evt->dev.rating = 300;
> @@ -248,7 +248,7 @@ static void __init mtk_timer_init(struct device_node *node)
>
> mtk_timer_enable_irq(evt, GPT_CLK_EVT);
>
> - return;
> + return 0;
>
> err_clk_disable:
> clk_disable_unprepare(clk);
> @@ -262,5 +262,7 @@ err_mem:
> release_mem_region(res.start, resource_size(&res));
> err_kzalloc:
> kfree(evt);
> +
> + return -EINVAL;
> }
> -CLOCKSOURCE_OF_DECLARE(mtk_mt6577, "mediatek,mt6577-timer", mtk_timer_init);
> +CLOCKSOURCE_OF_DECLARE_RET(mtk_mt6577, "mediatek,mt6577-timer", mtk_timer_init);
>
[toc] | [prev] | [next] | [standalone]
Page 4 of 5 — ← Prev page 1 2 3 [4] 5 Next page →
Back to top | Article view | linux.kernel
csiph-web