[05/10] serial: Convert uart_{,port_}startup() init_hw param to bool
Commit Message
Convert init_hw parameter in uart_startup() and uart_port_startup() to
bool as code treats them like bool.
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
---
drivers/tty/serial/serial_core.c | 12 +++++-------
1 file changed, 5 insertions(+), 7 deletions(-)
Comments
On 04. 01. 23, 16:15, Ilpo Järvinen wrote:
> Convert init_hw parameter in uart_startup() and uart_port_startup() to
> bool as code treats them like bool.
>
> Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
> ---
> drivers/tty/serial/serial_core.c | 12 +++++-------
> 1 file changed, 5 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c
> index c881fefa3d97..a0260a40bdb9 100644
> --- a/drivers/tty/serial/serial_core.c
> +++ b/drivers/tty/serial/serial_core.c
> @@ -181,8 +181,7 @@ static void uart_port_dtr_rts(struct uart_port *uport, int raise)
> * Startup the port. This will be called once per open. All calls
> * will be serialised by the per-port mutex.
> */
> -static int uart_port_startup(struct tty_struct *tty, struct uart_state *state,
> - int init_hw)
> +static int uart_port_startup(struct tty_struct *tty, struct uart_state *state, bool init_hw)
> {
> struct uart_port *uport = uart_port_check(state);
> unsigned long flags;
> @@ -253,8 +252,7 @@ static int uart_port_startup(struct tty_struct *tty, struct uart_state *state,
> return retval;
> }
>
> -static int uart_startup(struct tty_struct *tty, struct uart_state *state,
> - int init_hw)
> +static int uart_startup(struct tty_struct *tty, struct uart_state *state, bool init_hw)
You made both of them over 80 characters/line. Why?
thanks,
On Thu, 5 Jan 2023, Jiri Slaby wrote:
> On 04. 01. 23, 16:15, Ilpo Järvinen wrote:
> > Convert init_hw parameter in uart_startup() and uart_port_startup() to
> > bool as code treats them like bool.
> >
> > Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
> > ---
> > drivers/tty/serial/serial_core.c | 12 +++++-------
> > 1 file changed, 5 insertions(+), 7 deletions(-)
> >
> > diff --git a/drivers/tty/serial/serial_core.c
> > b/drivers/tty/serial/serial_core.c
> > index c881fefa3d97..a0260a40bdb9 100644
> > --- a/drivers/tty/serial/serial_core.c
> > +++ b/drivers/tty/serial/serial_core.c
> > @@ -181,8 +181,7 @@ static void uart_port_dtr_rts(struct uart_port *uport,
> > int raise)
> > * Startup the port. This will be called once per open. All calls
> > * will be serialised by the per-port mutex.
> > */
> > -static int uart_port_startup(struct tty_struct *tty, struct uart_state
> > *state,
> > - int init_hw)
> > +static int uart_port_startup(struct tty_struct *tty, struct uart_state
> > *state, bool init_hw)
> > {
> > struct uart_port *uport = uart_port_check(state);
> > unsigned long flags;
> > @@ -253,8 +252,7 @@ static int uart_port_startup(struct tty_struct *tty,
> > struct uart_state *state,
> > return retval;
> > }
> > -static int uart_startup(struct tty_struct *tty, struct uart_state *state,
> > - int init_hw)
> > +static int uart_startup(struct tty_struct *tty, struct uart_state *state,
> > bool init_hw)
>
> You made both of them over 80 characters/line. Why?
I've started to use 100 chars/line especially for things which are
naturally long such as these. But I can change that back.
On Thu, Jan 05, 2023 at 07:05:17AM +0100, Jiri Slaby wrote:
> On 04. 01. 23, 16:15, Ilpo Järvinen wrote:
> > Convert init_hw parameter in uart_startup() and uart_port_startup() to
> > bool as code treats them like bool.
> >
> > Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
> > ---
> > drivers/tty/serial/serial_core.c | 12 +++++-------
> > 1 file changed, 5 insertions(+), 7 deletions(-)
> >
> > diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c
> > index c881fefa3d97..a0260a40bdb9 100644
> > --- a/drivers/tty/serial/serial_core.c
> > +++ b/drivers/tty/serial/serial_core.c
> > @@ -181,8 +181,7 @@ static void uart_port_dtr_rts(struct uart_port *uport, int raise)
> > * Startup the port. This will be called once per open. All calls
> > * will be serialised by the per-port mutex.
> > */
> > -static int uart_port_startup(struct tty_struct *tty, struct uart_state *state,
> > - int init_hw)
> > +static int uart_port_startup(struct tty_struct *tty, struct uart_state *state, bool init_hw)
> > {
> > struct uart_port *uport = uart_port_check(state);
> > unsigned long flags;
> > @@ -253,8 +252,7 @@ static int uart_port_startup(struct tty_struct *tty, struct uart_state *state,
> > return retval;
> > }
> >
> > -static int uart_startup(struct tty_struct *tty, struct uart_state *state,
> > - int init_hw)
> > +static int uart_startup(struct tty_struct *tty, struct uart_state *state, bool init_hw)
>
> You made both of them over 80 characters/line. Why?
I also still consider 80 chars to be a soft limit to strive for, but for
function signatures breaking that may even be preferred as it allows for
easier grepping. I believe Linus has expressed this explicitly in the
past too.
Johan
@@ -181,8 +181,7 @@ static void uart_port_dtr_rts(struct uart_port *uport, int raise)
* Startup the port. This will be called once per open. All calls
* will be serialised by the per-port mutex.
*/
-static int uart_port_startup(struct tty_struct *tty, struct uart_state *state,
- int init_hw)
+static int uart_port_startup(struct tty_struct *tty, struct uart_state *state, bool init_hw)
{
struct uart_port *uport = uart_port_check(state);
unsigned long flags;
@@ -253,8 +252,7 @@ static int uart_port_startup(struct tty_struct *tty, struct uart_state *state,
return retval;
}
-static int uart_startup(struct tty_struct *tty, struct uart_state *state,
- int init_hw)
+static int uart_startup(struct tty_struct *tty, struct uart_state *state, bool init_hw)
{
struct tty_port *port = &state->port;
int retval;
@@ -997,7 +995,7 @@ static int uart_set_info(struct tty_struct *tty, struct tty_port *port,
uart_change_speed(tty, state, NULL);
}
} else {
- retval = uart_startup(tty, state, 1);
+ retval = uart_startup(tty, state, true);
if (retval == 0)
tty_port_set_initialized(port, true);
if (retval > 0)
@@ -1165,7 +1163,7 @@ static int uart_do_autoconfig(struct tty_struct *tty, struct uart_state *state)
*/
uport->ops->config_port(uport, flags);
- ret = uart_startup(tty, state, 1);
+ ret = uart_startup(tty, state, true);
if (ret == 0)
tty_port_set_initialized(port, true);
if (ret > 0)
@@ -1943,7 +1941,7 @@ static int uart_port_activate(struct tty_port *port, struct tty_struct *tty)
/*
* Start up the serial port.
*/
- ret = uart_startup(tty, state, 0);
+ ret = uart_startup(tty, state, false);
if (ret > 0)
tty_port_set_active(port, true);