[PATCH] clocksource/drivers/jcore: Use request_percpu_irq()

Uros Bizjak posted 1 patch 1 year, 6 months ago
There is a newer version of this series
drivers/clocksource/jcore-pit.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
[PATCH] clocksource/drivers/jcore: Use request_percpu_irq()
Posted by Uros Bizjak 1 year, 6 months ago
Use request_percpu_irq() instead of request_irq() to solve
the following sparse warning:

jcore-pit.c:173:40: warning: incorrect type in argument 5 (different address spaces)
jcore-pit.c:173:40:    expected void *dev
jcore-pit.c:173:40:    got struct jcore_pit [noderef] __percpu *static [assigned] [toplevel] jcore_pit_percpu

Compile tested only.

Signed-off-by: Uros Bizjak <ubizjak@gmail.com>
Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
---
 drivers/clocksource/jcore-pit.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/clocksource/jcore-pit.c b/drivers/clocksource/jcore-pit.c
index a4a991101fa3..5b79347ce6d5 100644
--- a/drivers/clocksource/jcore-pit.c
+++ b/drivers/clocksource/jcore-pit.c
@@ -168,9 +168,8 @@ static int __init jcore_pit_init(struct device_node *node)
 		return -ENOMEM;
 	}
 
-	err = request_irq(pit_irq, jcore_timer_interrupt,
-			  IRQF_TIMER | IRQF_PERCPU,
-			  "jcore_pit", jcore_pit_percpu);
+	err = request_percpu_irq(pit_irq, jcore_timer_interrupt,
+				 "jcore_pit", jcore_pit_percpu);
 	if (err) {
 		pr_err("pit irq request failed: %d\n", err);
 		free_percpu(jcore_pit_percpu);
-- 
2.45.2
Re: [PATCH] clocksource/drivers/jcore: Use request_percpu_irq()
Posted by Daniel Lezcano 1 year, 5 months ago
On 30/07/2024 15:20, Uros Bizjak wrote:
> Use request_percpu_irq() instead of request_irq() to solve
> the following sparse warning:
> 
> jcore-pit.c:173:40: warning: incorrect type in argument 5 (different address spaces)
> jcore-pit.c:173:40:    expected void *dev
> jcore-pit.c:173:40:    got struct jcore_pit [noderef] __percpu *static [assigned] [toplevel] jcore_pit_percpu
> 
> Compile tested only.
> 
> Signed-off-by: Uros Bizjak <ubizjak@gmail.com>
> Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
> Cc: Thomas Gleixner <tglx@linutronix.de>
> ---

Added Rich Felker in Cc

Applied, thanks

-- 
<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
Re: [PATCH] clocksource/drivers/jcore: Use request_percpu_irq()
Posted by Uros Bizjak 1 year, 5 months ago
On Mon, Sep 2, 2024 at 11:17 AM Daniel Lezcano
<daniel.lezcano@linaro.org> wrote:
>
> On 30/07/2024 15:20, Uros Bizjak wrote:
> > Use request_percpu_irq() instead of request_irq() to solve
> > the following sparse warning:
> >
> > jcore-pit.c:173:40: warning: incorrect type in argument 5 (different address spaces)
> > jcore-pit.c:173:40:    expected void *dev
> > jcore-pit.c:173:40:    got struct jcore_pit [noderef] __percpu *static [assigned] [toplevel] jcore_pit_percpu
> >
> > Compile tested only.
> >
> > Signed-off-by: Uros Bizjak <ubizjak@gmail.com>
> > Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
> > Cc: Thomas Gleixner <tglx@linutronix.de>
> > ---
>
> Added Rich Felker in Cc
>
> Applied, thanks

I think we also need the following patch, since we changed request_irq
to request_percpu_irq:

Uros.
diff --git a/drivers/clocksource/jcore-pit.c b/drivers/clocksource/jcore-pit.c
index a4a991101fa3..840d09afb947 100644
--- a/drivers/clocksource/jcore-pit.c
+++ b/drivers/clocksource/jcore-pit.c
@@ -120,7 +120,7 @@ static int jcore_pit_local_init(unsigned cpu)
 
 static irqreturn_t jcore_timer_interrupt(int irq, void *dev_id)
 {
-	struct jcore_pit *pit = this_cpu_ptr(dev_id);
+	struct jcore_pit *pit = dev_id;
 
 	if (clockevent_state_oneshot(&pit->ced))
 		jcore_pit_disable(pit);
Re: [PATCH] clocksource/drivers/jcore: Use request_percpu_irq()
Posted by Daniel Lezcano 1 year, 5 months ago
On 02/09/2024 12:11, Uros Bizjak wrote:
> On Mon, Sep 2, 2024 at 11:17 AM Daniel Lezcano
> <daniel.lezcano@linaro.org> wrote:
>>
>> On 30/07/2024 15:20, Uros Bizjak wrote:
>>> Use request_percpu_irq() instead of request_irq() to solve
>>> the following sparse warning:
>>>
>>> jcore-pit.c:173:40: warning: incorrect type in argument 5 (different address spaces)
>>> jcore-pit.c:173:40:    expected void *dev
>>> jcore-pit.c:173:40:    got struct jcore_pit [noderef] __percpu *static [assigned] [toplevel] jcore_pit_percpu
>>>
>>> Compile tested only.
>>>
>>> Signed-off-by: Uros Bizjak <ubizjak@gmail.com>
>>> Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
>>> Cc: Thomas Gleixner <tglx@linutronix.de>
>>> ---
>>
>> Added Rich Felker in Cc
>>
>> Applied, thanks
> 
> I think we also need the following patch, since we changed request_irq
> to request_percpu_irq:

Hmm, I think you are right:

I would say it is:

static irqreturn_t jcore_timer_interrupt(int irq, void *dev_id)
{
         struct jcore_pit *pit = dev_id;

	OR

	struct jcore_pit *pit = this_cpu_ptr(jcore_pit_percpu);

	[ ... ]
}

The former the better for the encapsulation.

Do you mind to update the patch ?

-- 
<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
Re: [PATCH] clocksource/drivers/jcore: Use request_percpu_irq()
Posted by Uros Bizjak 1 year, 5 months ago
On Mon, Sep 2, 2024 at 12:33 PM Daniel Lezcano
<daniel.lezcano@linaro.org> wrote:
>
> On 02/09/2024 12:11, Uros Bizjak wrote:
> > On Mon, Sep 2, 2024 at 11:17 AM Daniel Lezcano
> > <daniel.lezcano@linaro.org> wrote:
> >>
> >> On 30/07/2024 15:20, Uros Bizjak wrote:
> >>> Use request_percpu_irq() instead of request_irq() to solve
> >>> the following sparse warning:
> >>>
> >>> jcore-pit.c:173:40: warning: incorrect type in argument 5 (different address spaces)
> >>> jcore-pit.c:173:40:    expected void *dev
> >>> jcore-pit.c:173:40:    got struct jcore_pit [noderef] __percpu *static [assigned] [toplevel] jcore_pit_percpu
> >>>
> >>> Compile tested only.
> >>>
> >>> Signed-off-by: Uros Bizjak <ubizjak@gmail.com>
> >>> Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
> >>> Cc: Thomas Gleixner <tglx@linutronix.de>
> >>> ---
> >>
> >> Added Rich Felker in Cc
> >>
> >> Applied, thanks
> >
> > I think we also need the following patch, since we changed request_irq
> > to request_percpu_irq:
>
> Hmm, I think you are right:
>
> I would say it is:
>
> static irqreturn_t jcore_timer_interrupt(int irq, void *dev_id)
> {
>          struct jcore_pit *pit = dev_id;
>
>         OR
>
>         struct jcore_pit *pit = this_cpu_ptr(jcore_pit_percpu);
>
>         [ ... ]
> }
>
> The former the better for the encapsulation.
>
> Do you mind to update the patch ?

Done, v2 with changed jcore_timer_interrupt() was just sent.

Sorry for the inconvenience.

Thanks,
Uros.
Re: [PATCH] clocksource/drivers/jcore: Use request_percpu_irq()
Posted by Daniel Lezcano 1 year, 5 months ago
On 02/09/2024 12:50, Uros Bizjak wrote:
> On Mon, Sep 2, 2024 at 12:33 PM Daniel Lezcano
> <daniel.lezcano@linaro.org> wrote:
>>
>> On 02/09/2024 12:11, Uros Bizjak wrote:
>>> On Mon, Sep 2, 2024 at 11:17 AM Daniel Lezcano
>>> <daniel.lezcano@linaro.org> wrote:
>>>>
>>>> On 30/07/2024 15:20, Uros Bizjak wrote:
>>>>> Use request_percpu_irq() instead of request_irq() to solve
>>>>> the following sparse warning:
>>>>>
>>>>> jcore-pit.c:173:40: warning: incorrect type in argument 5 (different address spaces)
>>>>> jcore-pit.c:173:40:    expected void *dev
>>>>> jcore-pit.c:173:40:    got struct jcore_pit [noderef] __percpu *static [assigned] [toplevel] jcore_pit_percpu
>>>>>
>>>>> Compile tested only.
>>>>>
>>>>> Signed-off-by: Uros Bizjak <ubizjak@gmail.com>
>>>>> Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
>>>>> Cc: Thomas Gleixner <tglx@linutronix.de>
>>>>> ---
>>>>
>>>> Added Rich Felker in Cc
>>>>
>>>> Applied, thanks
>>>
>>> I think we also need the following patch, since we changed request_irq
>>> to request_percpu_irq:
>>
>> Hmm, I think you are right:
>>
>> I would say it is:
>>
>> static irqreturn_t jcore_timer_interrupt(int irq, void *dev_id)
>> {
>>           struct jcore_pit *pit = dev_id;
>>
>>          OR
>>
>>          struct jcore_pit *pit = this_cpu_ptr(jcore_pit_percpu);
>>
>>          [ ... ]
>> }
>>
>> The former the better for the encapsulation.
>>
>> Do you mind to update the patch ?
> 
> Done, v2 with changed jcore_timer_interrupt() was just sent.
> 
> Sorry for the inconvenience.

No worries, thanks for the v2

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