Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1277477

Re: [RFC PATCH 02/10] clockevents/drivers: add MPS2 Timer driver

From Vladimir Murzin <vladimir.murzin@arm.com>
Newsgroups linux.kernel
Subject Re: [RFC PATCH 02/10] clockevents/drivers: add MPS2 Timer driver
Date 2015-11-25 16:30 +0100
Message-ID <qyKb7-83T-7@gated-at.bofh.it> (permalink)
References <qyFEu-528-7@gated-at.bofh.it> <qyFEu-528-17@gated-at.bofh.it> <qyICm-6XN-7@gated-at.bofh.it> <qyJI6-7CO-17@gated-at.bofh.it> <qyK1t-7ZU-39@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On 25/11/15 15:10, Daniel Lezcano wrote:
> On 11/25/2015 03:51 PM, Vladimir Murzin wrote:
>> Hi Daniel,
>>
>> Thanks for you review, I agree on all concerns raised and address them
>> in the next version. Just some points to confirm below (I left only
>> relevant parts).
>>
>>>> +static irqreturn_t mps2_timer_interrupt(int irq, void *dev_id)
>>>> +{
>>>> +    struct clockevent_mps2 *ce = dev_id;
>>>> +    u32 status = readl(ce->reg + TIMER_INT);
>>>> +
>>>> +    if (!status)
>>>> +        return IRQ_NONE;
>>>
>>> Why that could happen ? Add a comment.
>>>
>>
>> Sort of defensive programming, I never seen it happens, but just in case
>> of spurious interrupts... Do you prefer to get rid of this check or
>>
>>      /* spurious interrupt? */
>>      if (!status)
>>          return IRQ_NONE;
>>
>> would be fine to you?
> 
> Yes, that would be fine, but if it does never happen, we don't really
> need this check. If you prefer to make sure there isn't a spurious
> interrupt and considering it shouldn't happen, a pr_info trace may help
> to spot this misbehavior.
> 

Good, I'll put pr_warn("spurious interrupt\n") then.

>>>> +}
>>>> +
>>>> +static void __init mps2_timer_init(struct device_node *np)
>>>> +{
>>>> +    static int clksrc;
>>>> +
>>>> +    if (!clksrc && !mps2_clocksource_init(np))
>>>> +        clksrc = 1;
>>>> +    else
>>>> +        mps2_clockevents_init(np);
>>>
>>> That assumes the clocksource is defined before the clockevents in the
>>> DT. If it is not the case, the mps2_clocksource_init will fail (and spit
>>> errors) and mps2_clockevents_init() won't be called.
>>>
>>
>> Does following (stolen from efm32) look better to you?
>>
>> static void __init mps2_timer_init(struct device_node *np)
>> {
>>     static int has_clocksource, has_clockevent;
>>     int ret;
>>
>>     if (!has_clocksource) {
>>         ret = mps2_clocksource_init(np);
>>         if (!ret) {
>>             has_clocksource = 1;
>>             return;
>>         }
>>     }
>>
>>     if (!has_clockevent) {
>>         ret = mps2_clockevent_init(np);
>>         if (!ret) {
>>             has_clockevent = 1;
>>             return;
>>         }
>>     }
>> }
> 
> Yes.
> 
> I don't like to have a "CLOCKSOURCE_OF_DECLARE" to initialize a
> clockevent but I can't blame you, this is what is done in the other
> drivers.

Thanks for your time!

Vladimir

> 
>>>> +}
>>>> +
>>>> +CLOCKSOURCE_OF_DECLARE(mps2_timer, "arm,mps2-timer", mps2_timer_init);
>>>>
>>>
>>>
>>
> 
> 

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[RFC PATCH 00/10] Support for Cortex-M Prototyping System Vladimir Murzin <vladimir.murzin@arm.com> - 2015-11-25 11:40 +0100
  [RFC PATCH 10/10] ARM: dts: introduce MPS2 AN399/AN400 Vladimir Murzin <vladimir.murzin@arm.com> - 2015-11-25 11:40 +0100
  [RFC PATCH 02/10] clockevents/drivers: add MPS2 Timer driver Vladimir Murzin <vladimir.murzin@arm.com> - 2015-11-25 11:40 +0100
    Re: [RFC PATCH 02/10] clockevents/drivers: add MPS2 Timer driver Daniel Lezcano <daniel.lezcano@linaro.org> - 2015-11-25 14:50 +0100
      Re: [RFC PATCH 02/10] clockevents/drivers: add MPS2 Timer driver Vladimir Murzin <vladimir.murzin@arm.com> - 2015-11-25 16:00 +0100
        Re: [RFC PATCH 02/10] clockevents/drivers: add MPS2 Timer driver Daniel Lezcano <daniel.lezcano@linaro.org> - 2015-11-25 16:20 +0100
          Re: [RFC PATCH 02/10] clockevents/drivers: add MPS2 Timer driver Vladimir Murzin <vladimir.murzin@arm.com> - 2015-11-25 16:30 +0100
  [RFC PATCH 01/10] dt-bindings: document the MPS2 timer bindings Vladimir Murzin <vladimir.murzin@arm.com> - 2015-11-25 11:40 +0100
    Re: [RFC PATCH 01/10] dt-bindings: document the MPS2 timer bindings Rob Herring <robh@kernel.org> - 2015-11-25 21:10 +0100
  [RFC PATCH 07/10] ARM: mps2: add low-level debug support Vladimir Murzin <vladimir.murzin@arm.com> - 2015-11-25 11:40 +0100
  [RFC PATCH 05/10] serial: mps2-uart: add support for early console Vladimir Murzin <vladimir.murzin@arm.com> - 2015-11-25 11:40 +0100
  [RFC PATCH 04/10] serial: mps2-uart: add MPS2 UART driver Vladimir Murzin <vladimir.murzin@arm.com> - 2015-11-25 11:40 +0100
  [RFC PATCH 03/10] dt-bindings: document the MPS2 UART bindings Vladimir Murzin <vladimir.murzin@arm.com> - 2015-11-25 11:40 +0100
    Re: [RFC PATCH 03/10] dt-bindings: document the MPS2 UART bindings Rob Herring <robh@kernel.org> - 2015-11-25 21:10 +0100
  [RFC PATCH 09/10] ARM: dts: introduce MPS2 AN385/AN386 Vladimir Murzin <vladimir.murzin@arm.com> - 2015-11-25 11:40 +0100
  [RFC PATCH 08/10] ARM: configs: add MPS2 defconfig Vladimir Murzin <vladimir.murzin@arm.com> - 2015-11-25 11:40 +0100
  Re: [RFC PATCH 00/10] Support for Cortex-M Prototyping System Arnd Bergmann <arnd@arndb.de> - 2015-11-25 12:30 +0100
    Re: [RFC PATCH 00/10] Support for Cortex-M Prototyping System Vladimir Murzin <vladimir.murzin@arm.com> - 2015-11-25 15:50 +0100

csiph-web