All of lore.kernel.org
 help / color / mirror / Atom feed
* [PULL] clockevents/clocksource fixes for 4.8-rc3
@ 2016-08-26 14:20 ` Daniel Lezcano
  0 siblings, 0 replies; 12+ messages in thread
From: Daniel Lezcano @ 2016-08-26 14:20 UTC (permalink / raw)
  To: Thomas Gleixner, Ingo Molnar
  Cc: Linux Kernel Mailing List, linux-arm-kernel, Alexandre Belloni,
	Chen-Yu Tsai, Marcin Nowakowski


Hi Thomas, Ingo,

this is the second round of fixes for 4.8-rc3.

 - Add the mck clock enablement for the ETM/ETB driver (Alexandre Belloni)

 - Clear the interrupts after stopping the timer in order to prevent
spurious interrupt at init time (Chen-Yu Tsai)

 - Fix a memory corruption on pistachio by replacing a reference to
pointer by the pointer itself (Marcin Nowakowski)

Thanks !

  -- Daniel

The following changes since commit aa8c0f1ad7e862147f4efb32bbb71ff66eb38caa:

  clocksource/drivers/pxa: Fix include files for compilation (2016-08-24
11:16:38 +0200)

are available in the git repository at:

  http://git.linaro.org/people/daniel.lezcano/linux.git
clockevents/4.8-fixes

for you to fetch changes up to b53e7d000d9e6e9fd2c6eb6b82d2783c67fd599e:

  clocksource/drivers/sun4i: Clear interrupts after stopping timer in
probe function (2016-08-26 15:56:01 +0200)

----------------------------------------------------------------
Alexandre Belloni (1):
      clocksource/drivers/timer-atmel-pit: Enable mck clock

Chen-Yu Tsai (1):
      clocksource/drivers/sun4i: Clear interrupts after stopping timer
in probe function

Marcin Nowakowski (1):
      drivers/clocksource/pistachio: Fix memory corruption in init

 drivers/clocksource/sun4i_timer.c     | 9 ++++++++-
 drivers/clocksource/time-pistachio.c  | 8 ++++----
 drivers/clocksource/timer-atmel-pit.c | 6 ++++++
 3 files changed, 18 insertions(+), 5 deletions(-)

-- 
 <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

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

* [PULL] clockevents/clocksource fixes for 4.8-rc3
@ 2016-08-26 14:20 ` Daniel Lezcano
  0 siblings, 0 replies; 12+ messages in thread
From: Daniel Lezcano @ 2016-08-26 14:20 UTC (permalink / raw)
  To: linux-arm-kernel


Hi Thomas, Ingo,

this is the second round of fixes for 4.8-rc3.

 - Add the mck clock enablement for the ETM/ETB driver (Alexandre Belloni)

 - Clear the interrupts after stopping the timer in order to prevent
spurious interrupt at init time (Chen-Yu Tsai)

 - Fix a memory corruption on pistachio by replacing a reference to
pointer by the pointer itself (Marcin Nowakowski)

Thanks !

  -- Daniel

The following changes since commit aa8c0f1ad7e862147f4efb32bbb71ff66eb38caa:

  clocksource/drivers/pxa: Fix include files for compilation (2016-08-24
11:16:38 +0200)

are available in the git repository at:

  http://git.linaro.org/people/daniel.lezcano/linux.git
clockevents/4.8-fixes

for you to fetch changes up to b53e7d000d9e6e9fd2c6eb6b82d2783c67fd599e:

  clocksource/drivers/sun4i: Clear interrupts after stopping timer in
probe function (2016-08-26 15:56:01 +0200)

----------------------------------------------------------------
Alexandre Belloni (1):
      clocksource/drivers/timer-atmel-pit: Enable mck clock

Chen-Yu Tsai (1):
      clocksource/drivers/sun4i: Clear interrupts after stopping timer
in probe function

Marcin Nowakowski (1):
      drivers/clocksource/pistachio: Fix memory corruption in init

 drivers/clocksource/sun4i_timer.c     | 9 ++++++++-
 drivers/clocksource/time-pistachio.c  | 8 ++++----
 drivers/clocksource/timer-atmel-pit.c | 6 ++++++
 3 files changed, 18 insertions(+), 5 deletions(-)

-- 
 <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

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

* [PATCH 1/3] clocksource/drivers/timer-atmel-pit: Enable mck clock
  2016-08-26 14:20 ` Daniel Lezcano
@ 2016-08-26 14:20   ` Daniel Lezcano
  -1 siblings, 0 replies; 12+ messages in thread
From: Daniel Lezcano @ 2016-08-26 14:20 UTC (permalink / raw)
  To: tglx, mingo
  Cc: linux-kernel, linux-arm-kernel, Alexandre Belloni, Nicolas Ferre,
	Olivier Schonken

From: Alexandre Belloni <alexandre.belloni@free-electrons.com>

mck is needed to get the PIT working. Explicitly prepare_enable it instead
of assuming it is enabled.

This solves an issue where the system is freezing when the ETM/ETB drivers
are enabled.

Reported-by: Olivier Schonken <olivier.schonken@gmail.com>
Reviewed-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
---
 drivers/clocksource/timer-atmel-pit.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/clocksource/timer-atmel-pit.c b/drivers/clocksource/timer-atmel-pit.c
index 1ffac0c..3494bc5 100644
--- a/drivers/clocksource/timer-atmel-pit.c
+++ b/drivers/clocksource/timer-atmel-pit.c
@@ -261,6 +261,12 @@ static int __init at91sam926x_pit_dt_init(struct device_node *node)
 		return PTR_ERR(data->mck);
 	}
 
+	ret = clk_prepare_enable(data->mck);
+	if (ret) {
+		pr_err("Unable to enable mck\n");
+		return ret;
+	}
+
 	/* Get the interrupts property */
 	data->irq = irq_of_parse_and_map(node, 0);
 	if (!data->irq) {
-- 
1.9.1

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

* [PATCH 1/3] clocksource/drivers/timer-atmel-pit: Enable mck clock
@ 2016-08-26 14:20   ` Daniel Lezcano
  0 siblings, 0 replies; 12+ messages in thread
From: Daniel Lezcano @ 2016-08-26 14:20 UTC (permalink / raw)
  To: linux-arm-kernel

From: Alexandre Belloni <alexandre.belloni@free-electrons.com>

mck is needed to get the PIT working. Explicitly prepare_enable it instead
of assuming it is enabled.

This solves an issue where the system is freezing when the ETM/ETB drivers
are enabled.

Reported-by: Olivier Schonken <olivier.schonken@gmail.com>
Reviewed-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
---
 drivers/clocksource/timer-atmel-pit.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/clocksource/timer-atmel-pit.c b/drivers/clocksource/timer-atmel-pit.c
index 1ffac0c..3494bc5 100644
--- a/drivers/clocksource/timer-atmel-pit.c
+++ b/drivers/clocksource/timer-atmel-pit.c
@@ -261,6 +261,12 @@ static int __init at91sam926x_pit_dt_init(struct device_node *node)
 		return PTR_ERR(data->mck);
 	}
 
+	ret = clk_prepare_enable(data->mck);
+	if (ret) {
+		pr_err("Unable to enable mck\n");
+		return ret;
+	}
+
 	/* Get the interrupts property */
 	data->irq = irq_of_parse_and_map(node, 0);
 	if (!data->irq) {
-- 
1.9.1

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

* [PATCH 2/3] drivers/clocksource/pistachio: Fix memory corruption in init
  2016-08-26 14:20   ` Daniel Lezcano
@ 2016-08-26 14:20     ` Daniel Lezcano
  -1 siblings, 0 replies; 12+ messages in thread
From: Daniel Lezcano @ 2016-08-26 14:20 UTC (permalink / raw)
  To: tglx, mingo; +Cc: linux-kernel, linux-arm-kernel, Marcin Nowakowski

From: Marcin Nowakowski <marcin.nowakowski@imgtec.com>

Driver init code incorrectly uses the block base address and as a result
clears clocksource structure's fields instead of the hardware registers.

Commit 09a998201649 ("timekeeping: Lift clocksource cacheline
restriction") has changed the offsets within pistachio_clocksource
structure and what has previously gone unnoticed now leads to a kernel
panic during boot.

Signed-off-by: Marcin Nowakowski <marcin.nowakowski@imgtec.com>
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
---
 drivers/clocksource/time-pistachio.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/clocksource/time-pistachio.c b/drivers/clocksource/time-pistachio.c
index a7d9a08..a8e6c7d 100644
--- a/drivers/clocksource/time-pistachio.c
+++ b/drivers/clocksource/time-pistachio.c
@@ -202,10 +202,10 @@ static int __init pistachio_clksrc_of_init(struct device_node *node)
 	rate = clk_get_rate(fast_clk);
 
 	/* Disable irq's for clocksource usage */
-	gpt_writel(&pcs_gpt.base, 0, TIMER_IRQ_MASK, 0);
-	gpt_writel(&pcs_gpt.base, 0, TIMER_IRQ_MASK, 1);
-	gpt_writel(&pcs_gpt.base, 0, TIMER_IRQ_MASK, 2);
-	gpt_writel(&pcs_gpt.base, 0, TIMER_IRQ_MASK, 3);
+	gpt_writel(pcs_gpt.base, 0, TIMER_IRQ_MASK, 0);
+	gpt_writel(pcs_gpt.base, 0, TIMER_IRQ_MASK, 1);
+	gpt_writel(pcs_gpt.base, 0, TIMER_IRQ_MASK, 2);
+	gpt_writel(pcs_gpt.base, 0, TIMER_IRQ_MASK, 3);
 
 	/* Enable timer block */
 	writel(TIMER_ME_GLOBAL, pcs_gpt.base);
-- 
1.9.1

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

* [PATCH 2/3] drivers/clocksource/pistachio: Fix memory corruption in init
@ 2016-08-26 14:20     ` Daniel Lezcano
  0 siblings, 0 replies; 12+ messages in thread
From: Daniel Lezcano @ 2016-08-26 14:20 UTC (permalink / raw)
  To: linux-arm-kernel

From: Marcin Nowakowski <marcin.nowakowski@imgtec.com>

Driver init code incorrectly uses the block base address and as a result
clears clocksource structure's fields instead of the hardware registers.

Commit 09a998201649 ("timekeeping: Lift clocksource cacheline
restriction") has changed the offsets within pistachio_clocksource
structure and what has previously gone unnoticed now leads to a kernel
panic during boot.

Signed-off-by: Marcin Nowakowski <marcin.nowakowski@imgtec.com>
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
---
 drivers/clocksource/time-pistachio.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/clocksource/time-pistachio.c b/drivers/clocksource/time-pistachio.c
index a7d9a08..a8e6c7d 100644
--- a/drivers/clocksource/time-pistachio.c
+++ b/drivers/clocksource/time-pistachio.c
@@ -202,10 +202,10 @@ static int __init pistachio_clksrc_of_init(struct device_node *node)
 	rate = clk_get_rate(fast_clk);
 
 	/* Disable irq's for clocksource usage */
-	gpt_writel(&pcs_gpt.base, 0, TIMER_IRQ_MASK, 0);
-	gpt_writel(&pcs_gpt.base, 0, TIMER_IRQ_MASK, 1);
-	gpt_writel(&pcs_gpt.base, 0, TIMER_IRQ_MASK, 2);
-	gpt_writel(&pcs_gpt.base, 0, TIMER_IRQ_MASK, 3);
+	gpt_writel(pcs_gpt.base, 0, TIMER_IRQ_MASK, 0);
+	gpt_writel(pcs_gpt.base, 0, TIMER_IRQ_MASK, 1);
+	gpt_writel(pcs_gpt.base, 0, TIMER_IRQ_MASK, 2);
+	gpt_writel(pcs_gpt.base, 0, TIMER_IRQ_MASK, 3);
 
 	/* Enable timer block */
 	writel(TIMER_ME_GLOBAL, pcs_gpt.base);
-- 
1.9.1

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

* [PATCH 3/3] clocksource/drivers/sun4i: Clear interrupts after stopping timer in probe function
  2016-08-26 14:20   ` Daniel Lezcano
@ 2016-08-26 14:20     ` Daniel Lezcano
  -1 siblings, 0 replies; 12+ messages in thread
From: Daniel Lezcano @ 2016-08-26 14:20 UTC (permalink / raw)
  To: tglx, mingo
  Cc: linux-kernel, linux-arm-kernel, Chen-Yu Tsai, stable, Maxime Ripard

From: Chen-Yu Tsai <wens@csie.org>

The bootloader (U-boot) sometimes uses this timer for various delays.
It uses it as a ongoing counter, and does comparisons on the current
counter value. The timer counter is never stopped.

In some cases when the user interacts with the bootloader, or lets
it idle for some time before loading Linux, the timer may expire,
and an interrupt will be pending. This results in an unexpected
interrupt when the timer interrupt is enabled by the kernel, at
which point the event_handler isn't set yet. This results in a NULL
pointer dereference exception, panic, and no way to reboot.

Clear any pending interrupts after we stop the timer in the probe
function to avoid this.

Cc: stable@vger.kernel.org
Signed-off-by: Chen-Yu Tsai <wens@csie.org>
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com>
---
 drivers/clocksource/sun4i_timer.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/clocksource/sun4i_timer.c b/drivers/clocksource/sun4i_timer.c
index 97669ee..c83452c 100644
--- a/drivers/clocksource/sun4i_timer.c
+++ b/drivers/clocksource/sun4i_timer.c
@@ -123,12 +123,16 @@ static struct clock_event_device sun4i_clockevent = {
 	.set_next_event = sun4i_clkevt_next_event,
 };
 
+static void sun4i_timer_clear_interrupt(void)
+{
+	writel(TIMER_IRQ_EN(0), timer_base + TIMER_IRQ_ST_REG);
+}
 
 static irqreturn_t sun4i_timer_interrupt(int irq, void *dev_id)
 {
 	struct clock_event_device *evt = (struct clock_event_device *)dev_id;
 
-	writel(0x1, timer_base + TIMER_IRQ_ST_REG);
+	sun4i_timer_clear_interrupt();
 	evt->event_handler(evt);
 
 	return IRQ_HANDLED;
@@ -208,6 +212,9 @@ static int __init sun4i_timer_init(struct device_node *node)
 	/* Make sure timer is stopped before playing with interrupts */
 	sun4i_clkevt_time_stop(0);
 
+	/* clear timer0 interrupt */
+	sun4i_timer_clear_interrupt();
+
 	sun4i_clockevent.cpumask = cpu_possible_mask;
 	sun4i_clockevent.irq = irq;
 
-- 
1.9.1

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

* [PATCH 3/3] clocksource/drivers/sun4i: Clear interrupts after stopping timer in probe function
@ 2016-08-26 14:20     ` Daniel Lezcano
  0 siblings, 0 replies; 12+ messages in thread
From: Daniel Lezcano @ 2016-08-26 14:20 UTC (permalink / raw)
  To: linux-arm-kernel

From: Chen-Yu Tsai <wens@csie.org>

The bootloader (U-boot) sometimes uses this timer for various delays.
It uses it as a ongoing counter, and does comparisons on the current
counter value. The timer counter is never stopped.

In some cases when the user interacts with the bootloader, or lets
it idle for some time before loading Linux, the timer may expire,
and an interrupt will be pending. This results in an unexpected
interrupt when the timer interrupt is enabled by the kernel, at
which point the event_handler isn't set yet. This results in a NULL
pointer dereference exception, panic, and no way to reboot.

Clear any pending interrupts after we stop the timer in the probe
function to avoid this.

Cc: stable at vger.kernel.org
Signed-off-by: Chen-Yu Tsai <wens@csie.org>
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com>
---
 drivers/clocksource/sun4i_timer.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/clocksource/sun4i_timer.c b/drivers/clocksource/sun4i_timer.c
index 97669ee..c83452c 100644
--- a/drivers/clocksource/sun4i_timer.c
+++ b/drivers/clocksource/sun4i_timer.c
@@ -123,12 +123,16 @@ static struct clock_event_device sun4i_clockevent = {
 	.set_next_event = sun4i_clkevt_next_event,
 };
 
+static void sun4i_timer_clear_interrupt(void)
+{
+	writel(TIMER_IRQ_EN(0), timer_base + TIMER_IRQ_ST_REG);
+}
 
 static irqreturn_t sun4i_timer_interrupt(int irq, void *dev_id)
 {
 	struct clock_event_device *evt = (struct clock_event_device *)dev_id;
 
-	writel(0x1, timer_base + TIMER_IRQ_ST_REG);
+	sun4i_timer_clear_interrupt();
 	evt->event_handler(evt);
 
 	return IRQ_HANDLED;
@@ -208,6 +212,9 @@ static int __init sun4i_timer_init(struct device_node *node)
 	/* Make sure timer is stopped before playing with interrupts */
 	sun4i_clkevt_time_stop(0);
 
+	/* clear timer0 interrupt */
+	sun4i_timer_clear_interrupt();
+
 	sun4i_clockevent.cpumask = cpu_possible_mask;
 	sun4i_clockevent.irq = irq;
 
-- 
1.9.1

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

* Re: [PATCH 1/3] clocksource/drivers/timer-atmel-pit: Enable mck clock
  2016-08-26 14:20   ` Daniel Lezcano
@ 2016-08-30  9:55     ` Mark Rutland
  -1 siblings, 0 replies; 12+ messages in thread
From: Mark Rutland @ 2016-08-30  9:55 UTC (permalink / raw)
  To: Daniel Lezcano
  Cc: tglx, mingo, Nicolas Ferre, Olivier Schonken, Alexandre Belloni,
	linux-kernel, linux-arm-kernel

Hi,

On Fri, Aug 26, 2016 at 04:20:43PM +0200, Daniel Lezcano wrote:
> From: Alexandre Belloni <alexandre.belloni@free-electrons.com>
> 
> mck is needed to get the PIT working. Explicitly prepare_enable it instead
> of assuming it is enabled.
> 
> This solves an issue where the system is freezing when the ETM/ETB drivers
> are enabled.
> 
> Reported-by: Olivier Schonken <olivier.schonken@gmail.com>
> Reviewed-by: Boris Brezillon <boris.brezillon@free-electrons.com>
> Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>
> Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
> ---
>  drivers/clocksource/timer-atmel-pit.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/drivers/clocksource/timer-atmel-pit.c b/drivers/clocksource/timer-atmel-pit.c
> index 1ffac0c..3494bc5 100644
> --- a/drivers/clocksource/timer-atmel-pit.c
> +++ b/drivers/clocksource/timer-atmel-pit.c
> @@ -261,6 +261,12 @@ static int __init at91sam926x_pit_dt_init(struct device_node *node)
>  		return PTR_ERR(data->mck);
>  	}
>  
> +	ret = clk_prepare_enable(data->mck);
> +	if (ret) {
> +		pr_err("Unable to enable mck\n");
> +		return ret;
> +	}
> +

Apologies if the below is a duplicate report.

When building v4.8-rc4 multi_v7_defconfig, I get:

[mark@leverpostej:~/src/linux]% uselinaro 15.08 make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- -j10 -s
drivers/clocksource/timer-atmel-pit.c: In function 'at91sam926x_pit_dt_init':
drivers/clocksource/timer-atmel-pit.c:264:2: error: 'ret' undeclared (first use in this function)
  ret = clk_prepare_enable(data->mck);
  ^
drivers/clocksource/timer-atmel-pit.c:264:2: note: each undeclared identifier is reported only once for each function it appears in
make[2]: *** [drivers/clocksource/timer-atmel-pit.o] Error 1
make[1]: *** [drivers/clocksource] Error 2
make[1]: *** Waiting for unfinished jobs....
make: *** [drivers] Error 2

As far as I can see, there's no local 'ret' variable. Locally I've fixed this
up with:

----8----
diff --git a/drivers/clocksource/timer-atmel-pit.c b/drivers/clocksource/timer-atmel-pit.c
index 3494bc5..7f0f5b2 100644
--- a/drivers/clocksource/timer-atmel-pit.c
+++ b/drivers/clocksource/timer-atmel-pit.c
@@ -240,6 +240,7 @@ static int __init at91sam926x_pit_common_init(struct pit_data *data)
 static int __init at91sam926x_pit_dt_init(struct device_node *node)
 {
        struct pit_data *data;
+       int ret;
 
        data = kzalloc(sizeof(*data), GFP_KERNEL);
        if (!data)
---->8----

Thanks,
Mark.

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

* [PATCH 1/3] clocksource/drivers/timer-atmel-pit: Enable mck clock
@ 2016-08-30  9:55     ` Mark Rutland
  0 siblings, 0 replies; 12+ messages in thread
From: Mark Rutland @ 2016-08-30  9:55 UTC (permalink / raw)
  To: linux-arm-kernel

Hi,

On Fri, Aug 26, 2016 at 04:20:43PM +0200, Daniel Lezcano wrote:
> From: Alexandre Belloni <alexandre.belloni@free-electrons.com>
> 
> mck is needed to get the PIT working. Explicitly prepare_enable it instead
> of assuming it is enabled.
> 
> This solves an issue where the system is freezing when the ETM/ETB drivers
> are enabled.
> 
> Reported-by: Olivier Schonken <olivier.schonken@gmail.com>
> Reviewed-by: Boris Brezillon <boris.brezillon@free-electrons.com>
> Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>
> Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
> ---
>  drivers/clocksource/timer-atmel-pit.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/drivers/clocksource/timer-atmel-pit.c b/drivers/clocksource/timer-atmel-pit.c
> index 1ffac0c..3494bc5 100644
> --- a/drivers/clocksource/timer-atmel-pit.c
> +++ b/drivers/clocksource/timer-atmel-pit.c
> @@ -261,6 +261,12 @@ static int __init at91sam926x_pit_dt_init(struct device_node *node)
>  		return PTR_ERR(data->mck);
>  	}
>  
> +	ret = clk_prepare_enable(data->mck);
> +	if (ret) {
> +		pr_err("Unable to enable mck\n");
> +		return ret;
> +	}
> +

Apologies if the below is a duplicate report.

When building v4.8-rc4 multi_v7_defconfig, I get:

[mark at leverpostej:~/src/linux]% uselinaro 15.08 make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- -j10 -s
drivers/clocksource/timer-atmel-pit.c: In function 'at91sam926x_pit_dt_init':
drivers/clocksource/timer-atmel-pit.c:264:2: error: 'ret' undeclared (first use in this function)
  ret = clk_prepare_enable(data->mck);
  ^
drivers/clocksource/timer-atmel-pit.c:264:2: note: each undeclared identifier is reported only once for each function it appears in
make[2]: *** [drivers/clocksource/timer-atmel-pit.o] Error 1
make[1]: *** [drivers/clocksource] Error 2
make[1]: *** Waiting for unfinished jobs....
make: *** [drivers] Error 2

As far as I can see, there's no local 'ret' variable. Locally I've fixed this
up with:

----8----
diff --git a/drivers/clocksource/timer-atmel-pit.c b/drivers/clocksource/timer-atmel-pit.c
index 3494bc5..7f0f5b2 100644
--- a/drivers/clocksource/timer-atmel-pit.c
+++ b/drivers/clocksource/timer-atmel-pit.c
@@ -240,6 +240,7 @@ static int __init at91sam926x_pit_common_init(struct pit_data *data)
 static int __init at91sam926x_pit_dt_init(struct device_node *node)
 {
        struct pit_data *data;
+       int ret;
 
        data = kzalloc(sizeof(*data), GFP_KERNEL);
        if (!data)
---->8----

Thanks,
Mark.

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

* Re: [PATCH 1/3] clocksource/drivers/timer-atmel-pit: Enable mck clock
  2016-08-30  9:55     ` Mark Rutland
@ 2016-08-30 10:15       ` Daniel Lezcano
  -1 siblings, 0 replies; 12+ messages in thread
From: Daniel Lezcano @ 2016-08-30 10:15 UTC (permalink / raw)
  To: Mark Rutland
  Cc: tglx, mingo, Nicolas Ferre, Olivier Schonken, Alexandre Belloni,
	linux-kernel, linux-arm-kernel

On 08/30/2016 11:55 AM, Mark Rutland wrote:
> Hi,
> 
> On Fri, Aug 26, 2016 at 04:20:43PM +0200, Daniel Lezcano wrote:
>> From: Alexandre Belloni <alexandre.belloni@free-electrons.com>
>>
>> mck is needed to get the PIT working. Explicitly prepare_enable it instead
>> of assuming it is enabled.
>>
>> This solves an issue where the system is freezing when the ETM/ETB drivers
>> are enabled.
>>
>> Reported-by: Olivier Schonken <olivier.schonken@gmail.com>
>> Reviewed-by: Boris Brezillon <boris.brezillon@free-electrons.com>
>> Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>
>> Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
>> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
>> ---

Hi Mark,

It is fixed.

https://git.kernel.org/cgit/linux/kernel/git/tip/tip.git/commit/?h=timers/urgent&id=98744b408c757901df57fa50cbd5826245dc3a1f

Thanks for reporting the issue and for the fix.

  -- 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

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

* [PATCH 1/3] clocksource/drivers/timer-atmel-pit: Enable mck clock
@ 2016-08-30 10:15       ` Daniel Lezcano
  0 siblings, 0 replies; 12+ messages in thread
From: Daniel Lezcano @ 2016-08-30 10:15 UTC (permalink / raw)
  To: linux-arm-kernel

On 08/30/2016 11:55 AM, Mark Rutland wrote:
> Hi,
> 
> On Fri, Aug 26, 2016 at 04:20:43PM +0200, Daniel Lezcano wrote:
>> From: Alexandre Belloni <alexandre.belloni@free-electrons.com>
>>
>> mck is needed to get the PIT working. Explicitly prepare_enable it instead
>> of assuming it is enabled.
>>
>> This solves an issue where the system is freezing when the ETM/ETB drivers
>> are enabled.
>>
>> Reported-by: Olivier Schonken <olivier.schonken@gmail.com>
>> Reviewed-by: Boris Brezillon <boris.brezillon@free-electrons.com>
>> Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>
>> Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
>> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
>> ---

Hi Mark,

It is fixed.

https://git.kernel.org/cgit/linux/kernel/git/tip/tip.git/commit/?h=timers/urgent&id=98744b408c757901df57fa50cbd5826245dc3a1f

Thanks for reporting the issue and for the fix.

  -- 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

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

end of thread, other threads:[~2016-08-30 10:16 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-26 14:20 [PULL] clockevents/clocksource fixes for 4.8-rc3 Daniel Lezcano
2016-08-26 14:20 ` Daniel Lezcano
2016-08-26 14:20 ` [PATCH 1/3] clocksource/drivers/timer-atmel-pit: Enable mck clock Daniel Lezcano
2016-08-26 14:20   ` Daniel Lezcano
2016-08-26 14:20   ` [PATCH 2/3] drivers/clocksource/pistachio: Fix memory corruption in init Daniel Lezcano
2016-08-26 14:20     ` Daniel Lezcano
2016-08-26 14:20   ` [PATCH 3/3] clocksource/drivers/sun4i: Clear interrupts after stopping timer in probe function Daniel Lezcano
2016-08-26 14:20     ` Daniel Lezcano
2016-08-30  9:55   ` [PATCH 1/3] clocksource/drivers/timer-atmel-pit: Enable mck clock Mark Rutland
2016-08-30  9:55     ` Mark Rutland
2016-08-30 10:15     ` Daniel Lezcano
2016-08-30 10:15       ` Daniel Lezcano

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.