linux-serial.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Vladimir Murzin <vladimir.murzin-5wv7dgnIgG8@public.gmane.org>
To: Daniel Lezcano
	<daniel.lezcano-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>,
	arnd-r2nGTMty4D4@public.gmane.org,
	linux-lFZ/pmaqli7XmaaqVzeoHQ@public.gmane.org,
	gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org,
	tglx-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org,
	u.kleine-koenig-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org,
	afaerber-l3A5Bk7waGM@public.gmane.org,
	mcoquelin.stm32-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
Cc: Mark.Rutland-5wv7dgnIgG8@public.gmane.org,
	Pawel.Moll-5wv7dgnIgG8@public.gmane.org,
	ijc+devicetree-KcIKpvwj1kUDXYZnReoRVg@public.gmane.org,
	galak-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org,
	jslaby-AlSwsSmVLrQ@public.gmane.org,
	robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org,
	devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-serial-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-api-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [RFC PATCH 02/10] clockevents/drivers: add MPS2 Timer driver
Date: Wed, 25 Nov 2015 15:21:27 +0000	[thread overview]
Message-ID: <5655D1F7.2030202@arm.com> (raw)
In-Reply-To: <5655CF58.6030507-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>

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 devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  parent reply	other threads:[~2015-11-25 15:21 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-25 10:33 [RFC PATCH 00/10] Support for Cortex-M Prototyping System Vladimir Murzin
2015-11-25 10:33 ` [RFC PATCH 01/10] dt-bindings: document the MPS2 timer bindings Vladimir Murzin
     [not found]   ` <1448447621-17900-2-git-send-email-vladimir.murzin-5wv7dgnIgG8@public.gmane.org>
2015-11-25 20:04     ` Rob Herring
2015-11-25 10:33 ` [RFC PATCH 02/10] clockevents/drivers: add MPS2 Timer driver Vladimir Murzin
     [not found]   ` <1448447621-17900-3-git-send-email-vladimir.murzin-5wv7dgnIgG8@public.gmane.org>
2015-11-25 13:40     ` Daniel Lezcano
2015-11-25 14:51       ` Vladimir Murzin
2015-11-25 15:10         ` Daniel Lezcano
     [not found]           ` <5655CF58.6030507-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2015-11-25 15:21             ` Vladimir Murzin [this message]
2015-11-25 10:33 ` [RFC PATCH 03/10] dt-bindings: document the MPS2 UART bindings Vladimir Murzin
     [not found]   ` <1448447621-17900-4-git-send-email-vladimir.murzin-5wv7dgnIgG8@public.gmane.org>
2015-11-25 20:07     ` Rob Herring
2015-12-01 11:35       ` Vladimir Murzin
2015-11-25 10:33 ` [RFC PATCH 04/10] serial: mps2-uart: add MPS2 UART driver Vladimir Murzin
2015-11-25 10:33 ` [RFC PATCH 05/10] serial: mps2-uart: add support for early console Vladimir Murzin
2015-11-25 10:33 ` [RFC PATCH 06/10] ARM: mps2: introduce MPS2 platform Vladimir Murzin
2015-11-25 10:33 ` [RFC PATCH 09/10] ARM: dts: introduce MPS2 AN385/AN386 Vladimir Murzin
2015-11-25 10:33 ` [RFC PATCH 10/10] ARM: dts: introduce MPS2 AN399/AN400 Vladimir Murzin
     [not found] ` <1448447621-17900-1-git-send-email-vladimir.murzin-5wv7dgnIgG8@public.gmane.org>
2015-11-25 10:33   ` [RFC PATCH 07/10] ARM: mps2: add low-level debug support Vladimir Murzin
2015-11-25 10:33   ` [RFC PATCH 08/10] ARM: configs: add MPS2 defconfig Vladimir Murzin
2015-11-25 11:22   ` [RFC PATCH 00/10] Support for Cortex-M Prototyping System Arnd Bergmann
2015-11-25 14:39     ` Vladimir Murzin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5655D1F7.2030202@arm.com \
    --to=vladimir.murzin-5wv7dgnigg8@public.gmane.org \
    --cc=Mark.Rutland-5wv7dgnIgG8@public.gmane.org \
    --cc=Pawel.Moll-5wv7dgnIgG8@public.gmane.org \
    --cc=afaerber-l3A5Bk7waGM@public.gmane.org \
    --cc=arnd-r2nGTMty4D4@public.gmane.org \
    --cc=daniel.lezcano-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
    --cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=galak-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org \
    --cc=gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org \
    --cc=ijc+devicetree-KcIKpvwj1kUDXYZnReoRVg@public.gmane.org \
    --cc=jslaby-AlSwsSmVLrQ@public.gmane.org \
    --cc=linux-api-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-lFZ/pmaqli7XmaaqVzeoHQ@public.gmane.org \
    --cc=linux-serial-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=mcoquelin.stm32-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    --cc=tglx-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org \
    --cc=u.kleine-koenig-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).