* [PATCH v3 3/3] serial: core: Update uart_poll_timeout() function to return unsigned long
@ 2023-10-26 13:56 Vamshi Gajjela
2023-10-27 6:43 ` Greg Kroah-Hartman
0 siblings, 1 reply; 4+ messages in thread
From: Vamshi Gajjela @ 2023-10-26 13:56 UTC (permalink / raw)
To: Greg Kroah-Hartman, Jiri Slaby, ilpo.jarvinen
Cc: linux-serial, linux-kernel, manugautam, Subhash Jadavani,
Channa Kadabi, VAMSHI GAJJELA
From: VAMSHI GAJJELA <vamshigajjela@google.com>
The function uart_fifo_timeout() returns an unsigned long value, which
is the number of jiffies. Therefore, change the variable timeout in the
function uart_poll_timeout() from int to unsigned long.
Change the return type of the function uart_poll_timeout() from int to
unsigned long to be consistent with the type of timeout values.
Signed-off-by: VAMSHI GAJJELA <vamshigajjela@google.com>
---
v3:
- updated description
v2:
- unsigned long instead of unsigned int
- added () after function name in short log
- updated description
include/linux/serial_core.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h
index bb6f073bc159..6916a1d7e477 100644
--- a/include/linux/serial_core.h
+++ b/include/linux/serial_core.h
@@ -773,9 +773,9 @@ static inline unsigned long uart_fifo_timeout(struct uart_port *port)
}
/* Base timer interval for polling */
-static inline int uart_poll_timeout(struct uart_port *port)
+static inline unsigned long uart_poll_timeout(struct uart_port *port)
{
- int timeout = uart_fifo_timeout(port);
+ unsigned long timeout = uart_fifo_timeout(port);
return timeout > 6 ? (timeout / 2 - 2) : 1;
}
--
2.42.0.758.gaed0368e0e-goog
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH v3 3/3] serial: core: Update uart_poll_timeout() function to return unsigned long
2023-10-26 13:56 [PATCH v3 3/3] serial: core: Update uart_poll_timeout() function to return unsigned long Vamshi Gajjela
@ 2023-10-27 6:43 ` Greg Kroah-Hartman
2023-10-27 8:19 ` Ilpo Järvinen
0 siblings, 1 reply; 4+ messages in thread
From: Greg Kroah-Hartman @ 2023-10-27 6:43 UTC (permalink / raw)
To: Vamshi Gajjela
Cc: Jiri Slaby, ilpo.jarvinen, linux-serial, linux-kernel, manugautam,
Subhash Jadavani, Channa Kadabi
On Thu, Oct 26, 2023 at 07:26:28PM +0530, Vamshi Gajjela wrote:
> From: VAMSHI GAJJELA <vamshigajjela@google.com>
Please use lower case letters like I think you mean to?
Also, where are patches 1/3 and 2/3 of this series? I can't do anything
without them as well.
> The function uart_fifo_timeout() returns an unsigned long value, which
> is the number of jiffies. Therefore, change the variable timeout in the
> function uart_poll_timeout() from int to unsigned long.
> Change the return type of the function uart_poll_timeout() from int to
> unsigned long to be consistent with the type of timeout values.
>
> Signed-off-by: VAMSHI GAJJELA <vamshigajjela@google.com>
> ---
> v3:
> - updated description
> v2:
> - unsigned long instead of unsigned int
> - added () after function name in short log
> - updated description
>
> include/linux/serial_core.h | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h
> index bb6f073bc159..6916a1d7e477 100644
> --- a/include/linux/serial_core.h
> +++ b/include/linux/serial_core.h
> @@ -773,9 +773,9 @@ static inline unsigned long uart_fifo_timeout(struct uart_port *port)
> }
>
> /* Base timer interval for polling */
> -static inline int uart_poll_timeout(struct uart_port *port)
> +static inline unsigned long uart_poll_timeout(struct uart_port *port)
> {
> - int timeout = uart_fifo_timeout(port);
> + unsigned long timeout = uart_fifo_timeout(port);
>
> return timeout > 6 ? (timeout / 2 - 2) : 1;
So we are now doing 64bit math? Did that just make things slower?
What bug is this actually fixing? How have you tested this to verify it
works?
thanks,
greg k-h
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v3 3/3] serial: core: Update uart_poll_timeout() function to return unsigned long
2023-10-27 6:43 ` Greg Kroah-Hartman
@ 2023-10-27 8:19 ` Ilpo Järvinen
2023-10-27 11:01 ` Greg Kroah-Hartman
0 siblings, 1 reply; 4+ messages in thread
From: Ilpo Järvinen @ 2023-10-27 8:19 UTC (permalink / raw)
To: Greg Kroah-Hartman
Cc: Vamshi Gajjela, Jiri Slaby, linux-serial, LKML, manugautam,
Subhash Jadavani, Channa Kadabi
On Fri, 27 Oct 2023, Greg Kroah-Hartman wrote:
> On Thu, Oct 26, 2023 at 07:26:28PM +0530, Vamshi Gajjela wrote:
> > From: VAMSHI GAJJELA <vamshigajjela@google.com>
>
> Please use lower case letters like I think you mean to?
>
> Also, where are patches 1/3 and 2/3 of this series? I can't do anything
> without them as well.
>
> > The function uart_fifo_timeout() returns an unsigned long value, which
> > is the number of jiffies. Therefore, change the variable timeout in the
> > function uart_poll_timeout() from int to unsigned long.
> > Change the return type of the function uart_poll_timeout() from int to
> > unsigned long to be consistent with the type of timeout values.
> >
> > Signed-off-by: VAMSHI GAJJELA <vamshigajjela@google.com>
> > ---
> > v3:
> > - updated description
> > v2:
> > - unsigned long instead of unsigned int
> > - added () after function name in short log
> > - updated description
> >
> > include/linux/serial_core.h | 4 ++--
> > 1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h
> > index bb6f073bc159..6916a1d7e477 100644
> > --- a/include/linux/serial_core.h
> > +++ b/include/linux/serial_core.h
> > @@ -773,9 +773,9 @@ static inline unsigned long uart_fifo_timeout(struct uart_port *port)
> > }
> >
> > /* Base timer interval for polling */
> > -static inline int uart_poll_timeout(struct uart_port *port)
> > +static inline unsigned long uart_poll_timeout(struct uart_port *port)
> > {
> > - int timeout = uart_fifo_timeout(port);
> > + unsigned long timeout = uart_fifo_timeout(port);
> >
> > return timeout > 6 ? (timeout / 2 - 2) : 1;
>
> So we are now doing 64bit math? Did that just make things slower?
That divide with a constant 2 though so I'd expect compiler to turn it
into a shift.
> What bug is this actually fixing? How have you tested this to verify it
> works?
AFAIK this doesn't fix anything because emptying when measured in jiffies
isn't that big number. It's just about making the types more consistent.
--
i.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v3 3/3] serial: core: Update uart_poll_timeout() function to return unsigned long
2023-10-27 8:19 ` Ilpo Järvinen
@ 2023-10-27 11:01 ` Greg Kroah-Hartman
0 siblings, 0 replies; 4+ messages in thread
From: Greg Kroah-Hartman @ 2023-10-27 11:01 UTC (permalink / raw)
To: Ilpo Järvinen
Cc: Vamshi Gajjela, Jiri Slaby, linux-serial, LKML, manugautam,
Subhash Jadavani, Channa Kadabi
On Fri, Oct 27, 2023 at 11:19:26AM +0300, Ilpo Järvinen wrote:
> On Fri, 27 Oct 2023, Greg Kroah-Hartman wrote:
>
> > On Thu, Oct 26, 2023 at 07:26:28PM +0530, Vamshi Gajjela wrote:
> > > From: VAMSHI GAJJELA <vamshigajjela@google.com>
> >
> > Please use lower case letters like I think you mean to?
> >
> > Also, where are patches 1/3 and 2/3 of this series? I can't do anything
> > without them as well.
> >
> > > The function uart_fifo_timeout() returns an unsigned long value, which
> > > is the number of jiffies. Therefore, change the variable timeout in the
> > > function uart_poll_timeout() from int to unsigned long.
> > > Change the return type of the function uart_poll_timeout() from int to
> > > unsigned long to be consistent with the type of timeout values.
> > >
> > > Signed-off-by: VAMSHI GAJJELA <vamshigajjela@google.com>
> > > ---
> > > v3:
> > > - updated description
> > > v2:
> > > - unsigned long instead of unsigned int
> > > - added () after function name in short log
> > > - updated description
> > >
> > > include/linux/serial_core.h | 4 ++--
> > > 1 file changed, 2 insertions(+), 2 deletions(-)
> > >
> > > diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h
> > > index bb6f073bc159..6916a1d7e477 100644
> > > --- a/include/linux/serial_core.h
> > > +++ b/include/linux/serial_core.h
> > > @@ -773,9 +773,9 @@ static inline unsigned long uart_fifo_timeout(struct uart_port *port)
> > > }
> > >
> > > /* Base timer interval for polling */
> > > -static inline int uart_poll_timeout(struct uart_port *port)
> > > +static inline unsigned long uart_poll_timeout(struct uart_port *port)
> > > {
> > > - int timeout = uart_fifo_timeout(port);
> > > + unsigned long timeout = uart_fifo_timeout(port);
> > >
> > > return timeout > 6 ? (timeout / 2 - 2) : 1;
> >
> > So we are now doing 64bit math? Did that just make things slower?
>
> That divide with a constant 2 though so I'd expect compiler to turn it
> into a shift.
Hopefully :)
> > What bug is this actually fixing? How have you tested this to verify it
> > works?
>
> AFAIK this doesn't fix anything because emptying when measured in jiffies
> isn't that big number. It's just about making the types more consistent.
Ah, ok, I'll wait for a proper version to be sent as I obviously can't
take it like-this.
thanks,
greg k-h
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-10-27 11:01 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-26 13:56 [PATCH v3 3/3] serial: core: Update uart_poll_timeout() function to return unsigned long Vamshi Gajjela
2023-10-27 6:43 ` Greg Kroah-Hartman
2023-10-27 8:19 ` Ilpo Järvinen
2023-10-27 11:01 ` Greg Kroah-Hartman
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).