Re: [PATCH v3 11/13] tty/serial: Call ->dtr_rts() parameter active consistently

2023-01-13 Thread Ulf Hansson
On Wed, 11 Jan 2023 at 15:24, Ilpo Järvinen
 wrote:
>
> Convert various parameter names for ->dtr_rts() and related functions
> from onoff, on, and raise to active.
>
> Reviewed-by: Jiri Slaby 
> Signed-off-by: Ilpo Järvinen 

Acked-by: Ulf Hansson  # For MMC

Kind regards
Uffe

> ---
>  drivers/char/pcmcia/synclink_cs.c | 6 +++---
>  drivers/mmc/core/sdio_uart.c  | 6 +++---
>  drivers/staging/greybus/uart.c| 4 ++--
>  drivers/tty/amiserial.c   | 4 ++--
>  drivers/tty/hvc/hvc_console.h | 2 +-
>  drivers/tty/hvc/hvc_iucv.c| 6 +++---
>  drivers/tty/mxser.c   | 4 ++--
>  drivers/tty/n_gsm.c   | 4 ++--
>  drivers/tty/serial/serial_core.c  | 8 
>  drivers/tty/synclink_gt.c | 4 ++--
>  include/linux/tty_port.h  | 4 ++--
>  include/linux/usb/serial.h| 2 +-
>  12 files changed, 27 insertions(+), 27 deletions(-)
>
> diff --git a/drivers/char/pcmcia/synclink_cs.c 
> b/drivers/char/pcmcia/synclink_cs.c
> index 46a0b586d234..1577eba6fe0e 100644
> --- a/drivers/char/pcmcia/synclink_cs.c
> +++ b/drivers/char/pcmcia/synclink_cs.c
> @@ -378,7 +378,7 @@ static void async_mode(MGSLPC_INFO *info);
>  static void tx_timeout(struct timer_list *t);
>
>  static bool carrier_raised(struct tty_port *port);
> -static void dtr_rts(struct tty_port *port, bool onoff);
> +static void dtr_rts(struct tty_port *port, bool active);
>
>  #if SYNCLINK_GENERIC_HDLC
>  #define dev_to_port(D) (dev_to_hdlc(D)->priv)
> @@ -2442,13 +2442,13 @@ static bool carrier_raised(struct tty_port *port)
> return info->serial_signals & SerialSignal_DCD;
>  }
>
> -static void dtr_rts(struct tty_port *port, bool onoff)
> +static void dtr_rts(struct tty_port *port, bool active)
>  {
> MGSLPC_INFO *info = container_of(port, MGSLPC_INFO, port);
> unsigned long flags;
>
> spin_lock_irqsave(&info->lock, flags);
> -   if (onoff)
> +   if (active)
> info->serial_signals |= SerialSignal_RTS | SerialSignal_DTR;
> else
> info->serial_signals &= ~(SerialSignal_RTS | 
> SerialSignal_DTR);
> diff --git a/drivers/mmc/core/sdio_uart.c b/drivers/mmc/core/sdio_uart.c
> index c6b4b2b2a4b2..50536fe59f1a 100644
> --- a/drivers/mmc/core/sdio_uart.c
> +++ b/drivers/mmc/core/sdio_uart.c
> @@ -542,20 +542,20 @@ static bool uart_carrier_raised(struct tty_port *tport)
>  /**
>   * uart_dtr_rts-port helper to set uart signals
>   * @tport: tty port to be updated
> - * @onoff: set to turn on DTR/RTS
> + * @active: set to turn on DTR/RTS
>   *
>   * Called by the tty port helpers when the modem signals need to be
>   * adjusted during an open, close and hangup.
>   */
>
> -static void uart_dtr_rts(struct tty_port *tport, bool onoff)
> +static void uart_dtr_rts(struct tty_port *tport, bool active)
>  {
> struct sdio_uart_port *port =
> container_of(tport, struct sdio_uart_port, port);
> int ret = sdio_uart_claim_func(port);
> if (ret)
> return;
> -   if (!onoff)
> +   if (!active)
> sdio_uart_clear_mctrl(port, TIOCM_DTR | TIOCM_RTS);
> else
> sdio_uart_set_mctrl(port, TIOCM_DTR | TIOCM_RTS);
> diff --git a/drivers/staging/greybus/uart.c b/drivers/staging/greybus/uart.c
> index 92d49740d5a4..20a34599859f 100644
> --- a/drivers/staging/greybus/uart.c
> +++ b/drivers/staging/greybus/uart.c
> @@ -701,7 +701,7 @@ static int gb_tty_ioctl(struct tty_struct *tty, unsigned 
> int cmd,
> return -ENOIOCTLCMD;
>  }
>
> -static void gb_tty_dtr_rts(struct tty_port *port, bool on)
> +static void gb_tty_dtr_rts(struct tty_port *port, bool active)
>  {
> struct gb_tty *gb_tty;
> u8 newctrl;
> @@ -709,7 +709,7 @@ static void gb_tty_dtr_rts(struct tty_port *port, bool on)
> gb_tty = container_of(port, struct gb_tty, port);
> newctrl = gb_tty->ctrlout;
>
> -   if (on)
> +   if (active)
> newctrl |= (GB_UART_CTRL_DTR | GB_UART_CTRL_RTS);
> else
> newctrl &= ~(GB_UART_CTRL_DTR | GB_UART_CTRL_RTS);
> diff --git a/drivers/tty/amiserial.c b/drivers/tty/amiserial.c
> index 29d4c554f6b8..d7515d61659e 100644
> --- a/drivers/tty/amiserial.c
> +++ b/drivers/tty/amiserial.c
> @@ -1459,13 +1459,13 @@ static bool amiga_carrier_raised(struct tty_port 
> *port)
> return !(ciab.pra & SER_DCD);
>  }
>
> -static void amiga_dtr_rts(struct tty_port *port, bool raise)
> +static void amiga_dtr_rts(struct tty_port *port, bool active)
>  {
> struct serial_state *info = container_of(port, struct serial_state,
> tport);
> unsigned long flags;
>
> -   if (raise)
> +   if (active)
> info->MCR |= SER_DTR|SER_RTS;
> else
> info->MCR &= ~(SER_DTR|SER_RTS);
> diff --git a/drivers/tty/hvc/hvc_console.h b/drivers/tty/hvc/hvc_console.h
> index 6d3428

Re: [PATCH v3 11/13] tty/serial: Call ->dtr_rts() parameter active consistently

2023-01-11 Thread Johan Hovold
On Wed, Jan 11, 2023 at 04:23:29PM +0200, Ilpo Järvinen wrote:
> Convert various parameter names for ->dtr_rts() and related functions
> from onoff, on, and raise to active.
> 
> Reviewed-by: Jiri Slaby 
> Signed-off-by: Ilpo Järvinen 
> ---
>  drivers/char/pcmcia/synclink_cs.c | 6 +++---
>  drivers/mmc/core/sdio_uart.c  | 6 +++---
>  drivers/staging/greybus/uart.c| 4 ++--
>  drivers/tty/amiserial.c   | 4 ++--
>  drivers/tty/hvc/hvc_console.h | 2 +-
>  drivers/tty/hvc/hvc_iucv.c| 6 +++---
>  drivers/tty/mxser.c   | 4 ++--
>  drivers/tty/n_gsm.c   | 4 ++--
>  drivers/tty/serial/serial_core.c  | 8 
>  drivers/tty/synclink_gt.c | 4 ++--
>  include/linux/tty_port.h  | 4 ++--
>  include/linux/usb/serial.h| 2 +-
>  12 files changed, 27 insertions(+), 27 deletions(-)

> diff --git a/include/linux/tty_port.h b/include/linux/tty_port.h
> index c44e489de0ff..edf685a24f7c 100644
> --- a/include/linux/tty_port.h
> +++ b/include/linux/tty_port.h
> @@ -16,7 +16,7 @@ struct tty_struct;
>  /**
>   * struct tty_port_operations -- operations on tty_port
>   * @carrier_raised: return true if the carrier is raised on @port
> - * @dtr_rts: raise the DTR line if @raise is true, otherwise lower DTR
> + * @dtr_rts: raise the DTR line if @active is true, otherwise lower DTR
>   * @shutdown: called when the last close completes or a hangup finishes IFF 
> the
>   *   port was initialized. Do not use to free resources. Turn off the device
>   *   only. Called under the port mutex to serialize against @activate and
> @@ -32,7 +32,7 @@ struct tty_struct;
>   */
>  struct tty_port_operations {
>   bool (*carrier_raised)(struct tty_port *port);
> - void (*dtr_rts)(struct tty_port *port, bool raise);
> + void (*dtr_rts)(struct tty_port *port, bool active);
>   void (*shutdown)(struct tty_port *port);
>   int (*activate)(struct tty_port *port, struct tty_struct *tty);
>   void (*destruct)(struct tty_port *port);
> diff --git a/include/linux/usb/serial.h b/include/linux/usb/serial.h
> index bad343c5e8a7..33afd9f3ebbe 100644
> --- a/include/linux/usb/serial.h
> +++ b/include/linux/usb/serial.h
> @@ -292,7 +292,7 @@ struct usb_serial_driver {
>   struct serial_icounter_struct *icount);
>   /* Called by the tty layer for port level work. There may or may not
>  be an attached tty at this point */
> - void (*dtr_rts)(struct usb_serial_port *port, bool on);
> + void (*dtr_rts)(struct usb_serial_port *port, bool active);

This is not a tty_port callback so this change does not belong in this
patch.

>   bool (*carrier_raised)(struct usb_serial_port *port);
>   /* Called by the usb serial hooks to allow the user to rework the
>  termios state */

Johan


[PATCH v3 11/13] tty/serial: Call ->dtr_rts() parameter active consistently

2023-01-11 Thread Ilpo Järvinen
Convert various parameter names for ->dtr_rts() and related functions
from onoff, on, and raise to active.

Reviewed-by: Jiri Slaby 
Signed-off-by: Ilpo Järvinen 
---
 drivers/char/pcmcia/synclink_cs.c | 6 +++---
 drivers/mmc/core/sdio_uart.c  | 6 +++---
 drivers/staging/greybus/uart.c| 4 ++--
 drivers/tty/amiserial.c   | 4 ++--
 drivers/tty/hvc/hvc_console.h | 2 +-
 drivers/tty/hvc/hvc_iucv.c| 6 +++---
 drivers/tty/mxser.c   | 4 ++--
 drivers/tty/n_gsm.c   | 4 ++--
 drivers/tty/serial/serial_core.c  | 8 
 drivers/tty/synclink_gt.c | 4 ++--
 include/linux/tty_port.h  | 4 ++--
 include/linux/usb/serial.h| 2 +-
 12 files changed, 27 insertions(+), 27 deletions(-)

diff --git a/drivers/char/pcmcia/synclink_cs.c 
b/drivers/char/pcmcia/synclink_cs.c
index 46a0b586d234..1577eba6fe0e 100644
--- a/drivers/char/pcmcia/synclink_cs.c
+++ b/drivers/char/pcmcia/synclink_cs.c
@@ -378,7 +378,7 @@ static void async_mode(MGSLPC_INFO *info);
 static void tx_timeout(struct timer_list *t);
 
 static bool carrier_raised(struct tty_port *port);
-static void dtr_rts(struct tty_port *port, bool onoff);
+static void dtr_rts(struct tty_port *port, bool active);
 
 #if SYNCLINK_GENERIC_HDLC
 #define dev_to_port(D) (dev_to_hdlc(D)->priv)
@@ -2442,13 +2442,13 @@ static bool carrier_raised(struct tty_port *port)
return info->serial_signals & SerialSignal_DCD;
 }
 
-static void dtr_rts(struct tty_port *port, bool onoff)
+static void dtr_rts(struct tty_port *port, bool active)
 {
MGSLPC_INFO *info = container_of(port, MGSLPC_INFO, port);
unsigned long flags;
 
spin_lock_irqsave(&info->lock, flags);
-   if (onoff)
+   if (active)
info->serial_signals |= SerialSignal_RTS | SerialSignal_DTR;
else
info->serial_signals &= ~(SerialSignal_RTS | SerialSignal_DTR);
diff --git a/drivers/mmc/core/sdio_uart.c b/drivers/mmc/core/sdio_uart.c
index c6b4b2b2a4b2..50536fe59f1a 100644
--- a/drivers/mmc/core/sdio_uart.c
+++ b/drivers/mmc/core/sdio_uart.c
@@ -542,20 +542,20 @@ static bool uart_carrier_raised(struct tty_port *tport)
 /**
  * uart_dtr_rts-port helper to set uart signals
  * @tport: tty port to be updated
- * @onoff: set to turn on DTR/RTS
+ * @active: set to turn on DTR/RTS
  *
  * Called by the tty port helpers when the modem signals need to be
  * adjusted during an open, close and hangup.
  */
 
-static void uart_dtr_rts(struct tty_port *tport, bool onoff)
+static void uart_dtr_rts(struct tty_port *tport, bool active)
 {
struct sdio_uart_port *port =
container_of(tport, struct sdio_uart_port, port);
int ret = sdio_uart_claim_func(port);
if (ret)
return;
-   if (!onoff)
+   if (!active)
sdio_uart_clear_mctrl(port, TIOCM_DTR | TIOCM_RTS);
else
sdio_uart_set_mctrl(port, TIOCM_DTR | TIOCM_RTS);
diff --git a/drivers/staging/greybus/uart.c b/drivers/staging/greybus/uart.c
index 92d49740d5a4..20a34599859f 100644
--- a/drivers/staging/greybus/uart.c
+++ b/drivers/staging/greybus/uart.c
@@ -701,7 +701,7 @@ static int gb_tty_ioctl(struct tty_struct *tty, unsigned 
int cmd,
return -ENOIOCTLCMD;
 }
 
-static void gb_tty_dtr_rts(struct tty_port *port, bool on)
+static void gb_tty_dtr_rts(struct tty_port *port, bool active)
 {
struct gb_tty *gb_tty;
u8 newctrl;
@@ -709,7 +709,7 @@ static void gb_tty_dtr_rts(struct tty_port *port, bool on)
gb_tty = container_of(port, struct gb_tty, port);
newctrl = gb_tty->ctrlout;
 
-   if (on)
+   if (active)
newctrl |= (GB_UART_CTRL_DTR | GB_UART_CTRL_RTS);
else
newctrl &= ~(GB_UART_CTRL_DTR | GB_UART_CTRL_RTS);
diff --git a/drivers/tty/amiserial.c b/drivers/tty/amiserial.c
index 29d4c554f6b8..d7515d61659e 100644
--- a/drivers/tty/amiserial.c
+++ b/drivers/tty/amiserial.c
@@ -1459,13 +1459,13 @@ static bool amiga_carrier_raised(struct tty_port *port)
return !(ciab.pra & SER_DCD);
 }
 
-static void amiga_dtr_rts(struct tty_port *port, bool raise)
+static void amiga_dtr_rts(struct tty_port *port, bool active)
 {
struct serial_state *info = container_of(port, struct serial_state,
tport);
unsigned long flags;
 
-   if (raise)
+   if (active)
info->MCR |= SER_DTR|SER_RTS;
else
info->MCR &= ~(SER_DTR|SER_RTS);
diff --git a/drivers/tty/hvc/hvc_console.h b/drivers/tty/hvc/hvc_console.h
index 6d3428bf868f..9668f821db01 100644
--- a/drivers/tty/hvc/hvc_console.h
+++ b/drivers/tty/hvc/hvc_console.h
@@ -66,7 +66,7 @@ struct hv_ops {
int (*tiocmset)(struct hvc_struct *hp, unsigned int set, unsigned int 
clear);
 
/* Callbacks to handle tty ports */
-   void (*dtr_rts)(struct hvc_struct *hp, bool raise);
+   void