2019-02-21 17:20:23

by Martin Kepplinger

[permalink] [raw]
Subject: [PATCH v2 1/9] serial: uapi: add SER_RS485_DELAY_IN_USEC flag to struct serial_rs485

This extends the user interface for rs485 communication:

We add a new flag, SER_RS485_DELAY_IN_USEC, to struct serial_rs485 that
indicates that delay_rts_before_send and delay_rts_after_send values are
interpreted in microsecond units.

Up until now, the code comment defined these values to hold the delays in
millisecond units. Especially with fast data rates (1Mbaut or more) that
are not too uncommon for RS485, 1ms become quite long. Users need to be
able to set shorter delays than 1 ms in order not to slow down the channel
unnecessarily.

So when delays are needed, but not as long as 1ms, this enables faster
communication channels without changing the baudrate.

Signed-off-by: Martin Kepplinger <[email protected]>
---

revision history
----------------
v2: re-send as a proper series after fixing my mailserver
v1: initial implementation idea


So have this totally quirky patch that uses udelay() in our tree
for a looong time now because of the above reasons - and because we are lazy.
This is an attempt to get rid of said patch on our side and fix this properly.

What do you thing about adding a flag in general?

The following patches should integrate this idea in devicetree and drivers.
These changes are NOT tested on hardware but should behave predictably
enough. I use the delays in a driver that doesn't implement them yet at
all. I'll do that after this (or something similar) is merged - it's a 2-liner
then.

Also, a patch to the rs485conf tool, that is sometimes used instead of
ioctl() directly, will be prepared as well.

thanks

martin



include/uapi/linux/serial.h | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/include/uapi/linux/serial.h b/include/uapi/linux/serial.h
index 93eb3c496ff1..c16c950ebca2 100644
--- a/include/uapi/linux/serial.h
+++ b/include/uapi/linux/serial.h
@@ -126,8 +126,15 @@ struct serial_rs485 {
#define SER_RS485_TERMINATE_BUS (1 << 5) /* Enable bus
termination
(if supported) */
- __u32 delay_rts_before_send; /* Delay before send (milliseconds) */
- __u32 delay_rts_after_send; /* Delay after send (milliseconds) */
+#define SER_RS485_DELAY_IN_USEC (1 << 6) /* delay_rts_*_send
+ values are given in
+ microseconds */
+ __u32 delay_rts_before_send; /* Delay before send (milliseconds
+ by default. microseconds if flag
+ is set) */
+ __u32 delay_rts_after_send; /* Delay after send (milliseconds
+ by default. microseconds if flag
+ is set) */
__u32 padding[5]; /* Memory is cheap, new structs
are a royal PITA .. */
};
--
2.20.1


Attachments:
smime.p7s (3.53 kB)

2019-02-21 17:19:17

by Martin Kepplinger

[permalink] [raw]
Subject: [PATCH v2 2/9] Documentation: serial-rs485: document SER_RS485_DELAY_IN_USEC flag

Document the new RS485 flag, SER_RS485_DELAY_IN_USEC that specifies that the
rts delay values stored in struct serial_rs485 hold values in microseconds
instead of milliseconds (the default).

Signed-off-by: Martin Kepplinger <[email protected]>
---
Documentation/serial/serial-rs485.txt | 3 +++
1 file changed, 3 insertions(+)

diff --git a/Documentation/serial/serial-rs485.txt b/Documentation/serial/serial-rs485.txt
index ce0c1a9b8aab..a1e15e9efc2e 100644
--- a/Documentation/serial/serial-rs485.txt
+++ b/Documentation/serial/serial-rs485.txt
@@ -75,6 +75,9 @@
/* Set rts delay after send, if needed: */
rs485conf.delay_rts_after_send = ...;

+ /* Specify the rts delay to be microseconds, not milliseconds */
+ rs485conf.flags |= SER_RS485_DELAY_IN_USEC;
+
/* Set this flag if you want to receive data even while sending data */
rs485conf.flags |= SER_RS485_RX_DURING_TX;

--
2.20.1


Attachments:
smime.p7s (3.53 kB)

2019-02-21 17:19:27

by Martin Kepplinger

[permalink] [raw]
Subject: [PATCH v2 4/9] serial: 8250: add support for rs485 RTS delays in microseconds

Read struct serial_rs485's flag SER_RS485_DELAY_IN_USEC and apply the delay
accordingly.

Signed-off-by: Martin Kepplinger <[email protected]>
---
drivers/tty/serial/8250/8250_omap.c | 13 +++++++++++--
drivers/tty/serial/8250/8250_port.c | 25 +++++++++++++++++++++----
2 files changed, 32 insertions(+), 6 deletions(-)

diff --git a/drivers/tty/serial/8250/8250_omap.c b/drivers/tty/serial/8250/8250_omap.c
index 0a8316632d75..cbce43ac60b1 100644
--- a/drivers/tty/serial/8250/8250_omap.c
+++ b/drivers/tty/serial/8250/8250_omap.c
@@ -720,8 +720,17 @@ static int omap_8250_rs485_config(struct uart_port *port,
struct uart_8250_port *up = up_to_u8250p(port);

/* Clamp the delays to [0, 100ms] */
- rs485->delay_rts_before_send = min(rs485->delay_rts_before_send, 100U);
- rs485->delay_rts_after_send = min(rs485->delay_rts_after_send, 100U);
+ if (rs485->flags & SER_RS485_DELAY_IN_USEC) {
+ rs485->delay_rts_before_send = min(rs485->delay_rts_before_send,
+ 100000U);
+ rs485->delay_rts_after_send = min(rs485->delay_rts_after_send,
+ 100000U);
+ } else {
+ rs485->delay_rts_before_send = min(rs485->delay_rts_before_send,
+ 100U);
+ rs485->delay_rts_after_send = min(rs485->delay_rts_after_send,
+ 100U);
+ }

port->rs485 = *rs485;

diff --git a/drivers/tty/serial/8250/8250_port.c b/drivers/tty/serial/8250/8250_port.c
index d2f3310abe54..0cee4aa8323d 100644
--- a/drivers/tty/serial/8250/8250_port.c
+++ b/drivers/tty/serial/8250/8250_port.c
@@ -1483,6 +1483,15 @@ static void start_hrtimer_ms(struct hrtimer *hrt, unsigned long msec)
hrtimer_start(hrt, t, HRTIMER_MODE_REL);
}

+static void start_hrtimer_us(struct hrtimer *hrt, unsigned long usec)
+{
+ long sec = usec / 1000000;
+ long nsec = (usec % 1000000) * 1000000000;
+ ktime_t t = ktime_set(sec, nsec);
+
+ hrtimer_start(hrt, t, HRTIMER_MODE_REL);
+}
+
static void __stop_tx_rs485(struct uart_8250_port *p)
{
struct uart_8250_em485 *em485 = p->em485;
@@ -1493,8 +1502,12 @@ static void __stop_tx_rs485(struct uart_8250_port *p)
*/
if (p->port.rs485.delay_rts_after_send > 0) {
em485->active_timer = &em485->stop_tx_timer;
- start_hrtimer_ms(&em485->stop_tx_timer,
- p->port.rs485.delay_rts_after_send);
+ if (p->port.rs485.flags & SER_RS485_DELAY_IN_USEC)
+ start_hrtimer_us(&em485->stop_tx_timer,
+ p->port.rs485.delay_rts_after_send);
+ else
+ start_hrtimer_ms(&em485->stop_tx_timer,
+ p->port.rs485.delay_rts_after_send);
} else {
__do_stop_tx_rs485(p);
}
@@ -1600,8 +1613,12 @@ static inline void start_tx_rs485(struct uart_port *port)

if (up->port.rs485.delay_rts_before_send > 0) {
em485->active_timer = &em485->start_tx_timer;
- start_hrtimer_ms(&em485->start_tx_timer,
- up->port.rs485.delay_rts_before_send);
+ if (up->port.rs485.flags & SER_RS485_DELAY_IN_USEC)
+ start_hrtimer_us(&em485->start_tx_timer,
+ up->port.rs485.delay_rts_before_send);
+ else
+ start_hrtimer_ms(&em485->start_tx_timer,
+ up->port.rs485.delay_rts_before_send);
return;
}
}
--
2.20.1


Attachments:
smime.p7s (3.53 kB)

2019-02-21 17:19:34

by Martin Kepplinger

[permalink] [raw]
Subject: [PATCH v2 6/9] serial: sc16is7xx: add support for rs485 RTS delays in microseconds

Read struct serial_rs485's flag SER_RS485_DELAY_IN_USEC and apply the delay
accordingly.

Signed-off-by: Martin Kepplinger <[email protected]>
---
drivers/tty/serial/sc16is7xx.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/tty/serial/sc16is7xx.c b/drivers/tty/serial/sc16is7xx.c
index 635178cf3eed..b0e00b9fb177 100644
--- a/drivers/tty/serial/sc16is7xx.c
+++ b/drivers/tty/serial/sc16is7xx.c
@@ -743,7 +743,13 @@ static void sc16is7xx_tx_proc(struct kthread_work *ws)
struct uart_port *port = &(to_sc16is7xx_one(ws, tx_work)->port);

if ((port->rs485.flags & SER_RS485_ENABLED) &&
- (port->rs485.delay_rts_before_send > 0))
+ (port->rs485.delay_rts_before_send > 0) &&
+ (port->rs485.flags & SER_RS485_DELAY_IN_USEC))
+ usleep_range(port->rs485.delay_rts_before_send,
+ port->rs485.delay_rts_before_send);
+ else if ((port->rs485.flags & SER_RS485_ENABLED) &&
+ (port->rs485.delay_rts_before_send > 0) &&
+ !(port->rs485.flags & SER_RS485_DELAY_IN_USEC))
msleep(port->rs485.delay_rts_before_send);

sc16is7xx_handle_tx(port);
--
2.20.1


Attachments:
smime.p7s (3.53 kB)

2019-02-21 17:19:35

by Martin Kepplinger

[permalink] [raw]
Subject: [PATCH v2 7/9] serial: atmel_serial: set SER_RS485_DELAY_IN_USEC accordingly

Unset the SER_RS485_DELAY_IN_USEC flag during rs485 config for
userspace to get the correct setting.

Signed-off-by: Martin Kepplinger <[email protected]>
---
drivers/tty/serial/atmel_serial.c | 3 +++
1 file changed, 3 insertions(+)

diff --git a/drivers/tty/serial/atmel_serial.c b/drivers/tty/serial/atmel_serial.c
index 05147fe24343..36ab1c131d36 100644
--- a/drivers/tty/serial/atmel_serial.c
+++ b/drivers/tty/serial/atmel_serial.c
@@ -346,6 +346,9 @@ static int atmel_config_rs485(struct uart_port *port,

port->rs485 = *rs485conf;

+ /* delays are in milliseconds */
+ rs485conf->flags &= ~SER_RS485_DELAY_IN_USEC;
+
if (rs485conf->flags & SER_RS485_ENABLED) {
dev_dbg(port->dev, "Setting UART to RS485\n");
atmel_port->tx_done_mask = ATMEL_US_TXEMPTY;
--
2.20.1


Attachments:
smime.p7s (3.53 kB)

2019-02-21 17:19:39

by Martin Kepplinger

[permalink] [raw]
Subject: [PATCH v2 8/9] serial: fsl_lpuart: set SER_RS485_DELAY_IN_USEC accordingly

Clear SER_RS485_DELAY_IN_USEC for userspace to get correct settings.

Signed-off-by: Martin Kepplinger <[email protected]>
---
drivers/tty/serial/fsl_lpuart.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/drivers/tty/serial/fsl_lpuart.c b/drivers/tty/serial/fsl_lpuart.c
index ea1c85e3b432..a63aa22e3a25 100644
--- a/drivers/tty/serial/fsl_lpuart.c
+++ b/drivers/tty/serial/fsl_lpuart.c
@@ -1124,6 +1124,7 @@ static int lpuart_config_rs485(struct uart_port *port,
rs485->delay_rts_before_send = 0;
rs485->delay_rts_after_send = 0;
rs485->flags &= ~SER_RS485_RX_DURING_TX;
+ rs485->flags &= ~SER_RS485_DELAY_IN_USEC;

if (rs485->flags & SER_RS485_ENABLED) {
/* Enable auto RS-485 RTS mode */
--
2.20.1


Attachments:
smime.p7s (3.53 kB)

2019-02-21 17:19:44

by Martin Kepplinger

[permalink] [raw]
Subject: [PATCH v2 9/9] serial: st32-usart: set SER_RS485_DELAY_IN_USEC accordingly

Unset SER_RS485_DELAY_IN_USEC for userspace to get correct settings.

Signed-off-by: Martin Kepplinger <[email protected]>
---
drivers/tty/serial/stm32-usart.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/drivers/tty/serial/stm32-usart.c b/drivers/tty/serial/stm32-usart.c
index e8d7a7bb4339..4daf5fc71644 100644
--- a/drivers/tty/serial/stm32-usart.c
+++ b/drivers/tty/serial/stm32-usart.c
@@ -112,6 +112,7 @@ static int stm32_config_rs485(struct uart_port *port,

port->rs485 = *rs485conf;

+ rs485conf->flags &= ~SER_RS485_DELAY_IN_USEC;
rs485conf->flags |= SER_RS485_RX_DURING_TX;

if (rs485conf->flags & SER_RS485_ENABLED) {
--
2.20.1


Attachments:
smime.p7s (3.53 kB)

2019-02-21 17:20:16

by Martin Kepplinger

[permalink] [raw]
Subject: [PATCH v2 3/9] serial: core: add rs485-rts-delay-us devicetree property for RS485

struct serial_rs485 now optionally holds the rts delay values in
microseconds. Users can set these delays in their devicetree descriptions,
so this adds the microseconds-option with the "rs485-rts-delay-us" boolean
property.

Signed-off-by: Martin Kepplinger <[email protected]>
---
Documentation/devicetree/bindings/serial/rs485.txt | 1 +
drivers/tty/serial/serial_core.c | 11 +++++++++++
2 files changed, 12 insertions(+)

diff --git a/Documentation/devicetree/bindings/serial/rs485.txt b/Documentation/devicetree/bindings/serial/rs485.txt
index b92592dff6dd..77396c62b383 100644
--- a/Documentation/devicetree/bindings/serial/rs485.txt
+++ b/Documentation/devicetree/bindings/serial/rs485.txt
@@ -12,6 +12,7 @@ Optional properties:
* b is the delay between end of data sent and rts signal in milliseconds
it corresponds to the delay after sending data and actual release of the line.
If this property is not specified, <0 0> is assumed.
+- rs485-rts-delay-us: the same as rs485-rts-delay, but in microseconds.
- rs485-rts-active-low: drive RTS low when sending (default is high).
- linux,rs485-enabled-at-boot-time: empty property telling to enable the rs485
feature at boot time. It can be disabled later with proper ioctl.
diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c
index 556f50aa1b58..4fb265b2c0fe 100644
--- a/drivers/tty/serial/serial_core.c
+++ b/drivers/tty/serial/serial_core.c
@@ -3097,6 +3097,17 @@ void uart_get_rs485_mode(struct device *dev, struct serial_rs485 *rs485conf)
rs485conf->delay_rts_after_send = 0;
}

+ ret = device_property_read_u32_array(dev, "rs485-rts-delay-us",
+ rs485_delay, 2);
+ if (!ret) {
+ rs485conf->delay_rts_before_send = rs485_delay[0];
+ rs485conf->delay_rts_after_send = rs485_delay[1];
+ rs485conf->flags |= SER_RS485_DELAY_IN_USEC;
+ } else {
+ rs485conf->delay_rts_before_send = 0;
+ rs485conf->delay_rts_after_send = 0;
+ }
+
/*
* Clear full-duplex and enabled flags, set RTS polarity to active high
* to get to a defined state with the following properties:
--
2.20.1


Attachments:
smime.p7s (3.53 kB)

2019-02-21 17:21:22

by Martin Kepplinger

[permalink] [raw]
Subject: [PATCH v2 5/9] serial: omap-serial: add support for rs485 RTS delays in microseconds

Read struct serial_rs485's flag SER_RS485_DELAY_IN_USEC and apply the delay
accordingly.

Signed-off-by: Martin Kepplinger <[email protected]>
---
drivers/tty/serial/omap-serial.c | 25 +++++++++++++++++++++----
1 file changed, 21 insertions(+), 4 deletions(-)

diff --git a/drivers/tty/serial/omap-serial.c b/drivers/tty/serial/omap-serial.c
index 6420ae581a80..adcd75ce5112 100644
--- a/drivers/tty/serial/omap-serial.c
+++ b/drivers/tty/serial/omap-serial.c
@@ -310,7 +310,11 @@ static void serial_omap_stop_tx(struct uart_port *port)
res = (port->rs485.flags & SER_RS485_RTS_AFTER_SEND) ?
1 : 0;
if (gpio_get_value(up->rts_gpio) != res) {
- if (port->rs485.delay_rts_after_send > 0)
+ if (port->rs485.delay_rts_after_send > 0 &&
+ port->rs485.flags & SER_RS485_DELAY_IN_USEC)
+ udelay(
+ port->rs485.delay_rts_after_send);
+ else if (port->rs485.delay_rts_after_send > 0)
mdelay(
port->rs485.delay_rts_after_send);
gpio_set_value(up->rts_gpio, res);
@@ -420,7 +424,11 @@ static void serial_omap_start_tx(struct uart_port *port)
res = (port->rs485.flags & SER_RS485_RTS_ON_SEND) ? 1 : 0;
if (gpio_get_value(up->rts_gpio) != res) {
gpio_set_value(up->rts_gpio, res);
- if (port->rs485.delay_rts_before_send > 0)
+ if (port->rs485.delay_rts_before_send > 0 &&
+ port->rs485.flags & SER_RS485_DELAY_IN_USEC)
+ udelay(port->rs485.delay_rts_before_send);
+ else if (port->rs485.delay_rts_before_send > 0 &&
+ !(port->rs485.flags & SER_RS485_DELAY_IN_USEC)
mdelay(port->rs485.delay_rts_before_send);
}
}
@@ -1407,8 +1415,17 @@ serial_omap_config_rs485(struct uart_port *port, struct serial_rs485 *rs485)
serial_out(up, UART_IER, 0);

/* Clamp the delays to [0, 100ms] */
- rs485->delay_rts_before_send = min(rs485->delay_rts_before_send, 100U);
- rs485->delay_rts_after_send = min(rs485->delay_rts_after_send, 100U);
+ if (port->rs485.flags & SER_RS485_DELAY_IN_USEC) {
+ rs485->delay_rts_before_send = min(rs485->delay_rts_before_send,
+ 100000U);
+ rs485->delay_rts_after_send = min(rs485->delay_rts_after_send,
+ 100000U);
+ } else {
+ rs485->delay_rts_before_send = min(rs485->delay_rts_before_send,
+ 100);
+ rs485->delay_rts_after_send = min(rs485->delay_rts_after_send,
+ 100U);
+ }

/* store new config */
port->rs485 = *rs485;
--
2.20.1


Attachments:
smime.p7s (3.53 kB)

2019-02-22 23:45:07

by Rob Herring (Arm)

[permalink] [raw]
Subject: Re: [PATCH v2 3/9] serial: core: add rs485-rts-delay-us devicetree property for RS485

On Thu, Feb 21, 2019 at 06:17:52PM +0100, Martin Kepplinger wrote:
> struct serial_rs485 now optionally holds the rts delay values in
> microseconds. Users can set these delays in their devicetree descriptions,
> so this adds the microseconds-option with the "rs485-rts-delay-us" boolean
> property.

If it has a value, it's not boolean.

Should the old prop be deprecated?

>
> Signed-off-by: Martin Kepplinger <[email protected]>
> ---
> Documentation/devicetree/bindings/serial/rs485.txt | 1 +
> drivers/tty/serial/serial_core.c | 11 +++++++++++
> 2 files changed, 12 insertions(+)
>
> diff --git a/Documentation/devicetree/bindings/serial/rs485.txt b/Documentation/devicetree/bindings/serial/rs485.txt
> index b92592dff6dd..77396c62b383 100644
> --- a/Documentation/devicetree/bindings/serial/rs485.txt
> +++ b/Documentation/devicetree/bindings/serial/rs485.txt
> @@ -12,6 +12,7 @@ Optional properties:
> * b is the delay between end of data sent and rts signal in milliseconds
> it corresponds to the delay after sending data and actual release of the line.
> If this property is not specified, <0 0> is assumed.
> +- rs485-rts-delay-us: the same as rs485-rts-delay, but in microseconds.
> - rs485-rts-active-low: drive RTS low when sending (default is high).
> - linux,rs485-enabled-at-boot-time: empty property telling to enable the rs485
> feature at boot time. It can be disabled later with proper ioctl.

2019-03-08 07:37:40

by Martin Kepplinger

[permalink] [raw]
Subject: Re: [PATCH v2 1/9] serial: uapi: add SER_RS485_DELAY_IN_USEC flag to struct serial_rs485

On 21.02.19 18:17, Martin Kepplinger wrote:
> This extends the user interface for rs485 communication:
>
> We add a new flag, SER_RS485_DELAY_IN_USEC, to struct serial_rs485 that
> indicates that delay_rts_before_send and delay_rts_after_send values are
> interpreted in microsecond units.
>
> Up until now, the code comment defined these values to hold the delays in
> millisecond units. Especially with fast data rates (1Mbaut or more) that
> are not too uncommon for RS485, 1ms become quite long. Users need to be
> able to set shorter delays than 1 ms in order not to slow down the channel
> unnecessarily.
>
> So when delays are needed, but not as long as 1ms, this enables faster
> communication channels without changing the baudrate.
>
> Signed-off-by: Martin Kepplinger <[email protected]>
> ---
>
> revision history
> ----------------
> v2: re-send as a proper series after fixing my mailserver
> v1: initial implementation idea
>
>
> So have this totally quirky patch that uses udelay() in our tree
> for a looong time now because of the above reasons - and because we are lazy.
> This is an attempt to get rid of said patch on our side and fix this properly.
>
> What do you thing about adding a flag in general?
>
> The following patches should integrate this idea in devicetree and drivers.
> These changes are NOT tested on hardware but should behave predictably
> enough. I use the delays in a driver that doesn't implement them yet at
> all. I'll do that after this (or something similar) is merged - it's a 2-liner
> then.
>
> Also, a patch to the rs485conf tool, that is sometimes used instead of
> ioctl() directly, will be prepared as well.
>

any objections of questions about having microsecond delays and this
series of changes?

thanks

martin


Attachments:
smime.p7s (3.53 kB)

2019-03-29 14:37:40

by Ahmad Fatoum

[permalink] [raw]
Subject: Re: [PATCH v2 4/9] serial: 8250: add support for rs485 RTS delays in microseconds

On 21/2/19 18:17, Martin Kepplinger wrote:
> Read struct serial_rs485's flag SER_RS485_DELAY_IN_USEC and apply the delay
> accordingly.
>
> Signed-off-by: Martin Kepplinger <[email protected]>
> ---
> drivers/tty/serial/8250/8250_omap.c | 13 +++++++++++--
> drivers/tty/serial/8250/8250_port.c | 25 +++++++++++++++++++++----
> 2 files changed, 32 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/tty/serial/8250/8250_omap.c b/drivers/tty/serial/8250/8250_omap.c
> index 0a8316632d75..cbce43ac60b1 100644
> --- a/drivers/tty/serial/8250/8250_omap.c
> +++ b/drivers/tty/serial/8250/8250_omap.c
> @@ -720,8 +720,17 @@ static int omap_8250_rs485_config(struct uart_port *port,
> struct uart_8250_port *up = up_to_u8250p(port);
>
> /* Clamp the delays to [0, 100ms] */
> - rs485->delay_rts_before_send = min(rs485->delay_rts_before_send, 100U);
> - rs485->delay_rts_after_send = min(rs485->delay_rts_after_send, 100U);
> + if (rs485->flags & SER_RS485_DELAY_IN_USEC) {
> + rs485->delay_rts_before_send = min(rs485->delay_rts_before_send,
> + 100000U);
> + rs485->delay_rts_after_send = min(rs485->delay_rts_after_send,
> + 100000U);
> + } else {
> + rs485->delay_rts_before_send = min(rs485->delay_rts_before_send,
> + 100U);
> + rs485->delay_rts_after_send = min(rs485->delay_rts_after_send,
> + 100U);
> + }
>
> port->rs485 = *rs485;
>
> diff --git a/drivers/tty/serial/8250/8250_port.c b/drivers/tty/serial/8250/8250_port.c
> index d2f3310abe54..0cee4aa8323d 100644
> --- a/drivers/tty/serial/8250/8250_port.c
> +++ b/drivers/tty/serial/8250/8250_port.c
> @@ -1483,6 +1483,15 @@ static void start_hrtimer_ms(struct hrtimer *hrt, unsigned long msec)
> hrtimer_start(hrt, t, HRTIMER_MODE_REL);
> }
>
> +static void start_hrtimer_us(struct hrtimer *hrt, unsigned long usec)
> +{
> + long sec = usec / 1000000;
> + long nsec = (usec % 1000000) * 1000000000;

This 1e9 should be 1000 ("NSEC_PER_USEC").
While at it you might want to use USEC_PER_SEC (and MSEC_PER_SEC
above) to make the code more readable.

Cheers
Ahmad

--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |