From: Grygorii Strashko <grygorii.strashko@ti.com>
To: mrpace2@gmail.com, linux-gpio@vger.kernel.org
Subject: Re: [PATCH v2] gpio: gpio-pca953x: no interrupts with 4-bit devices
Date: Fri, 11 Mar 2016 01:02:57 +0700 [thread overview]
Message-ID: <56E1B6D1.3080908@ti.com> (raw)
In-Reply-To: <emabcbfc80-7a10-4494-be09-92de321c5d0e@t410-5a>
On 03/10/2016 05:15 PM, mrpace2@gmail.com wrote:
> The NBANK macro can be extended in order to avoid the underflow:
>
> #define NBANK(chip) (chip->gpio_chip.ngpio == 0 ? 0 : \
> ((chip->gpio_chip.ngpio + (BANK_SZ - 1)) / BANK_SZ))
> Resending a modified patch.
>
> Signed-off-by: Frank Edelhaeuser <mrpace2 <at> gmail.com>
> ---
> diff -Nur a/drivers/gpio/gpio-pca953x.c b/drivers/gpio/gpio-pca953x.c
> --- a/drivers/gpio/gpio-pca953x.c 2016-03-10 02:34:56.012345678 +0000
> +++ b/drivers/gpio/gpio-pca953x.c 2016-03-10 02:34:56.012345678 +0000
> @@ -86,7 +86,8 @@
> #define MAX_BANK 5
> #define BANK_SZ 8
>
> -#define NBANK(chip) (chip->gpio_chip.ngpio / BANK_SZ)
> +#define NBANK(chip) (chip->gpio_chip.ngpio == 0 ? 0 : \
> + ((chip->gpio_chip.ngpio + (BANK_SZ - 1)) / BANK_SZ))
>
And finally this DIV_ROUND_UP:) Right?
--
regards,
-grygorii
prev parent reply other threads:[~2016-03-10 18:03 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-09 12:37 [PATCH] gpio: gpio-pca953x: no interrupts with 4-bit devices mrpace2
2016-03-09 13:05 ` Alexander Stein
2016-03-10 10:15 ` [PATCH v2] " mrpace2
2016-03-10 18:02 ` Grygorii Strashko [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=56E1B6D1.3080908@ti.com \
--to=grygorii.strashko@ti.com \
--cc=linux-gpio@vger.kernel.org \
--cc=mrpace2@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