* [PATCH 1/6] gpio: 104-dio-48e: Mask read inputs for get_multiple
2018-10-22 12:08 [PATCH 0/6] Mask read inputs for get_multiple callbacks William Breathitt Gray
@ 2018-10-22 12:08 ` William Breathitt Gray
2018-10-22 12:09 ` [PATCH 2/6] gpio: 104-idi-48e: Mask the " William Breathitt Gray
` (5 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: William Breathitt Gray @ 2018-10-22 12:08 UTC (permalink / raw)
To: linus.walleij; +Cc: linux, linux-gpio, linux-kernel, William Breathitt Gray
This patch masks the read inputs with the word mask in order to ensure
only requested input states are returned in the bits array.
Suggested-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Signed-off-by: William Breathitt Gray <vilhelm.gray@gmail.com>
---
drivers/gpio/gpio-104-dio-48e.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpio/gpio-104-dio-48e.c b/drivers/gpio/gpio-104-dio-48e.c
index 9c4e07fcb74b..92c8f944bf64 100644
--- a/drivers/gpio/gpio-104-dio-48e.c
+++ b/drivers/gpio/gpio-104-dio-48e.c
@@ -222,7 +222,7 @@ static int dio48e_gpio_get_multiple(struct gpio_chip *chip, unsigned long *mask,
port_state = inb(dio48egpio->base + ports[i]);
/* store acquired bits at respective bits array offset */
- bits[word_index] |= port_state << word_offset;
+ bits[word_index] |= (port_state << word_offset) & word_mask;
}
return 0;
--
2.19.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 2/6] gpio: 104-idi-48e: Mask the read inputs for get_multiple
2018-10-22 12:08 [PATCH 0/6] Mask read inputs for get_multiple callbacks William Breathitt Gray
2018-10-22 12:08 ` [PATCH 1/6] gpio: 104-dio-48e: Mask read inputs for get_multiple William Breathitt Gray
@ 2018-10-22 12:09 ` William Breathitt Gray
2018-10-22 12:09 ` [PATCH 3/6] gpio: gpio-mm: Mask " William Breathitt Gray
` (4 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: William Breathitt Gray @ 2018-10-22 12:09 UTC (permalink / raw)
To: linus.walleij; +Cc: linux, linux-gpio, linux-kernel, William Breathitt Gray
This patch masks the read inputs with the word mask in order to ensure
only requested input states are returned in the bits array.
Suggested-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Signed-off-by: William Breathitt Gray <vilhelm.gray@gmail.com>
---
drivers/gpio/gpio-104-idi-48.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpio/gpio-104-idi-48.c b/drivers/gpio/gpio-104-idi-48.c
index 2c9738adb3a6..88dc6f2449f6 100644
--- a/drivers/gpio/gpio-104-idi-48.c
+++ b/drivers/gpio/gpio-104-idi-48.c
@@ -128,7 +128,7 @@ static int idi_48_gpio_get_multiple(struct gpio_chip *chip, unsigned long *mask,
port_state = inb(idi48gpio->base + ports[i]);
/* store acquired bits at respective bits array offset */
- bits[word_index] |= port_state << word_offset;
+ bits[word_index] |= (port_state << word_offset) & word_mask;
}
return 0;
--
2.19.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 3/6] gpio: gpio-mm: Mask read inputs for get_multiple
2018-10-22 12:08 [PATCH 0/6] Mask read inputs for get_multiple callbacks William Breathitt Gray
2018-10-22 12:08 ` [PATCH 1/6] gpio: 104-dio-48e: Mask read inputs for get_multiple William Breathitt Gray
2018-10-22 12:09 ` [PATCH 2/6] gpio: 104-idi-48e: Mask the " William Breathitt Gray
@ 2018-10-22 12:09 ` William Breathitt Gray
2018-10-22 12:09 ` [PATCH 4/6] gpio: ws16c48: " William Breathitt Gray
` (3 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: William Breathitt Gray @ 2018-10-22 12:09 UTC (permalink / raw)
To: linus.walleij; +Cc: linux, linux-gpio, linux-kernel, William Breathitt Gray
This patch masks the read inputs with the word mask in order to ensure
only requested input states are returned in the bits array.
Suggested-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Signed-off-by: William Breathitt Gray <vilhelm.gray@gmail.com>
---
drivers/gpio/gpio-gpio-mm.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpio/gpio-gpio-mm.c b/drivers/gpio/gpio-gpio-mm.c
index b56ff2efbf36..8c150fd68d9d 100644
--- a/drivers/gpio/gpio-gpio-mm.c
+++ b/drivers/gpio/gpio-gpio-mm.c
@@ -211,7 +211,7 @@ static int gpiomm_gpio_get_multiple(struct gpio_chip *chip, unsigned long *mask,
port_state = inb(gpiommgpio->base + ports[i]);
/* store acquired bits at respective bits array offset */
- bits[word_index] |= port_state << word_offset;
+ bits[word_index] |= (port_state << word_offset) & word_mask;
}
return 0;
--
2.19.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 4/6] gpio: ws16c48: Mask read inputs for get_multiple
2018-10-22 12:08 [PATCH 0/6] Mask read inputs for get_multiple callbacks William Breathitt Gray
` (2 preceding siblings ...)
2018-10-22 12:09 ` [PATCH 3/6] gpio: gpio-mm: Mask " William Breathitt Gray
@ 2018-10-22 12:09 ` William Breathitt Gray
2018-10-22 12:10 ` [PATCH 5/6] gpio: pci-idio-16: " William Breathitt Gray
` (2 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: William Breathitt Gray @ 2018-10-22 12:09 UTC (permalink / raw)
To: linus.walleij; +Cc: linux, linux-gpio, linux-kernel, William Breathitt Gray
This patch masks the read inputs with the word mask in order to ensure
only requested input states are returned in the bits array.
Suggested-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Signed-off-by: William Breathitt Gray <vilhelm.gray@gmail.com>
---
drivers/gpio/gpio-ws16c48.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpio/gpio-ws16c48.c b/drivers/gpio/gpio-ws16c48.c
index c7028eb0b8e1..5cf3697bfb15 100644
--- a/drivers/gpio/gpio-ws16c48.c
+++ b/drivers/gpio/gpio-ws16c48.c
@@ -169,7 +169,7 @@ static int ws16c48_gpio_get_multiple(struct gpio_chip *chip,
port_state = inb(ws16c48gpio->base + i);
/* store acquired bits at respective bits array offset */
- bits[word_index] |= port_state << word_offset;
+ bits[word_index] |= (port_state << word_offset) & word_mask;
}
return 0;
--
2.19.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 5/6] gpio: pci-idio-16: Mask read inputs for get_multiple
2018-10-22 12:08 [PATCH 0/6] Mask read inputs for get_multiple callbacks William Breathitt Gray
` (3 preceding siblings ...)
2018-10-22 12:09 ` [PATCH 4/6] gpio: ws16c48: " William Breathitt Gray
@ 2018-10-22 12:10 ` William Breathitt Gray
2018-10-22 12:10 ` [PATCH 6/6] gpio: pcie-idio-24: " William Breathitt Gray
2018-10-31 9:00 ` [PATCH 0/6] Mask read inputs for get_multiple callbacks Linus Walleij
6 siblings, 0 replies; 8+ messages in thread
From: William Breathitt Gray @ 2018-10-22 12:10 UTC (permalink / raw)
To: linus.walleij; +Cc: linux, linux-gpio, linux-kernel, William Breathitt Gray
This patch masks the read inputs with the word mask in order to ensure
only requested input states are returned in the bits array.
Suggested-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Signed-off-by: William Breathitt Gray <vilhelm.gray@gmail.com>
---
drivers/gpio/gpio-pci-idio-16.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpio/gpio-pci-idio-16.c b/drivers/gpio/gpio-pci-idio-16.c
index 25d16b2af1c3..6b7349783223 100644
--- a/drivers/gpio/gpio-pci-idio-16.c
+++ b/drivers/gpio/gpio-pci-idio-16.c
@@ -146,7 +146,7 @@ static int idio_16_gpio_get_multiple(struct gpio_chip *chip,
port_state = ioread8(ports[i]);
/* store acquired bits at respective bits array offset */
- bits[word_index] |= port_state << word_offset;
+ bits[word_index] |= (port_state << word_offset) & word_mask;
}
return 0;
--
2.19.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 6/6] gpio: pcie-idio-24: Mask read inputs for get_multiple
2018-10-22 12:08 [PATCH 0/6] Mask read inputs for get_multiple callbacks William Breathitt Gray
` (4 preceding siblings ...)
2018-10-22 12:10 ` [PATCH 5/6] gpio: pci-idio-16: " William Breathitt Gray
@ 2018-10-22 12:10 ` William Breathitt Gray
2018-10-31 9:00 ` [PATCH 0/6] Mask read inputs for get_multiple callbacks Linus Walleij
6 siblings, 0 replies; 8+ messages in thread
From: William Breathitt Gray @ 2018-10-22 12:10 UTC (permalink / raw)
To: linus.walleij; +Cc: linux, linux-gpio, linux-kernel, William Breathitt Gray
This patch masks the read inputs with the word mask in order to ensure
only requested input states are returned in the bits array.
Suggested-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Signed-off-by: William Breathitt Gray <vilhelm.gray@gmail.com>
---
drivers/gpio/gpio-pcie-idio-24.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpio/gpio-pcie-idio-24.c b/drivers/gpio/gpio-pcie-idio-24.c
index f953541e7890..52f1647a46fd 100644
--- a/drivers/gpio/gpio-pcie-idio-24.c
+++ b/drivers/gpio/gpio-pcie-idio-24.c
@@ -243,7 +243,7 @@ static int idio_24_gpio_get_multiple(struct gpio_chip *chip,
port_state = ioread8(&idio24gpio->reg->ttl_in0_7);
/* store acquired bits at respective bits array offset */
- bits[word_index] |= port_state << word_offset;
+ bits[word_index] |= (port_state << word_offset) & word_mask;
}
return 0;
--
2.19.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH 0/6] Mask read inputs for get_multiple callbacks
2018-10-22 12:08 [PATCH 0/6] Mask read inputs for get_multiple callbacks William Breathitt Gray
` (5 preceding siblings ...)
2018-10-22 12:10 ` [PATCH 6/6] gpio: pcie-idio-24: " William Breathitt Gray
@ 2018-10-31 9:00 ` Linus Walleij
6 siblings, 0 replies; 8+ messages in thread
From: Linus Walleij @ 2018-10-31 9:00 UTC (permalink / raw)
To: William Breathitt Gray
Cc: Rasmus Villemoes, open list:GPIO SUBSYSTEM, linux-kernel
On Mon, Oct 22, 2018 at 2:08 PM William Breathitt Gray
<vilhelm.gray@gmail.com> wrote:
> The implementation for several drivers' get_multiple callbacks return
> additional input states that were not requested by the mask passed in.
> Although the current caller in the kernel does not care, it would be
> prudent to ensure the behavior of the get_multiple implementations is to
> return exactly the requested input states and not more. This patchset
> ensures such behavior by applying a final mask on the read inputs before
> setting the bits array.
>
> William Breathitt Gray (6):
> gpio: 104-dio-48e: Mask read inputs for get_multiple
> gpio: 104-idi-48e: Mask the read inputs for get_multiple
> gpio: gpio-mm: Mask read inputs for get_multiple
> gpio: ws16c48: Mask read inputs for get_multiple
> gpio: pci-idio-16: Mask read inputs for get_multiple
> gpio: pcie-idio-24: Mask read inputs for get_multiple
All patches applied for v4.21.
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 8+ messages in thread