lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Wed, 25 Nov 2015 16:10:16 +0100
From:	Daniel Lezcano <daniel.lezcano@...aro.org>
To:	Vladimir Murzin <vladimir.murzin@....com>, arnd@...db.de,
	linux@....linux.org.uk, gregkh@...uxfoundation.org,
	tglx@...utronix.de, u.kleine-koenig@...gutronix.de,
	afaerber@...e.de, mcoquelin.stm32@...il.com
Cc:	Mark.Rutland@....com, Pawel.Moll@....com,
	ijc+devicetree@...lion.org.uk, galak@...eaurora.org,
	jslaby@...e.cz, robh+dt@...nel.org, devicetree@...r.kernel.org,
	linux-serial@...r.kernel.org, linux-api@...r.kernel.org,
	linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org
Subject: Re: [RFC PATCH 02/10] clockevents/drivers: add MPS2 Timer driver

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.

>>> +}
>>> +
>>> +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.

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


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

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ