LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH 0/2] Fix port memory offsets for IDIO series drivers
@ 2018-04-18 12:52 William Breathitt Gray
  2018-04-18 12:53 ` [PATCH 1/2] gpio: pci-idio-16: Fix port memory offset for get_multiple callback William Breathitt Gray
  2018-04-18 12:53 ` [PATCH 2/2] gpio: pcie-idio-24: Fix port memory offset for get_multiple/set_multiple callbacks William Breathitt Gray
  0 siblings, 2 replies; 5+ messages in thread
From: William Breathitt Gray @ 2018-04-18 12:52 UTC (permalink / raw)
  To: linus.walleij; +Cc: linux-gpio, linux-kernel, William Breathitt Gray

The GPIO PCI-IDIO-16 and PCIE-IDIO-24 drivers utilize the ioread8 and
iowrite8 functions to interact with their devices' respective I/O
registers. To simplify the get_multiple/set_multiple callbacks, a local
array 'ports' is used to hold the memory address offsets of the
respective device I/O registers.

Currently the get_multiple callback in the GPIO PCI-IDIO-16 driver, and
the get_multiple/set_multiple callbacks in the GPIO PCIE-IDIO-24 driver,
incorrectly pass the memory address of the local 'ports' array elements
to the respective ioread8/iowrite8 functions when they should instead
pass the necessary device I/O register memory offset. This patch fixes
this error by supplying the correct intended memory addresses to these
functions.

William Breathitt Gray (2):
  gpio: pci-idio-16: Fix port memory offset for get_multiple callback
  gpio: pcie-idio-24: Fix port memory offset for
    get_multiple/set_multiple callbacks

 drivers/gpio/gpio-pci-idio-16.c  |  8 ++++----
 drivers/gpio/gpio-pcie-idio-24.c | 20 ++++++++++----------
 2 files changed, 14 insertions(+), 14 deletions(-)

-- 
2.16.2

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/2] gpio: pci-idio-16: Fix port memory offset for get_multiple callback
  2018-04-18 12:52 [PATCH 0/2] Fix port memory offsets for IDIO series drivers William Breathitt Gray
@ 2018-04-18 12:53 ` William Breathitt Gray
  2018-04-26 22:55   ` Linus Walleij
  2018-04-18 12:53 ` [PATCH 2/2] gpio: pcie-idio-24: Fix port memory offset for get_multiple/set_multiple callbacks William Breathitt Gray
  1 sibling, 1 reply; 5+ messages in thread
From: William Breathitt Gray @ 2018-04-18 12:53 UTC (permalink / raw)
  To: linus.walleij; +Cc: linux-gpio, linux-kernel, William Breathitt Gray

The ioread8 function expects a memory offset argument. This patch fixes
the ports array to provide the memory addresses of the respective device
I/O registers.

Fixes: 810ebfc5efca ("gpio: pci-idio-16: Implement get_multiple callback")
Signed-off-by: William Breathitt Gray <vilhelm.gray@gmail.com>
---
 drivers/gpio/gpio-pci-idio-16.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/gpio/gpio-pci-idio-16.c b/drivers/gpio/gpio-pci-idio-16.c
index 1948724d8c36..25d16b2af1c3 100644
--- a/drivers/gpio/gpio-pci-idio-16.c
+++ b/drivers/gpio/gpio-pci-idio-16.c
@@ -116,9 +116,9 @@ static int idio_16_gpio_get_multiple(struct gpio_chip *chip,
 	unsigned long word_mask;
 	const unsigned long port_mask = GENMASK(gpio_reg_size - 1, 0);
 	unsigned long port_state;
-	u8 __iomem ports[] = {
-		idio16gpio->reg->out0_7, idio16gpio->reg->out8_15,
-		idio16gpio->reg->in0_7, idio16gpio->reg->in8_15,
+	void __iomem *ports[] = {
+		&idio16gpio->reg->out0_7, &idio16gpio->reg->out8_15,
+		&idio16gpio->reg->in0_7, &idio16gpio->reg->in8_15,
 	};
 
 	/* clear bits array to a clean slate */
@@ -143,7 +143,7 @@ static int idio_16_gpio_get_multiple(struct gpio_chip *chip,
 		}
 
 		/* read bits from current gpio port */
-		port_state = ioread8(ports + i);
+		port_state = ioread8(ports[i]);
 
 		/* store acquired bits at respective bits array offset */
 		bits[word_index] |= port_state << word_offset;
-- 
2.16.2

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 2/2] gpio: pcie-idio-24: Fix port memory offset for get_multiple/set_multiple callbacks
  2018-04-18 12:52 [PATCH 0/2] Fix port memory offsets for IDIO series drivers William Breathitt Gray
  2018-04-18 12:53 ` [PATCH 1/2] gpio: pci-idio-16: Fix port memory offset for get_multiple callback William Breathitt Gray
@ 2018-04-18 12:53 ` William Breathitt Gray
  2018-04-26 22:56   ` Linus Walleij
  1 sibling, 1 reply; 5+ messages in thread
From: William Breathitt Gray @ 2018-04-18 12:53 UTC (permalink / raw)
  To: linus.walleij; +Cc: linux-gpio, linux-kernel, William Breathitt Gray

The ioread8/iowrite8 functions expect a memory offset argument. This
patch fixes the ports array to provide the memory addresses of the
respective device I/O registers.

Fixes: ca37081595a2 ("gpio: pcie-idio-24: Implement get_multiple/set_multiple callbacks")
Signed-off-by: William Breathitt Gray <vilhelm.gray@gmail.com>
---
 drivers/gpio/gpio-pcie-idio-24.c | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/drivers/gpio/gpio-pcie-idio-24.c b/drivers/gpio/gpio-pcie-idio-24.c
index 835607ecf658..3e77c2a9a9fd 100644
--- a/drivers/gpio/gpio-pcie-idio-24.c
+++ b/drivers/gpio/gpio-pcie-idio-24.c
@@ -206,10 +206,10 @@ static int idio_24_gpio_get_multiple(struct gpio_chip *chip,
 	unsigned long word_mask;
 	const unsigned long port_mask = GENMASK(gpio_reg_size - 1, 0);
 	unsigned long port_state;
-	u8 __iomem ports[] = {
-		idio24gpio->reg->out0_7, idio24gpio->reg->out8_15,
-		idio24gpio->reg->out16_23, idio24gpio->reg->in0_7,
-		idio24gpio->reg->in8_15, idio24gpio->reg->in16_23,
+	void __iomem *ports[] = {
+		&idio24gpio->reg->out0_7, &idio24gpio->reg->out8_15,
+		&idio24gpio->reg->out16_23, &idio24gpio->reg->in0_7,
+		&idio24gpio->reg->in8_15, &idio24gpio->reg->in16_23,
 	};
 	const unsigned long out_mode_mask = BIT(1);
 
@@ -236,7 +236,7 @@ static int idio_24_gpio_get_multiple(struct gpio_chip *chip,
 
 		/* read bits from current gpio port (port 6 is TTL GPIO) */
 		if (i < 6)
-			port_state = ioread8(ports + i);
+			port_state = ioread8(ports[i]);
 		else if (ioread8(&idio24gpio->reg->ctl) & out_mode_mask)
 			port_state = ioread8(&idio24gpio->reg->ttl_out0_7);
 		else
@@ -301,9 +301,9 @@ static void idio_24_gpio_set_multiple(struct gpio_chip *chip,
 	const unsigned long port_mask = GENMASK(gpio_reg_size, 0);
 	unsigned long flags;
 	unsigned int out_state;
-	u8 __iomem ports[] = {
-		idio24gpio->reg->out0_7, idio24gpio->reg->out8_15,
-		idio24gpio->reg->out16_23
+	void __iomem *ports[] = {
+		&idio24gpio->reg->out0_7, &idio24gpio->reg->out8_15,
+		&idio24gpio->reg->out16_23
 	};
 	const unsigned long out_mode_mask = BIT(1);
 	const unsigned int ttl_offset = 48;
@@ -327,9 +327,9 @@ static void idio_24_gpio_set_multiple(struct gpio_chip *chip,
 		raw_spin_lock_irqsave(&idio24gpio->lock, flags);
 
 		/* process output lines */
-		out_state = ioread8(ports + i) & ~gpio_mask;
+		out_state = ioread8(ports[i]) & ~gpio_mask;
 		out_state |= (*bits >> bits_offset) & gpio_mask;
-		iowrite8(out_state, ports + i);
+		iowrite8(out_state, ports[i]);
 
 		raw_spin_unlock_irqrestore(&idio24gpio->lock, flags);
 	}
-- 
2.16.2

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/2] gpio: pci-idio-16: Fix port memory offset for get_multiple callback
  2018-04-18 12:53 ` [PATCH 1/2] gpio: pci-idio-16: Fix port memory offset for get_multiple callback William Breathitt Gray
@ 2018-04-26 22:55   ` Linus Walleij
  0 siblings, 0 replies; 5+ messages in thread
From: Linus Walleij @ 2018-04-26 22:55 UTC (permalink / raw)
  To: William Breathitt Gray; +Cc: open list:GPIO SUBSYSTEM, linux-kernel

On Wed, Apr 18, 2018 at 2:53 PM, William Breathitt Gray
<vilhelm.gray@gmail.com> wrote:

> The ioread8 function expects a memory offset argument. This patch fixes
> the ports array to provide the memory addresses of the respective device
> I/O registers.
>
> Fixes: 810ebfc5efca ("gpio: pci-idio-16: Implement get_multiple callback")
> Signed-off-by: William Breathitt Gray <vilhelm.gray@gmail.com>

Patch applied for fixes.

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 2/2] gpio: pcie-idio-24: Fix port memory offset for get_multiple/set_multiple callbacks
  2018-04-18 12:53 ` [PATCH 2/2] gpio: pcie-idio-24: Fix port memory offset for get_multiple/set_multiple callbacks William Breathitt Gray
@ 2018-04-26 22:56   ` Linus Walleij
  0 siblings, 0 replies; 5+ messages in thread
From: Linus Walleij @ 2018-04-26 22:56 UTC (permalink / raw)
  To: William Breathitt Gray; +Cc: open list:GPIO SUBSYSTEM, linux-kernel

On Wed, Apr 18, 2018 at 2:53 PM, William Breathitt Gray
<vilhelm.gray@gmail.com> wrote:

> The ioread8/iowrite8 functions expect a memory offset argument. This
> patch fixes the ports array to provide the memory addresses of the
> respective device I/O registers.
>
> Fixes: ca37081595a2 ("gpio: pcie-idio-24: Implement get_multiple/set_multiple callbacks")
> Signed-off-by: William Breathitt Gray <vilhelm.gray@gmail.com>

Patch applied for fixes.

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2018-04-26 22:56 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-18 12:52 [PATCH 0/2] Fix port memory offsets for IDIO series drivers William Breathitt Gray
2018-04-18 12:53 ` [PATCH 1/2] gpio: pci-idio-16: Fix port memory offset for get_multiple callback William Breathitt Gray
2018-04-26 22:55   ` Linus Walleij
2018-04-18 12:53 ` [PATCH 2/2] gpio: pcie-idio-24: Fix port memory offset for get_multiple/set_multiple callbacks William Breathitt Gray
2018-04-26 22:56   ` Linus Walleij

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).