From: Ilkka Koskinen <ikoskine@nokia.com>
To: Samuel Ortiz <sameo@linux.intel.com>
Cc: "Koskinen Ilkka (Nokia-D/Tampere)" <ilkka.koskinen@nokia.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"linux-omap@vger.kernel.org" <linux-omap@vger.kernel.org>,
"Balbi Felipe (Nokia-D/Helsinki)" <felipe.balbi@nokia.com>
Subject: Re: [PATCH v2] TWL4030: Initial support for TWL5031
Date: Fri, 6 Nov 2009 16:32:37 +0200 (EET) [thread overview]
Message-ID: <alpine.DEB.2.00.0911061409200.32123@tumpelo.ntc.nokia.com> (raw)
In-Reply-To: <20091104160832.GD3607@sortiz.org>
Hi Samuel,
Thanks for comments. I'll fix them but I'd
still have a couple of comments
On Wed, 4 Nov 2009, Samuel Ortiz wrote:
> Hi Ilkka,
>
> Some comments below:
>
> On Fri, Oct 16, 2009 at 05:12:40PM +0300, Ilkka Koskinen wrote:
>> TWL5031 introduces two new interrupts in PIH. Moreover, BCI
>> has changed remarkably and, thus, it's disabled when TWL5031
>> is in use.
>>
>> Signed-off-by: Ilkka Koskinen <ilkka.koskinen@nokia.com>
>> ---
>> drivers/mfd/twl4030-core.c | 12 ++++-
>> drivers/mfd/twl4030-irq.c | 127 +++++++++++++++++++++++++++++++++++++++++--
>> include/linux/i2c/twl4030.h | 47 ++++++++++++++--
>> 3 files changed, 173 insertions(+), 13 deletions(-)
>>
>> @@ -284,11 +367,20 @@ static int twl4030_init_sih_modules(unsigned line)
>> /* disable all interrupts on our line */
>> memset(buf, 0xff, sizeof buf);
>> sih = sih_modules;
>> - for (i = 0; i < ARRAY_SIZE(sih_modules); i++, sih++) {
>> + for (i = 0; i < nr_sih_modules; i++, sih++) {
>>
>> /* skip USB -- it's funky */
>> - if (!sih->bytes_ixr)
>> + /* But don't skip TWL5031's ACI */
>> + if (!sih->bytes_ixr) {
>> + if (chip_is_twl5031 && !strcmp(sih->name, "aci")) {
>> + twl4030_i2c_write(TWL5031_MODULE_ACCESSORY,
>> + buf, TWL5031_ACIIMR_LSB, 1);
>> + twl4030_i2c_write(TWL5031_MODULE_ACCESSORY,
>> + buf, TWL5031_ACIIMR_MSB, 1);
>> + }
>> +
> A few comments on this:
> - Why do we have to do that for the accessory ? Some comments would be
> appropriate.
> - You could use twl4030_i2c_write_u8(), couldnt you ?
> - I'd like it to be more generic: TWL5031_MODULE_ACCESSORY should be replaced
> by sih->module, and the TWL5031_ACII* register should be somehow integrated in
> the sih struct. The idea is to get rid of this chip_is_twl5031.
Very good point. Actually, I could change it to use isr/imr offsets if I
add another variable in sih structure describing a number of supported irq
lines. (ACI supports just one...) I think it would be a lot cleaner
approach that way.
>> @@ -756,3 +857,17 @@ int twl_exit_irq(void)
>> }
>> return 0;
>> }
>> +
>> +int twl_init_chip_irq(const char *chip)
>> +{
>> + if (!strcmp(chip, "twl5031")) {
>> + chip_is_twl5031 = 1;
>> + sih_modules = sih_modules_twl5031;
>> + nr_sih_modules = ARRAY_SIZE(sih_modules_twl5031);
> I dont think you need nr_sih_modules at all. sih_modules is pointing to the
> right array, and then you can keep the ARRAY_SIZE(sih_modules) call instead of
> defining yet another static variable.
What comes to adding another static variable, I don't like it either.
But, as far as I can see ARRAY_SIZE is using sizeof operator, which is
calculated in compilation time, right? Number of sih modules is decided in
probing time based on the used twl chip and, thus, ARRAY_SIZE cannot be
used. Or did I miss something?
> Talking about static variables and such, I really think the twl driver needs
> some cleanup. It should really be allocating a private device structure at
> probe time containing all those static crap. As this driver is growing and
> supporting more and more HW, it starts to be messy.
That would be great. If I only had some time... :(
> Cheers,
> Samuel.
>
>
>> + } else {
>> + sih_modules = sih_modules_twl4030;
>> + nr_sih_modules = ARRAY_SIZE(sih_modules_twl4030);
>> + }
>> +
>> + return 0;
>> +}
Cheers, Ilkka
prev parent reply other threads:[~2009-11-06 14:34 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-10-16 14:12 Ilkka Koskinen
2009-11-03 11:29 ` Ilkka Koskinen
2009-11-04 16:08 ` Samuel Ortiz
2009-11-05 9:08 ` Kauppi Ari (EXT-Ixonos/Oulu)
2009-11-06 14:32 ` Ilkka Koskinen [this message]
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=alpine.DEB.2.00.0911061409200.32123@tumpelo.ntc.nokia.com \
--to=ikoskine@nokia.com \
--cc=felipe.balbi@nokia.com \
--cc=ilkka.koskinen@nokia.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-omap@vger.kernel.org \
--cc=sameo@linux.intel.com \
/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
all inboxes | Powered by JetHome®