public inbox for linux-arm-kernel@lists.infradead.org 
 help / color / mirror / Atom feed
From: gregory.clement@free-electrons•com (Gregory CLEMENT)
To: linux-arm-kernel@lists•infradead.org
Subject: [PATCH v5 1/4] ARM: mvebu: add broken-idle option
Date: Fri, 23 Oct 2015 09:57:45 +0200	[thread overview]
Message-ID: <87oafq2f0m.fsf@free-electrons.com> (raw)
In-Reply-To: <CAOesGMjUG0Ws7X7sw3H=8BNTNrwqmfPREpP0MK8RoJssAgiJ-g@mail.gmail.com> (Olof Johansson's message of "Thu, 22 Oct 2015 10:40:57 -0700")

Hi Simon and Vincent,
 
 On jeu., oct. 22 2015, Olof Johansson <olof@lixom•net> wrote:

>> +static int broken_idle(struct device_node *np)
>> +{
>> +       if (of_property_read_bool(np, "broken-idle")) {
>> +               pr_warn("CPU idle is currently broken: disabling\n");
>> +               return 0;
>> +       }
>> +
>> +       return 1;
>> +}
>
> This is confusing. The function is called broken_idle(), but it
> returns 0 if idle is broken and 1 if it isn't.
>
> It means these tests look odd:
>
>> +
>>  static __init int armada_370_cpuidle_init(void)
>>  {
>>         struct device_node *np;
>> @@ -387,7 +397,9 @@ static __init int armada_370_cpuidle_init(void)
>>         np = of_find_compatible_node(NULL, NULL, "marvell,coherency-fabric");
>>         if (!np)
>>                 return -ENODEV;
>> -       of_node_put(np);
>> +
>> +       if (!broken_idle(np))
>> +               goto end;
>
> So, the way I read this when I read just this code is: "If idle is NOT
> broken, then don't bother set up any of the idle stuff".
>
> Please turn this the other way around so others don't make the same
> mistake when reading the code.
>
> I know it might come across as bikesheddy and nitpicky, but
> readability trumps most other things when it comes to new code. :-/

Could you send an updated version ? Then I will be able to make a new
pull request following it as requested by Olof. Then it will still be
part of 4.4.

Thanks,

Gregory

>
>
>
> -Olof

-- 
Gregory Clement, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com

  reply	other threads:[~2015-10-23  7:57 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-06 14:13 [PATCH v5 0/4] Add support for the Armada-370-based Seagate NAS Simon Guinot
2015-10-06 14:13 ` [PATCH v5 1/4] ARM: mvebu: add broken-idle option Simon Guinot
2015-10-12 16:19   ` Gregory CLEMENT
2015-10-12 16:23     ` Gregory CLEMENT
2015-10-22 17:40   ` Olof Johansson
2015-10-23  7:57     ` Gregory CLEMENT [this message]
2015-10-23 10:59       ` [PATCH v6] " Vincent Donnefort
2015-10-23 10:59         ` [PATCH] " Vincent Donnefort
2015-10-23 15:37           ` Gregory CLEMENT
2015-10-06 14:13 ` [PATCH v5 2/4] ARM: mvebu: add DT support for Seagate NAS 2 and 4-Bay Simon Guinot
2015-10-12 16:20   ` Gregory CLEMENT
2015-10-06 14:13 ` [PATCH v5 3/4] ARM: mvebu: add DT support for Seagate Personal Cloud Simon Guinot
2015-10-12 16:20   ` Gregory CLEMENT
2015-10-06 14:13 ` [PATCH v5 4/4] ARM: mvebu: enable options for Seagate NAS in mvebu_v7_defconfig Simon Guinot
2015-10-12 16:22   ` Gregory CLEMENT

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=87oafq2f0m.fsf@free-electrons.com \
    --to=gregory.clement@free-electrons$(echo .)com \
    --cc=linux-arm-kernel@lists$(echo .)infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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