[v9,08/10] serial: sc16is7xx: add call to get rs485 DT flags and properties

Message ID 20230725142343.1724130-9-hugo@hugovil.com
State New
Headers
Series serial: sc16is7xx: fix GPIO regression and rs485 improvements |

Commit Message

Hugo Villeneuve July 25, 2023, 2:23 p.m. UTC
  From: Hugo Villeneuve <hvilleneuve@dimonoff.com>

Add call to uart_get_rs485_mode() to probe for RS485 flags and
properties from device tree.

Signed-off-by: Hugo Villeneuve <hvilleneuve@dimonoff.com>
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Reviewed-by: Lech Perczak <lech.perczak@camlingroup.com>
Tested-by: Lech Perczak <lech.perczak@camlingroup.com>
---
 drivers/tty/serial/sc16is7xx.c | 4 ++++
 1 file changed, 4 insertions(+)
  

Comments

Greg KH July 31, 2023, 3:59 p.m. UTC | #1
On Tue, Jul 25, 2023 at 10:23:40AM -0400, Hugo Villeneuve wrote:
> From: Hugo Villeneuve <hvilleneuve@dimonoff.com>
> 
> Add call to uart_get_rs485_mode() to probe for RS485 flags and
> properties from device tree.

Again, you are saying what you are doing, but not why.  I have no hint
as to if this is a bugfix, or a new features, or something else?

thanks,

greg k-h
  
Hugo Villeneuve Aug. 3, 2023, 2:38 p.m. UTC | #2
On Mon, 31 Jul 2023 17:59:14 +0200
Greg KH <gregkh@linuxfoundation.org> wrote:

> On Tue, Jul 25, 2023 at 10:23:40AM -0400, Hugo Villeneuve wrote:
> > From: Hugo Villeneuve <hvilleneuve@dimonoff.com>
> > 
> > Add call to uart_get_rs485_mode() to probe for RS485 flags and
> > properties from device tree.
> 
> Again, you are saying what you are doing, but not why.  I have no hint
> as to if this is a bugfix, or a new features, or something else?
> 
> thanks,
> 
> greg k-h

Hi Greg,
I could change the commit message to:

---------
serial: sc16is7xx: add missing support for rs485 devicetree properties

Retrieve rs485 devicetree properties on registration of sc16is7xx ports
in case they are attached to an rs485 transceiver.
---------

I don't think that it should be considered as a bug fix, but maybe as a
missing feature.

And does it mean that it should also go to older (stable) kernels then?
If yes, then do I need to add the "Fixes" tag?

Thank you,
Hugo.
  
Greg KH Aug. 4, 2023, 1:14 p.m. UTC | #3
On Thu, Aug 03, 2023 at 10:38:14AM -0400, Hugo Villeneuve wrote:
> On Mon, 31 Jul 2023 17:59:14 +0200
> Greg KH <gregkh@linuxfoundation.org> wrote:
> 
> > On Tue, Jul 25, 2023 at 10:23:40AM -0400, Hugo Villeneuve wrote:
> > > From: Hugo Villeneuve <hvilleneuve@dimonoff.com>
> > > 
> > > Add call to uart_get_rs485_mode() to probe for RS485 flags and
> > > properties from device tree.
> > 
> > Again, you are saying what you are doing, but not why.  I have no hint
> > as to if this is a bugfix, or a new features, or something else?
> > 
> > thanks,
> > 
> > greg k-h
> 
> Hi Greg,
> I could change the commit message to:
> 
> ---------
> serial: sc16is7xx: add missing support for rs485 devicetree properties
> 
> Retrieve rs485 devicetree properties on registration of sc16is7xx ports
> in case they are attached to an rs485 transceiver.
> ---------
> 
> I don't think that it should be considered as a bug fix, but maybe as a
> missing feature.
> 
> And does it mean that it should also go to older (stable) kernels then?
> If yes, then do I need to add the "Fixes" tag?

Does it fix a problem?  If so, yes, it should go to older kernels.  If
not, then no.

thanks,

greg k-h
  

Patch

diff --git a/drivers/tty/serial/sc16is7xx.c b/drivers/tty/serial/sc16is7xx.c
index 07ae889db296..49213be60baf 100644
--- a/drivers/tty/serial/sc16is7xx.c
+++ b/drivers/tty/serial/sc16is7xx.c
@@ -1549,6 +1549,10 @@  static int sc16is7xx_probe(struct device *dev,
 			goto out_ports;
 		}
 
+		ret = uart_get_rs485_mode(&s->p[i].port);
+		if (ret)
+			goto out_ports;
+
 		/* Disable all interrupts */
 		sc16is7xx_port_write(&s->p[i].port, SC16IS7XX_IER_REG, 0);
 		/* Disable TX/RX */