linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andy Shevchenko <andy.shevchenko@gmail.com>
To: Baolin Wang <baolin.wang@linaro.org>
Cc: Linus Walleij <linus.walleij@linaro.org>,
	Rob Herring <robh+dt@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	devicetree <devicetree@vger.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	"open list:GPIO SUBSYSTEM" <linux-gpio@vger.kernel.org>,
	Mark Brown <broonie@kernel.org>
Subject: Re: [PATCH v2 3/3] gpio: Add Spreadtrum PMIC EIC driver support
Date: Sun, 25 Feb 2018 14:19:51 +0200	[thread overview]
Message-ID: <CAHp75VdvLDEmNs-YUFYf+Og18kaU6j6zAxXc1w31X2vw26ACHQ@mail.gmail.com> (raw)
In-Reply-To: <f4a2fefb4c3179e7598dbc8141a661833200b922.1519468782.git.baolin.wang@linaro.org>

On Sat, Feb 24, 2018 at 12:44 PM, Baolin Wang <baolin.wang@linaro.org> wrote:
> The Spreadtrum PMIC EIC controller contains only one bank of debounce EIC,
> and this bank contains 16 EICs. Each EIC can only be used as input mode,
> as well as supporting the debounce and the capability to trigger interrupts
> when detecting input signals.

> +/*
> + * These registers are modified under the irq bus lock and cached to avoid
> + * unnecessary writes in bus_sync_unlock.
> + */
> +enum { REG_IEV, REG_IE, REG_TRIG, CACHE_NR_REGS };

One item per line.

> +static int sprd_pmic_eic_direction_input(struct gpio_chip *chip,
> +                                        unsigned int offset)
> +{
> +       /* EICs are always input, nothing need to do here. */
> +       return 0;
> +}
> +
> +static void sprd_pmic_eic_set(struct gpio_chip *chip, unsigned int offset,
> +                             int value)
> +{
> +       /* EICs are always input, nothing need to do here. */
> +}

Remove both.

Look at what GPIO core does.

> +       value |= debounce / 1000;

Possible overflow.

> +       for (n = 0; n < chip->ngpio; n++) {
> +               if (!(BIT(n) & val))

for_each_set_bit().

At some point you may need just to go across lib/ in the kernel and
see what we have there.

-- 
With Best Regards,
Andy Shevchenko

  reply	other threads:[~2018-02-25 12:19 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-24 10:44 [PATCH v2 1/3] dt-bindings: gpio: Add Spreadtrum EIC controller documentation Baolin Wang
2018-02-24 10:44 ` [PATCH v2 2/3] gpio: Add Spreadtrum EIC driver support Baolin Wang
2018-03-02  9:53   ` Linus Walleij
2018-03-02 10:48     ` Baolin Wang
2018-03-02 12:40       ` Linus Walleij
2018-02-24 10:44 ` [PATCH v2 3/3] gpio: Add Spreadtrum PMIC " Baolin Wang
2018-02-25 12:19   ` Andy Shevchenko [this message]
2018-02-26  3:01     ` Baolin Wang
2018-02-26 12:02       ` Andy Shevchenko
2018-02-27  2:35         ` Baolin Wang
2018-02-27 15:54           ` Andy Shevchenko
2018-02-28  2:22             ` Baolin Wang
2018-03-02 22:08 ` [PATCH v2 1/3] dt-bindings: gpio: Add Spreadtrum EIC controller documentation Rob Herring

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=CAHp75VdvLDEmNs-YUFYf+Og18kaU6j6zAxXc1w31X2vw26ACHQ@mail.gmail.com \
    --to=andy.shevchenko@gmail.com \
    --cc=baolin.wang@linaro.org \
    --cc=broonie@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=robh+dt@kernel.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).