* [PATCH] clocksource: j-core: type fix init function return code
@ 2016-07-26 12:31 Arnd Bergmann
2016-07-27 5:25 ` Rich Felker
0 siblings, 1 reply; 4+ messages in thread
From: Arnd Bergmann @ 2016-07-26 12:31 UTC (permalink / raw)
To: Rich Felker; +Cc: Arnd Bergmann, Daniel Lezcano, Thomas Gleixner, linux-kernel
The CLOCKSOURCE_OF_DECLARE now takes a function that returns an 'int', but a this
new clocksource driver has just appeared in linux-next and causes a warning because
it has the old 'void' return value:
In file included from ../include/linux/clocksource.h:18:0,
from ../include/linux/clockchips.h:13,
from ../drivers/clocksource/jcore-pit.c:14:
include/linux/of.h:1006:20: error: comparison of distinct pointer types lacks a cast [-Werror]
.data = (fn == (fn_type)NULL) ? fn : fn }
^
This adapts the jcore_pit_init() function to the correct return type.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Fixes: e0aa0655c60b ("clocksource: add J-Core timer/clocksource driver")
---
The patch that introduces the warnign currently only exists in the linux-sh git
tree and showed up in linux-next this week.
---
drivers/clocksource/jcore-pit.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/drivers/clocksource/jcore-pit.c b/drivers/clocksource/jcore-pit.c
index 373b9f954a5c..4a2f7803624b 100644
--- a/drivers/clocksource/jcore-pit.c
+++ b/drivers/clocksource/jcore-pit.c
@@ -154,7 +154,7 @@ static irqreturn_t jcore_timer_interrupt(int irq, void *dev_id)
return IRQ_HANDLED;
}
-static void __init jcore_pit_init(struct device_node *node)
+static int __init jcore_pit_init(struct device_node *node)
{
int err;
__iomem void *pit_base;
@@ -169,12 +169,14 @@ static void __init jcore_pit_init(struct device_node *node)
pit_base = of_iomap(node, 0);
if (!pit_base) {
pr_err("Error: Cannot map base address for J-Core PIT\n");
+ err = -ENXIO;
goto out;
}
pit_irq = irq_of_parse_and_map(node, 0);
if (!pit_irq) {
pr_err("Error: J-Core PIT has no IRQ\n");
+ err = -ENXIO;
goto out;
}
@@ -183,6 +185,7 @@ static void __init jcore_pit_init(struct device_node *node)
cs = kzalloc(sizeof *cs, GFP_KERNEL);
if (!cs) {
pr_err("Failed to allocate memory for clocksource\n");
+ err = ENOMEM;
goto out;
}
jcore_cs = &cs->cs;
@@ -207,12 +210,14 @@ static void __init jcore_pit_init(struct device_node *node)
pit_percpu = alloc_percpu(struct jcore_pit);
if (!pit_percpu) {
pr_err("Failed to allocate memory for clock event device\n");
+ err = ENOMEM;
goto out;
}
nb = kzalloc(sizeof *nb, GFP_KERNEL);
if (!nb) {
pr_err("Failed to allocate memory for J-Core PIT notifier\n");
+ err = ENOMEM;
goto out;
}
@@ -268,10 +273,11 @@ static void __init jcore_pit_init(struct device_node *node)
jcore_pit_local_init(this_cpu_ptr(pit_percpu));
- return;
+ return 0;
out:
pr_err("Could not initialize J-Core PIT driver\n");
+ return err;
}
CLOCKSOURCE_OF_DECLARE(jcore_pit, "jcore,pit", jcore_pit_init);
--
2.9.0
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] clocksource: j-core: type fix init function return code
2016-07-26 12:31 [PATCH] clocksource: j-core: type fix init function return code Arnd Bergmann
@ 2016-07-27 5:25 ` Rich Felker
2016-07-27 8:00 ` Arnd Bergmann
0 siblings, 1 reply; 4+ messages in thread
From: Rich Felker @ 2016-07-27 5:25 UTC (permalink / raw)
To: Arnd Bergmann; +Cc: Daniel Lezcano, Thomas Gleixner, linux-kernel
On Tue, Jul 26, 2016 at 02:31:29PM +0200, Arnd Bergmann wrote:
> The CLOCKSOURCE_OF_DECLARE now takes a function that returns an 'int', but a this
> new clocksource driver has just appeared in linux-next and causes a warning because
> it has the old 'void' return value:
>
> In file included from ../include/linux/clocksource.h:18:0,
> from ../include/linux/clockchips.h:13,
> from ../drivers/clocksource/jcore-pit.c:14:
> include/linux/of.h:1006:20: error: comparison of distinct pointer types lacks a cast [-Werror]
> .data = (fn == (fn_type)NULL) ? fn : fn }
> ^
>
> This adapts the jcore_pit_init() function to the correct return type.
>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> Fixes: e0aa0655c60b ("clocksource: add J-Core timer/clocksource driver")
> ---
> The patch that introduces the warnign currently only exists in the linux-sh git
> tree and showed up in linux-next this week.
I've removed the commit from my for-next branch since it's not
appropriate to go upstream through my tree. Your patch should still be
applied in the proper subsystem tree, though, I think. Daniel?
Rich
> ---
> drivers/clocksource/jcore-pit.c | 10 ++++++++--
> 1 file changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/clocksource/jcore-pit.c b/drivers/clocksource/jcore-pit.c
> index 373b9f954a5c..4a2f7803624b 100644
> --- a/drivers/clocksource/jcore-pit.c
> +++ b/drivers/clocksource/jcore-pit.c
> @@ -154,7 +154,7 @@ static irqreturn_t jcore_timer_interrupt(int irq, void *dev_id)
> return IRQ_HANDLED;
> }
>
> -static void __init jcore_pit_init(struct device_node *node)
> +static int __init jcore_pit_init(struct device_node *node)
> {
> int err;
> __iomem void *pit_base;
> @@ -169,12 +169,14 @@ static void __init jcore_pit_init(struct device_node *node)
> pit_base = of_iomap(node, 0);
> if (!pit_base) {
> pr_err("Error: Cannot map base address for J-Core PIT\n");
> + err = -ENXIO;
> goto out;
> }
>
> pit_irq = irq_of_parse_and_map(node, 0);
> if (!pit_irq) {
> pr_err("Error: J-Core PIT has no IRQ\n");
> + err = -ENXIO;
> goto out;
> }
>
> @@ -183,6 +185,7 @@ static void __init jcore_pit_init(struct device_node *node)
> cs = kzalloc(sizeof *cs, GFP_KERNEL);
> if (!cs) {
> pr_err("Failed to allocate memory for clocksource\n");
> + err = ENOMEM;
> goto out;
> }
> jcore_cs = &cs->cs;
> @@ -207,12 +210,14 @@ static void __init jcore_pit_init(struct device_node *node)
> pit_percpu = alloc_percpu(struct jcore_pit);
> if (!pit_percpu) {
> pr_err("Failed to allocate memory for clock event device\n");
> + err = ENOMEM;
> goto out;
> }
>
> nb = kzalloc(sizeof *nb, GFP_KERNEL);
> if (!nb) {
> pr_err("Failed to allocate memory for J-Core PIT notifier\n");
> + err = ENOMEM;
> goto out;
> }
>
> @@ -268,10 +273,11 @@ static void __init jcore_pit_init(struct device_node *node)
>
> jcore_pit_local_init(this_cpu_ptr(pit_percpu));
>
> - return;
> + return 0;
>
> out:
> pr_err("Could not initialize J-Core PIT driver\n");
> + return err;
> }
>
> CLOCKSOURCE_OF_DECLARE(jcore_pit, "jcore,pit", jcore_pit_init);
> --
> 2.9.0
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] clocksource: j-core: type fix init function return code
2016-07-27 5:25 ` Rich Felker
@ 2016-07-27 8:00 ` Arnd Bergmann
2016-07-28 7:02 ` Rich Felker
0 siblings, 1 reply; 4+ messages in thread
From: Arnd Bergmann @ 2016-07-27 8:00 UTC (permalink / raw)
To: Rich Felker; +Cc: Daniel Lezcano, Thomas Gleixner, linux-kernel
On Wednesday, July 27, 2016 1:25:33 AM CEST Rich Felker wrote:
> On Tue, Jul 26, 2016 at 02:31:29PM +0200, Arnd Bergmann wrote:
> > The CLOCKSOURCE_OF_DECLARE now takes a function that returns an 'int', but a this
> > new clocksource driver has just appeared in linux-next and causes a warning because
> > it has the old 'void' return value:
> >
> > In file included from ../include/linux/clocksource.h:18:0,
> > from ../include/linux/clockchips.h:13,
> > from ../drivers/clocksource/jcore-pit.c:14:
> > include/linux/of.h:1006:20: error: comparison of distinct pointer types lacks a cast [-Werror]
> > .data = (fn == (fn_type)NULL) ? fn : fn }
> > ^
> >
> > This adapts the jcore_pit_init() function to the correct return type.
> >
> > Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> > Fixes: e0aa0655c60b ("clocksource: add J-Core timer/clocksource driver")
> > ---
> > The patch that introduces the warnign currently only exists in the linux-sh git
> > tree and showed up in linux-next this week.
>
> I've removed the commit from my for-next branch since it's not
> appropriate to go upstream through my tree. Your patch should still be
> applied in the proper subsystem tree, though, I think. Daniel?
I think the way to do it now is to fold my patch into your driver and submit
it to the clocksource git on top of the API change.
Arnd
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] clocksource: j-core: type fix init function return code
2016-07-27 8:00 ` Arnd Bergmann
@ 2016-07-28 7:02 ` Rich Felker
0 siblings, 0 replies; 4+ messages in thread
From: Rich Felker @ 2016-07-28 7:02 UTC (permalink / raw)
To: Arnd Bergmann; +Cc: Daniel Lezcano, Thomas Gleixner, linux-kernel
On Wed, Jul 27, 2016 at 10:00:50AM +0200, Arnd Bergmann wrote:
> On Wednesday, July 27, 2016 1:25:33 AM CEST Rich Felker wrote:
> > On Tue, Jul 26, 2016 at 02:31:29PM +0200, Arnd Bergmann wrote:
> > > The CLOCKSOURCE_OF_DECLARE now takes a function that returns an 'int', but a this
> > > new clocksource driver has just appeared in linux-next and causes a warning because
> > > it has the old 'void' return value:
> > >
> > > In file included from ../include/linux/clocksource.h:18:0,
> > > from ../include/linux/clockchips.h:13,
> > > from ../drivers/clocksource/jcore-pit.c:14:
> > > include/linux/of.h:1006:20: error: comparison of distinct pointer types lacks a cast [-Werror]
> > > .data = (fn == (fn_type)NULL) ? fn : fn }
> > > ^
> > >
> > > This adapts the jcore_pit_init() function to the correct return type.
> > >
> > > Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> > > Fixes: e0aa0655c60b ("clocksource: add J-Core timer/clocksource driver")
> > > ---
> > > The patch that introduces the warnign currently only exists in the linux-sh git
> > > tree and showed up in linux-next this week.
> >
> > I've removed the commit from my for-next branch since it's not
> > appropriate to go upstream through my tree. Your patch should still be
> > applied in the proper subsystem tree, though, I think. Daniel?
>
> I think the way to do it now is to fold my patch into your driver and submit
> it to the clocksource git on top of the API change.
Done.
Rich
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2016-07-28 7:03 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-26 12:31 [PATCH] clocksource: j-core: type fix init function return code Arnd Bergmann
2016-07-27 5:25 ` Rich Felker
2016-07-27 8:00 ` Arnd Bergmann
2016-07-28 7:02 ` Rich Felker
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®