linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: sathyanarayanan kuppuswamy <sathyanarayanan.kuppuswamy@linux.intel.com>
To: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: Linus Walleij <linus.walleij@linaro.org>,
	"linux-gpio@vger.kernel.org" <linux-gpio@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Sathyanarayanan Kuppuswamy Natarajan <sathyaosid@gmail.com>
Subject: Re: [PATCH v1 1/1] gpio: gpio-crystalcove: Skip IRQ CTRL register update for virtual GPIOs
Date: Thu, 15 Jun 2017 14:45:42 -0700	[thread overview]
Message-ID: <167cd7bd-1e70-d44a-180c-da890a017110@linux.intel.com> (raw)
In-Reply-To: <CAHp75VdVmAPTP5k_U+=EvBqysGz0Jk9YoytFMTSA_1T-tmVvZw@mail.gmail.com>

Hi Andy,


On 06/15/2017 02:19 AM, Andy Shevchenko wrote:
> On Thu, Jun 15, 2017 at 2:21 AM,
> <sathyanarayanan.kuppuswamy@linux.intel.com> wrote:
>> From: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com>
>>
>> Commit 9a752b4c9ab9 ("gpio: crystalcove: Do not write regular gpio
>> registers for virtual GPIOs") added support to skip GPIO register
>> update for virtual GPIOs, but it missed to add skip logic in
>> crystalcove_update_irq_ctrl() function. This patch fixes it.
>> @@ -134,6 +134,9 @@ static void crystalcove_update_irq_ctrl(struct crystalcove_gpio *cg, int gpio)
>>   {
>>          int reg = to_reg(gpio, CTRL_IN);
>>
>> +       if (reg < 0)
>> +               return;
>> +
>>          regmap_update_bits(cg->regmap, reg, CTLI_INTCNT_BE, cg->intcnt_value);
>>   }
> Shouldn't it have been done using irq_valid_mask flag in the first place?
Agree. Setting irq_valid_mask would be the proper approach to skip IRQ 
for some GPIO pins. But commit 9a752b4c9ab9 added the GPIO index based 
checks in other IRQ set/unset functions in this driver and missed to add 
it only in this update_irq_ctrl() function. May be I can submit a 
separate patch to clean it up and use logic based on setting irq_valid_mask.

Even if we do the cleanup patch, I would still prefer to have this 
check. Since to_reg() can return value < 0, its good to check it before 
passing it to regmap_* functions. Let me know your comments.

>

-- 
Sathyanarayanan Kuppuswamy
Linux kernel developer


  reply	other threads:[~2017-06-15 21:45 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-14 23:21 [PATCH v1 1/1] gpio: gpio-crystalcove: Skip IRQ CTRL register update for virtual GPIOs sathyanarayanan.kuppuswamy
2017-06-15  9:19 ` Andy Shevchenko
2017-06-15 21:45   ` sathyanarayanan kuppuswamy [this message]
2017-07-10 23:35     ` sathyanarayanan kuppuswamy
2017-07-11  9:47       ` Hans de Goede
2017-07-11 17:20         ` Kuppuswamy, Sathyanarayanan

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=167cd7bd-1e70-d44a-180c-da890a017110@linux.intel.com \
    --to=sathyanarayanan.kuppuswamy@linux.intel.com \
    --cc=andy.shevchenko@gmail.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sathyaosid@gmail.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;
as well as URLs for NNTP newsgroup(s).