Skip to contentSkip to conversation

serial: etraxfs-uart: Update gpiod API

PATCH In review Guenter Roeck 5 participants 12 messages Jul 21, 2015 – Jul 27, 2015 TTY layer and serial drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 serial: etraxfs-uart: Update gpiod API

Commit b17d1bf16cc7 ("gpio: make flags mandatory for gpiod_get functions") makes the flags argument to devm_gpiod_get_optional mandatory but does not update all users. This results in the following build error.

drivers/tty/serial/etraxfs-uart.c:933:16: error:
too few arguments to function ‘devm_gpiod_get_optional’

Fixes b17d1bf16cc7 ("gpio: make flags mandatory for gpiod_get functions")
Cc Uwe Kleine-König <[email protected]>
---
 drivers/tty/serial/etraxfs-uart.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/tty/serial/etraxfs-uart.c +4 -4
index a57301a6fe42..e35a19b214d5 100644
@@ -930,10 +930,10 @@ static int etraxfs_uart_probe(struct platform_device *pdev)
 
 	up->irq = irq_of_parse_and_map(np, 0);
 	up->regi_ser = of_iomap(np, 0);
-	up->dtr_pin = devm_gpiod_get_optional(&pdev->dev, "dtr");
-	up->dsr_pin = devm_gpiod_get_optional(&pdev->dev, "dsr");
-	up->ri_pin = devm_gpiod_get_optional(&pdev->dev, "ri");
-	up->cd_pin = devm_gpiod_get_optional(&pdev->dev, "cd");
+	up->dtr_pin = devm_gpiod_get_optional(&pdev->dev, "dtr", GPIOD_ASIS);
+	up->dsr_pin = devm_gpiod_get_optional(&pdev->dev, "dsr", GPIOD_ASIS);
+	up->ri_pin = devm_gpiod_get_optional(&pdev->dev, "ri", GPIOD_ASIS);
+	up->cd_pin = devm_gpiod_get_optional(&pdev->dev, "cd", GPIOD_ASIS);
 	up->port.dev = &pdev->dev;
 	cris_serial_port_init(&up->port, dev_id);
 
Signature · 1 line
2.1.0
#1 lore raw
Quoted 10 lines · Guenter Roeck

Commit b17d1bf16cc7 ("gpio: make flags mandatory for gpiod_get functions") makes the flags argument to devm_gpiod_get_optional mandatory but does not update all users. This results in the following build error.

drivers/tty/serial/etraxfs-uart.c:933:16: error:
too few arguments to function ‘devm_gpiod_get_optional’

Fixes b17d1bf16cc7 ("gpio: make flags mandatory for gpiod_get functions")
Cc Uwe Kleine-König <[email protected]>

We discussed this driver while I worked on updating the gpiod API. I don't care much about this driver, but if you want to do something about the build failure, I'd prefer:

drivers/tty/serial/Kconfig +1 -0
index 76e65b714471..3a6a7c235f09 100644
@@ -1066,6 +1066,7 @@ config SERIAL_VT8500_CONSOLE
 config SERIAL_ETRAXFS
 	bool "ETRAX FS serial port support"
 	depends on ETRAX_ARCH_V32 && OF
+	depends on BROKEN
 	select SERIAL_CORE
 
 config SERIAL_ETRAXFS_CONSOLE

Best regards
Uwe

Signature · 2 lines
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
#2 lore raw
Quoted 28 lines · Uwe Kleine-König
Quoted 10 lines · Guenter Roeck

Commit b17d1bf16cc7 ("gpio: make flags mandatory for gpiod_get functions") makes the flags argument to devm_gpiod_get_optional mandatory but does not update all users. This results in the following build error.

drivers/tty/serial/etraxfs-uart.c:933:16: error:
too few arguments to function ‘devm_gpiod_get_optional’

Fixes b17d1bf16cc7 ("gpio: make flags mandatory for gpiod_get functions")
Cc Uwe Kleine-König <[email protected]>

We discussed this driver while I worked on updating the gpiod API. I don't care much about this driver, but if you want to do something about the build failure, I'd prefer:

drivers/tty/serial/Kconfig +1 -0
index 76e65b714471..3a6a7c235f09 100644
@@ -1066,6 +1066,7 @@ config SERIAL_VT8500_CONSOLE
  config SERIAL_ETRAXFS
  	bool "ETRAX FS serial port support"
  	depends on ETRAX_ARCH_V32 && OF
+	depends on BROKEN
  	select SERIAL_CORE
 
  config SERIAL_ETRAXFS_CONSOLE
Quoted 3 lines

Best regards
Uwe

Uwe,

I understand the value of BROKEN, but I do not think it would be appropriate here. It would be appropriate for a driver which is really broken, not one that doesn't build anymore because an API it uses was updated and the driver code wasn't updated for some reason.

With your suggested patch I would no longer be able to run my qemu tests for this architecture, which I would not entirely be happy about.

You may not care, but maybe others do.

Makes me wonder: It used to be that API changes were handled by those making the API changes, not by those responsible for the code using the API. Has this changed recently, ie is it now acceptable to not update all callers of a modified API (on purpose, as it looks like it was done here) ?

Thanks,
Guenter

#3 lore raw

Hello,

Quoted 43 lines · Guenter Roeck
Quoted 28 lines · Uwe Kleine-König
Quoted 10 lines · Guenter Roeck

Commit b17d1bf16cc7 ("gpio: make flags mandatory for gpiod_get functions") makes the flags argument to devm_gpiod_get_optional mandatory but does not update all users. This results in the following build error.

drivers/tty/serial/etraxfs-uart.c:933:16: error:
too few arguments to function ‘devm_gpiod_get_optional’

Fixes b17d1bf16cc7 ("gpio: make flags mandatory for gpiod_get functions")
Cc Uwe Kleine-König <[email protected]>

We discussed this driver while I worked on updating the gpiod API. I don't care much about this driver, but if you want to do something about the build failure, I'd prefer:

drivers/tty/serial/Kconfig +1 -0
index 76e65b714471..3a6a7c235f09 100644
@@ -1066,6 +1066,7 @@ config SERIAL_VT8500_CONSOLE
 config SERIAL_ETRAXFS
 	bool "ETRAX FS serial port support"
 	depends on ETRAX_ARCH_V32 && OF
+	depends on BROKEN
 	select SERIAL_CORE
 
 config SERIAL_ETRAXFS_CONSOLE
Quoted 3 lines

Best regards
Uwe

Uwe,

I understand the value of BROKEN, but I do not think it would be appropriate here. It would be appropriate for a driver which is really broken, not one that doesn't build anymore because an API it uses was updated and the driver code wasn't updated for some reason.

With your suggested patch I would no longer be able to run my qemu tests for this architecture, which I would not entirely be happy about.

Quoted 7 lines

You may not care, but maybe others do.

Makes me wonder: It used to be that API changes were handled by those making the API changes, not by those responsible for the code using the API. Has this changed recently, ie is it now acceptable to not update all callers of a modified API (on purpose, as it looks like it was done here) ?

While I stumbled over the calls to gpiod_get variants in the etraxfs serial driver I noticed several problems with that driver. I pointed them out in

	http://www.spinics.net/lists/linux-serial/msg17794.html

. If you read the follow-ups Jesper Nilsson then said:

I can push a patch that just drops all signal handling (since it's bogus ATM), or you can ignore the driver as currently implemented.

I explicitly did the latter. Apart from that single driver I fixed all users. @Jesper: You said you poked Niklas to care for that. Any news from that front?

I'm all for the usual habit that API changes should be handled by the API changer. But if the code was already relying on undefined behaviour before the change and fixing that needs testing on the respective hardware, I think pushing the needed work back to the driver owner is fine. IMHO a simple build fix that doesn't fix the brokeness isn't that helpful here.

Having said that I don't care for that driver. So if you say it's good enough for you to simply add GPIOD_ASIS and the responsible maintainers are ok, too, I won't stand in the way.

Best regards
Uwe

Signature · 2 lines
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
#4 lore raw
Quoted 4 lines · Uwe Kleine-König

While I stumbled over the calls to gpiod_get variants in the etraxfs serial driver I noticed several problems with that driver. I pointed them out in

Quoted 8 lines
	http://www.spinics.net/lists/linux-serial/msg17794.html

. If you read the follow-ups Jesper Nilsson then said:

I can push a patch that just drops all signal handling (since it's bogus ATM), or you can ignore the driver as currently implemented.

If you want to mark the driver as BROKEN due to those other problems, go ahead, and I'll drop the architecture from my tests. But it should not be marked BROKEN because you did not update an API.

Quoted 11 lines

I explicitly did the latter. Apart from that single driver I fixed all users. @Jesper: You said you poked Niklas to care for that. Any news from that front?

I'm all for the usual habit that API changes should be handled by the API changer. But if the code was already relying on undefined behaviour before the change and fixing that needs testing on the respective hardware, I think pushing the needed work back to the driver owner is fine. IMHO a simple build fix that doesn't fix the brokeness isn't that helpful here.

The driver works fine for me (in qemu), possibly because qemu doesn't use/need modem lines.

Guenter

#5 lore raw
In reply to Uwe Kleine-König
Quoted 61 lines · Uwe Kleine-König

Hello,

Quoted 43 lines · Guenter Roeck
Quoted 28 lines · Uwe Kleine-König
Quoted 10 lines · Guenter Roeck

Commit b17d1bf16cc7 ("gpio: make flags mandatory for gpiod_get functions") makes the flags argument to devm_gpiod_get_optional mandatory but does not update all users. This results in the following build error.

drivers/tty/serial/etraxfs-uart.c:933:16: error:
too few arguments to function ‘devm_gpiod_get_optional’

Fixes b17d1bf16cc7 ("gpio: make flags mandatory for gpiod_get functions")
Cc Uwe Kleine-König <[email protected]>

We discussed this driver while I worked on updating the gpiod API. I don't care much about this driver, but if you want to do something about the build failure, I'd prefer:

drivers/tty/serial/Kconfig +1 -0
index 76e65b714471..3a6a7c235f09 100644
@@ -1066,6 +1066,7 @@ config SERIAL_VT8500_CONSOLE
 config SERIAL_ETRAXFS
 	bool "ETRAX FS serial port support"
 	depends on ETRAX_ARCH_V32 && OF
+	depends on BROKEN
 	select SERIAL_CORE
 
 config SERIAL_ETRAXFS_CONSOLE
Quoted 3 lines

Best regards
Uwe

Uwe,

I understand the value of BROKEN, but I do not think it would be appropriate here. It would be appropriate for a driver which is really broken, not one that doesn't build anymore because an API it uses was updated and the driver code wasn't updated for some reason.

With your suggested patch I would no longer be able to run my qemu tests for this architecture, which I would not entirely be happy about.

Quoted 7 lines

You may not care, but maybe others do.

Makes me wonder: It used to be that API changes were handled by those making the API changes, not by those responsible for the code using the API. Has this changed recently, ie is it now acceptable to not update all callers of a modified API (on purpose, as it looks like it was done here) ?

While I stumbled over the calls to gpiod_get variants in the etraxfs serial driver I noticed several problems with that driver. I pointed them out in

	http://www.spinics.net/lists/linux-serial/msg17794.html

. If you read the follow-ups Jesper Nilsson then said:

Quoted 7 lines

I can push a patch that just drops all signal handling (since it's bogus ATM), or you can ignore the driver as currently implemented.

I explicitly did the latter. Apart from that single driver I fixed all users. @Jesper: You said you poked Niklas to care for that. Any news from that front?

I've talked to Rabin Vincent, who has created an extraxfs gpio driver that supports gpiolib (will come with 4.2).
Because of that, it might be nice to keep the modem control stuff.

The proper fix is probably to remove the devm_gpiod_get_optional calls and instead use the serial_mctrl_gpio.c API.

I'll cook a patch this weekend.

Quoted 15 lines

I'm all for the usual habit that API changes should be handled by the API changer. But if the code was already relying on undefined behaviour before the change and fixing that needs testing on the respective hardware, I think pushing the needed work back to the driver owner is fine. IMHO a simple build fix that doesn't fix the brokeness isn't that helpful here.

Having said that I don't care for that driver. So if you say it's good enough for you to simply add GPIOD_ASIS and the responsible maintainers are ok, too, I won't stand in the way.

Best regards
Uwe

#6 lore raw
In reply to Guenter Roeck
Quoted 8 lines · Guenter Roeck

Commit b17d1bf16cc7 ("gpio: make flags mandatory for gpiod_get functions") makes the flags argument to devm_gpiod_get_optional mandatory but does not update all users. This results in the following build error.

drivers/tty/serial/etraxfs-uart.c:933:16: error:
too few arguments to function ‘devm_gpiod_get_optional’

Fixes b17d1bf16cc7 ("gpio: make flags mandatory for gpiod_get functions")

This patch isn't in Linus's tree, so whatever tree this commit is in, needs to also take this fix.

thanks,

greg k-h

#7 lore raw
Quoted 5 lines · Greg Kroah-Hartman
Quoted 4 lines · Guenter Roeck

Commit b17d1bf16cc7 ("gpio: make flags mandatory for gpiod_get functions") makes the flags argument to devm_gpiod_get_optional mandatory but does not update all users. This results in the following build error.

Quoted 7 lines
Quoted 4 lines

drivers/tty/serial/etraxfs-uart.c:933:16: error:
too few arguments to function ‘devm_gpiod_get_optional’

Fixes b17d1bf16cc7 ("gpio: make flags mandatory for gpiod_get functions")

This patch isn't in Linus's tree, so whatever tree this commit is in, needs to also take this fix.

It is in Linus's tree. The Walleij one though, not Torvalds :-)

Best regards
Uwe

Signature · 2 lines
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
#8 lore raw
In reply to Greg Kroah-Hartman
Quoted 5 lines · Greg Kroah-Hartman
Quoted 4 lines · Guenter Roeck

Commit b17d1bf16cc7 ("gpio: make flags mandatory for gpiod_get functions") makes the flags argument to devm_gpiod_get_optional mandatory but does not update all users. This results in the following build error.

Quoted 7 lines
Quoted 4 lines

drivers/tty/serial/etraxfs-uart.c:933:16: error:
too few arguments to function ‘devm_gpiod_get_optional’

Fixes b17d1bf16cc7 ("gpio: make flags mandatory for gpiod_get functions")

This patch isn't in Linus's tree, so whatever tree this commit is in, needs to also take this fix.

OK I'll take it. It's a bit messy with this breakage but it is for a good cause.

Niklas: send me your patch when finished.

Yours,
Linus Walleij

#9 lore raw
Quoted 12 lines · Linus Walleij
Quoted 10 lines · Greg Kroah-Hartman
Quoted 8 lines · Guenter Roeck

Commit b17d1bf16cc7 ("gpio: make flags mandatory for gpiod_get functions") makes the flags argument to devm_gpiod_get_optional mandatory but does not update all users. This results in the following build error.

drivers/tty/serial/etraxfs-uart.c:933:16: error:
too few arguments to function ‘devm_gpiod_get_optional’

Fixes b17d1bf16cc7 ("gpio: make flags mandatory for gpiod_get functions")
Quoted 7 lines
Quoted 2 lines

This patch isn't in Linus's tree, so whatever tree this commit is in, needs to also take this fix.

OK I'll take it. It's a bit messy with this breakage but it is for a good cause.

Niklas: send me your patch when finished.

I've already sent them to the linux-serial and linux-kernel mailing lists.

I'm sorry that I didn't think of CC:ing you Linus. It might be better if you take them, since you got the devm_gpiod_get_optional patches in your tree.

http://marc.info/?l=linux-serial&m=143778406314867

http://marc.info/?l=linux-serial&m=143778407714871

#10 lore raw
Quoted 19 lines · Niklas Cassel
Quoted 18 lines · Linus Walleij
Quoted 5 lines · Greg Kroah-Hartman
Quoted 4 lines · Guenter Roeck

Commit b17d1bf16cc7 ("gpio: make flags mandatory for gpiod_get functions") makes the flags argument to devm_gpiod_get_optional mandatory but does not update all users. This results in the following build error.

Quoted 7 lines
Quoted 4 lines

drivers/tty/serial/etraxfs-uart.c:933:16: error:
too few arguments to function ‘devm_gpiod_get_optional’

Fixes b17d1bf16cc7 ("gpio: make flags mandatory for gpiod_get functions")

This patch isn't in Linus's tree, so whatever tree this commit is in, needs to also take this fix.

OK I'll take it. It's a bit messy with this breakage but it is for a good cause.

Quoted 7 lines
Quoted 1 line

Niklas: send me your patch when finished.

I've already sent them to the linux-serial and linux-kernel mailing lists.

I'm sorry that I didn't think of CC:ing you Linus. It might be better if you take them, since you got the devm_gpiod_get_optional patches in your tree.

If you use devm_gpiod_get_optional with the additional flags parameter it should already now work for you. So if your change goes in before the gpio change (which only makes the flags parameter mandatory) everything is fine. Not sure this makes it easier though.

Best regards
Uwe

Signature · 2 lines
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
#11 lore raw
In reply to Niklas Cassel
Quoted 4 lines · Niklas Cassel
Quoted 1 line · Linus Walleij

Niklas: send me your patch when finished.

Quoted 8 lines

I've already sent them to the linux-serial and linux-kernel mailing lists.

I'm sorry that I didn't think of CC:ing you Linus. It might be better if you take them, since you got the devm_gpiod_get_optional patches in your tree.

http://marc.info/?l=linux-serial&m=143778406314867
http://marc.info/?l=linux-serial&m=143778407714871

This should work also with the current kernel, so better if Greg take them I guess. I'll go in and ACK it.

Yours,
Linus Walleij