linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Arnaud de Turckheim <quarium@gmail.com>
To: linus.walleij@linaro.org
Cc: bgolaszewski@baylibre.com, linux-kernel@vger.kernel.org,
	linux-gpio@vger.kernel.org, vilhelm.gray@gmail.com,
	Arnaud de Turckheim <quarium@gmail.com>
Subject: [PATCH 2/3] gpio: pcie-idio-24: Fix IRQ Enable Register value
Date: Wed,  4 Nov 2020 16:24:54 +0100	[thread overview]
Message-ID: <20201104152455.40627-3-quarium@gmail.com> (raw)
In-Reply-To: <20201104152455.40627-1-quarium@gmail.com>

This fixes the COS Enable Register value for enabling/disabling the
corresponding IRQs bank.

Fixes: 585562046628 ("gpio: Add GPIO support for the ACCES PCIe-IDIO-24 family")
Signed-off-by: Arnaud de Turckheim <quarium@gmail.com>
---
 drivers/gpio/gpio-pcie-idio-24.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/gpio/gpio-pcie-idio-24.c b/drivers/gpio/gpio-pcie-idio-24.c
index 5ea517416366..a61de14d09b6 100644
--- a/drivers/gpio/gpio-pcie-idio-24.c
+++ b/drivers/gpio/gpio-pcie-idio-24.c
@@ -334,13 +334,13 @@ static void idio_24_irq_mask(struct irq_data *data)
 	unsigned long flags;
 	const unsigned long bit_offset = irqd_to_hwirq(data) - 24;
 	unsigned char new_irq_mask;
-	const unsigned long bank_offset = bit_offset/8 * 8;
+	const unsigned long bank_offset = bit_offset / 8;
 	unsigned char cos_enable_state;
 
 	raw_spin_lock_irqsave(&idio24gpio->lock, flags);
 
 	idio24gpio->irq_mask &= ~BIT(bit_offset);
-	new_irq_mask = idio24gpio->irq_mask >> bank_offset;
+	new_irq_mask = idio24gpio->irq_mask >> bank_offset * 8;
 
 	if (!new_irq_mask) {
 		cos_enable_state = ioread8(&idio24gpio->reg->cos_enable);
@@ -363,12 +363,12 @@ static void idio_24_irq_unmask(struct irq_data *data)
 	unsigned long flags;
 	unsigned char prev_irq_mask;
 	const unsigned long bit_offset = irqd_to_hwirq(data) - 24;
-	const unsigned long bank_offset = bit_offset/8 * 8;
+	const unsigned long bank_offset = bit_offset / 8;
 	unsigned char cos_enable_state;
 
 	raw_spin_lock_irqsave(&idio24gpio->lock, flags);
 
-	prev_irq_mask = idio24gpio->irq_mask >> bank_offset;
+	prev_irq_mask = idio24gpio->irq_mask >> bank_offset * 8;
 	idio24gpio->irq_mask |= BIT(bit_offset);
 
 	if (!prev_irq_mask) {
-- 
2.25.1


  parent reply	other threads:[~2020-11-04 15:25 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-04 15:24 [PATCH 0/3] gpio: pcie-idio-24: Fix IRQ handling Arnaud de Turckheim
2020-11-04 15:24 ` [PATCH 1/3] gpio: pcie-idio-24: Fix irq mask when masking Arnaud de Turckheim
2020-11-04 15:47   ` William Breathitt Gray
2020-11-04 15:24 ` Arnaud de Turckheim [this message]
2020-11-04 15:47   ` [PATCH 2/3] gpio: pcie-idio-24: Fix IRQ Enable Register value William Breathitt Gray
2020-11-04 15:24 ` [PATCH 3/3] gpio: pcie-idio-24: Enable PEX8311 interrupts Arnaud de Turckheim
2020-11-04 15:47   ` William Breathitt Gray
2020-11-04 15:45 ` [PATCH 0/3] gpio: pcie-idio-24: Fix IRQ handling William Breathitt Gray
2020-11-06 14:20 ` Bartosz Golaszewski

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=20201104152455.40627-3-quarium@gmail.com \
    --to=quarium@gmail.com \
    --cc=bgolaszewski@baylibre.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=vilhelm.gray@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).