diff mbox series

[02/62] gpio: gpio-104-dio-48e: Use new GPIO_LINE_DIRECTION

Message ID d25edcc3a5d912be9d7c3a927bad6baf34a1331e.1572945605.git.matti.vaittinen@fi.rohmeurope.com
State New
Headers show
Series [01/62] gpio: Add definition for GPIO direction | expand

Commit Message

Matti Vaittinen Nov. 5, 2019, 10:09 a.m. UTC
It's hard for occasional GPIO code reader/writer to know if values 0/1
equal to IN or OUT. Use defined GPIO_LINE_DIRECTION_IN and
GPIO_LINE_DIRECTION_OUT to help them out.

Signed-off-by: Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>
---
 drivers/gpio/gpio-104-dio-48e.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Comments

Linus Walleij Nov. 5, 2019, 3:23 p.m. UTC | #1
On Tue, Nov 5, 2019 at 11:10 AM Matti Vaittinen
<matti.vaittinen@fi.rohmeurope.com> wrote:

> It's hard for occasional GPIO code reader/writer to know if values 0/1
> equal to IN or OUT. Use defined GPIO_LINE_DIRECTION_IN and
> GPIO_LINE_DIRECTION_OUT to help them out.
>
> Signed-off-by: Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>

Please merge all of these patches 2-n into one to avoid patch bombs
and just make one technical step.

Oh the patch bomb already dropped, hehe. Anyways I want one
big patch to apply. Please make sure it applies on the GPIO tree's
"devel" branch.

Collect any ACKs and drop most from the CC else the driver
maintainers may get annoyed.

Yours,
Linus Walleij
Matti Vaittinen Nov. 6, 2019, 6:58 a.m. UTC | #2
On Tue, 2019-11-05 at 16:23 +0100, Linus Walleij wrote:
> On Tue, Nov 5, 2019 at 11:10 AM Matti Vaittinen
> <matti.vaittinen@fi.rohmeurope.com> wrote:
> 
> > It's hard for occasional GPIO code reader/writer to know if values
> > 0/1
> > equal to IN or OUT. Use defined GPIO_LINE_DIRECTION_IN and
> > GPIO_LINE_DIRECTION_OUT to help them out.
> > 
> > Signed-off-by: Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>
> 
> Please merge all of these patches 2-n into one to avoid patch bombs
> and just make one technical step.
> 
> Oh the patch bomb already dropped, hehe. 

I was slightly impatient ^_^;

I did split the patch set into this many patches so that driver
maintainers would only need to check their own driver (just few lines).
I also thought that if some driver maintainers have objections then it
is easy to drop out such patch. The "patch bomb" 

(which you referred in the other mail 
https://lore.kernel.org/lkml/CACRpkdav+Sz04WE6N5KkKMQLOtx2BZrjWrEin06yPZQ31a47hg@mail.gmail.com/
)

was really only such bomb for you and Bartosz (+GPIO/LKML mail lists) -
I did not CC all patches to everyone - driver maintainers only got the
patch adding the define(s) and a patch for their respective driver(s)
:) Unfortunately I messed up the message IDs from mail headers so the
mails for the series were not properly threaded :/

> Anyways I want one
> big patch to apply. Please make sure it applies on the GPIO tree's
> "devel" branch.

Right. I guess I can do that.

> Collect any ACKs and drop most from the CC else the driver
> maintainers may get annoyed.

My problem is that I don't know who are the driver maintainers I should
keep and who I should drop. I don't usually know who are interested in 
which changes.


> 
> Yours,
> Linus Walleij
Linus Walleij Nov. 7, 2019, 8:15 a.m. UTC | #3
On Wed, Nov 6, 2019 at 7:58 AM Vaittinen, Matti
<Matti.Vaittinen@fi.rohmeurope.com> wrote:
> On Tue, 2019-11-05 at 16:23 +0100, Linus Walleij wrote:

> > Oh the patch bomb already dropped, hehe.
>
> I was slightly impatient ^_^;

No big deal.

> > Anyways I want one
> > big patch to apply. Please make sure it applies on the GPIO tree's
> > "devel" branch.
>
> Right. I guess I can do that.

Thanks!

> > Collect any ACKs and drop most from the CC else the driver
> > maintainers may get annoyed.
>
> My problem is that I don't know who are the driver maintainers I should
> keep and who I should drop. I don't usually know who are interested in
> which changes.

The process is not perfect, just some best effort is fine, as subsystem
maintainer I do merge mechanical patches like this across all drivers
without consent of every possible stakeholder, it's impossible to
involve everyone.

Yours,
Linus Walleij
diff mbox series

Patch

diff --git a/drivers/gpio/gpio-104-dio-48e.c b/drivers/gpio/gpio-104-dio-48e.c
index a44fa8af5b0d..400c09b905f8 100644
--- a/drivers/gpio/gpio-104-dio-48e.c
+++ b/drivers/gpio/gpio-104-dio-48e.c
@@ -59,7 +59,10 @@  static int dio48e_gpio_get_direction(struct gpio_chip *chip, unsigned offset)
 	const unsigned port = offset / 8;
 	const unsigned mask = BIT(offset % 8);
 
-	return !!(dio48egpio->io_state[port] & mask);
+	if (dio48egpio->io_state[port] & mask)
+		return  GPIO_LINE_DIRECTION_IN;
+
+	return GPIO_LINE_DIRECTION_OUT;
 }
 
 static int dio48e_gpio_direction_input(struct gpio_chip *chip, unsigned offset)