From: marek.vasut@gmail.com (Marek Vasut)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/2] ARM: shmobile: Factor out complex condition
Date: Sat, 17 Feb 2018 12:46:01 +0100 [thread overview]
Message-ID: <e22632bc-c612-de23-0ceb-4e317d41b04b@gmail.com> (raw)
In-Reply-To: <20180217081857.xowqahwnzob6titp@katana>
On 02/17/2018 09:18 AM, Wolfram Sang wrote:
>> - if ((client->addr == 0x58 && !strcmp(client->name, "da9063")) ||
>> - (client->addr == 0x68 && !strcmp(client->name, "da9210")) ||
>> - (client->addr == 0x70 && !strcmp(client->name, "da9210"))) {
>> + if (regulator_quirk_check(client, 0, "da9063") ||
>> + regulator_quirk_check(client, 1, "da9210") ||
>> + regulator_quirk_check(client, 2, "da9210")) {
>
> I am afraid I don't think this makes the code better, just different.
> The index is as magic as the client address IMO. I was not super happy
> with the array size depending on the detected board from a previous
> patch already. But given the next patch which modifies the msg array
> depending on the board, I think we really need to switch to seperate
> message arrays per board. Everything else is too error prone and
> unnecessarily cumbersome to understand.
>
> Other opinions?
The code is awful, yes.
I wonder if we could rather find all DA0063 and DA9210 PMICs in the DT,
check if their IRQ lines are tied together and then generate the table
above dynamically for whatever PMICs are present in the system. Then all
that special-casing would go away as we'd extract the information from DT.
--
Best regards,
Marek Vasut
next prev parent reply other threads:[~2018-02-17 11:46 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-17 2:06 [PATCH 1/2] ARM: shmobile: Factor out complex condition Marek Vasut
2018-02-17 2:06 ` [PATCH 2/2] ARM: shmobile: porter: enable R-Car Gen2 regulator quirk Marek Vasut
2018-02-19 8:42 ` Geert Uytterhoeven
2018-02-19 8:51 ` Marek Vasut
2018-02-17 8:18 ` [PATCH 1/2] ARM: shmobile: Factor out complex condition Wolfram Sang
2018-02-17 11:46 ` Marek Vasut [this message]
2018-02-19 8:53 ` Geert Uytterhoeven
2018-02-19 8:58 ` Simon Horman
2018-02-21 19:59 ` Marek Vasut
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=e22632bc-c612-de23-0ceb-4e317d41b04b@gmail.com \
--to=marek.vasut@gmail.com \
--cc=linux-arm-kernel@lists.infradead.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).