tty/serial: bool conversions and cleanups
Subsystems (20)
v2 cover tty/serial: bool conversions and cleanups
There are number of functions in tty/serial which have arguments or return types that expect/behave like bool. Likely due to them existing before bool was available, other types are used. Make conversions to bool and cleanups.
v2:
- Call dtr/rts parameters/variables consistently "active"
- Don't chain one return statement with ||
- Don't change function signatures to >80 chars ("while at it")
- moxa: differentiated dtr and status variables
Ilpo Järvinen (13):
tty: Cleanup tty_port_set_initialized() bool parameter
tty: Cleamup tty_port_set_suspended() bool parameter
tty: Cleanup tty_port_set_active() bool parameter
tty: moxa: Make local var storing tty_port_initialized() bool
serial: Convert uart_{,port_}startup() init_hw param to bool
tty: Convert ->carrier_raised() and callchains to bool
tty: Convert ->dtr_rts() to take bool argument tty/serial: Make ->dcd_change()+uart_handle_dcd_change() status bool
active
serial: Make uart_handle_cts_change() status param bool active
tty: Return bool from tty_termios_hw_change()
tty/serial: Call ->dtr_rts() parameter active consistently
tty: moxa: Rename dtr/rts parameters/variables to active usb/serial: Rename dtr/rts parameters/variables to active
drivers/char/pcmcia/synclink_cs.c | 18 +++---- drivers/ipack/devices/ipoctal.c | 4 +- drivers/mmc/core/sdio_uart.c | 13 +++-- drivers/pps/clients/pps-ldisc.c | 6 +-- drivers/s390/char/con3215.c | 4 +- drivers/staging/greybus/uart.c | 4 +- drivers/tty/amiserial.c | 12 ++--- drivers/tty/hvc/hvc_console.c | 4 +- drivers/tty/hvc/hvc_console.h | 2 +- drivers/tty/hvc/hvc_iucv.c | 6 +-- drivers/tty/moxa.c | 80 ++++++++++++++-------------- drivers/tty/mxser.c | 11 ++-- drivers/tty/n_gsm.c | 16 +++--- drivers/tty/serial/imx.c | 2 +- drivers/tty/serial/max3100.c | 2 +- drivers/tty/serial/max310x.c | 3 +- drivers/tty/serial/serial_core.c | 65 +++++++++++----------- drivers/tty/serial/sunhv.c | 8 +-- drivers/tty/synclink_gt.c | 21 ++++---- drivers/tty/tty_ioctl.c | 8 +-- drivers/tty/tty_port.c | 22 ++++---- drivers/usb/class/cdc-acm.c | 4 +- drivers/usb/serial/ch341.c | 11 ++-- drivers/usb/serial/console.c | 2 +- drivers/usb/serial/cp210x.c | 6 +-- drivers/usb/serial/cypress_m8.c | 6 +-- drivers/usb/serial/digi_acceleport.c | 6 +-- drivers/usb/serial/f81232.c | 10 ++-- drivers/usb/serial/f81534.c | 4 +- drivers/usb/serial/ftdi_sio.c | 6 +-- drivers/usb/serial/generic.c | 10 ++-- drivers/usb/serial/ipw.c | 8 +-- drivers/usb/serial/keyspan.c | 6 +-- drivers/usb/serial/keyspan_pda.c | 4 +- drivers/usb/serial/mct_u232.c | 6 +-- drivers/usb/serial/mxuport.c | 4 +- drivers/usb/serial/pl2303.c | 11 ++-- drivers/usb/serial/quatech2.c | 6 +-- drivers/usb/serial/sierra.c | 6 +-- drivers/usb/serial/spcp8x5.c | 11 ++-- drivers/usb/serial/ssu100.c | 6 +-- drivers/usb/serial/upd78f0730.c | 8 +-- drivers/usb/serial/usb-serial.c | 8 +-- drivers/usb/serial/usb-wwan.h | 2 +- drivers/usb/serial/usb_wwan.c | 6 +-- drivers/usb/serial/xr_serial.c | 8 +-- include/linux/serial_core.h | 6 +-- include/linux/tty.h | 2 +- include/linux/tty_ldisc.h | 4 +- include/linux/tty_port.h | 10 ++-- include/linux/usb/serial.h | 6 +-- net/bluetooth/rfcomm/tty.c | 2 +- 52 files changed, 247 insertions(+), 259 deletions(-)
Signature · 1 line
2.30.2
PATCH v2 1/13 tty: Cleanup tty_port_set_initialized() bool parameter
Make callers pass true/false consistently for bool val.
--- drivers/char/pcmcia/synclink_cs.c | 4 ++-- drivers/ipack/devices/ipoctal.c | 4 ++-- drivers/s390/char/con3215.c | 4 ++-- drivers/tty/amiserial.c | 4 ++-- drivers/tty/moxa.c | 2 +- drivers/tty/mxser.c | 2 +- drivers/tty/n_gsm.c | 4 ++-- drivers/tty/serial/serial_core.c | 6 +++--- drivers/tty/synclink_gt.c | 4 ++-- drivers/tty/tty_port.c | 4 ++-- drivers/usb/serial/console.c | 2 +- 11 files changed, 20 insertions(+), 20 deletions(-)
drivers/char/pcmcia/synclink_cs.c +2 -2
@@ -1309,7 +1309,7 @@ static int startup(MGSLPC_INFO * info, struct tty_struct *tty)if (tty)clear_bit (TTY_IO_ERROR , &tty->flags); -tty_port_set_initialized (&info->port,1 ); +tty_port_set_initialized (&info->port, true);return 0 ; }
@@ -1359,7 +1359,7 @@ static void shutdown(MGSLPC_INFO * info, struct tty_struct *tty)if (tty)set_bit (TTY_IO_ERROR , &tty->flags); -tty_port_set_initialized (&info->port,0 ); +tty_port_set_initialized (&info->port, false); }static void mgslpc_program_hw (MGSLPC_INFO *info,struct tty_struct *tty)
drivers/ipack/devices/ipoctal.c +2 -2
@@ -647,7 +647,7 @@ static void ipoctal_hangup(struct tty_struct *tty)tty_port_hangup (&channel->tty_port);ipoctal_reset_channel (channel); -tty_port_set_initialized (&channel->tty_port,0 ); +tty_port_set_initialized (&channel->tty_port, false);wake_up_interruptible (&channel->tty_port.open_wait); }
@@ -659,7 +659,7 @@ static void ipoctal_shutdown(struct tty_struct *tty)return ;ipoctal_reset_channel (channel); -tty_port_set_initialized (&channel->tty_port,0 ); +tty_port_set_initialized (&channel->tty_port, false); }static void ipoctal_cleanup (struct tty_struct *tty)
drivers/s390/char/con3215.c +2 -2
@@ -629,7 +629,7 @@ static int raw3215_startup(struct raw3215_info *raw)if (tty_port_initialized (&raw->port))return 0 ; raw->line_pos =0 ; -tty_port_set_initialized (&raw->port,1 ); +tty_port_set_initialized (&raw->port, true);spin_lock_irqsave (get_ccwdev_lock (raw->cdev), flags);raw3215_try_io (raw);spin_unlock_irqrestore (get_ccwdev_lock (raw->cdev), flags);
@@ -659,7 +659,7 @@ static void raw3215_shutdown(struct raw3215_info *raw)spin_lock_irqsave (get_ccwdev_lock (raw->cdev), flags);remove_wait_queue (&raw->empty_wait, &wait);set_current_state (TASK_RUNNING ); -tty_port_set_initialized (&raw->port,1 ); +tty_port_set_initialized (&raw->port, true); }spin_unlock_irqrestore (get_ccwdev_lock (raw->cdev), flags); }
drivers/tty/amiserial.c +2 -2
@@ -502,7 +502,7 @@ static int startup(struct tty_struct *tty, struct serial_state *info)*/ change_speed (tty, info,NULL ); -tty_port_set_initialized (port,1 ); +tty_port_set_initialized (port, true);local_irq_restore (flags);return 0 ;
@@ -556,7 +556,7 @@ static void shutdown(struct tty_struct *tty, struct serial_state *info)set_bit (TTY_IO_ERROR , &tty->flags); -tty_port_set_initialized (&info->tport,0 ); +tty_port_set_initialized (&info->tport, false);local_irq_restore (flags); }
drivers/tty/moxa.c +1 -1
@@ -1484,7 +1484,7 @@ static int moxa_open(struct tty_struct *tty, struct file *filp)MoxaPortLineCtrl (ch,1 ,1 );MoxaPortEnable (ch);MoxaSetFifo (ch, ch->type ==PORT_16550A ); -tty_port_set_initialized (&ch->port,1 ); +tty_port_set_initialized (&ch->port, true); }mutex_unlock (&ch->port.mutex);mutex_unlock (&moxa_openlock);
drivers/tty/mxser.c +1 -1
@@ -1063,7 +1063,7 @@ static int mxser_set_serial_info(struct tty_struct *tty, }else { retval =mxser_activate (port, tty);if (retval ==0 ) -tty_port_set_initialized (port,1 ); +tty_port_set_initialized (port, true); }mutex_unlock (&port->mutex);return retval;
drivers/tty/n_gsm.c +2 -2
@@ -2059,7 +2059,7 @@ static void gsm_dlci_close(struct gsm_dlci *dlci)tty_port_tty_hangup (&dlci->port, false);gsm_dlci_clear_queues (dlci->gsm, dlci);/* Ensure that gsmtty_open() can return. */ -tty_port_set_initialized (&dlci->port,0 ); +tty_port_set_initialized (&dlci->port, false);wake_up_interruptible (&dlci->port.open_wait); }else dlci->gsm->dead = true;
@@ -3880,7 +3880,7 @@ static int gsmtty_open(struct tty_struct *tty, struct file *filp) dlci->modem_rx =0 ;/* We could in theory open and close before we wait - eg if we get a DM straight back. This is ok as that will have caused a hangup */ -tty_port_set_initialized (port,1 ); +tty_port_set_initialized (port, true);/* Start sending off SABM messages */ if (gsm->initiator)gsm_dlci_begin_open (dlci);
drivers/tty/serial/serial_core.c +3 -3
@@ -290,7 +290,7 @@ static void uart_shutdown(struct tty_struct *tty, struct uart_state *state)set_bit (TTY_IO_ERROR , &tty->flags);if (tty_port_initialized (port)) { -tty_port_set_initialized (port,0 ); +tty_port_set_initialized (port, false);/* * Turn off DTR and RTS early.
@@ -2347,7 +2347,7 @@ int uart_suspend_port(struct uart_driver *drv, struct uart_port *uport)unsigned int mctrl;tty_port_set_suspended (port,1 ); -tty_port_set_initialized (port,0 ); +tty_port_set_initialized (port, false);spin_lock_irq (&uport->lock); ops->stop_tx (uport);
@@ -2458,7 +2458,7 @@ int uart_resume_port(struct uart_driver *drv, struct uart_port *uport)uart_rs485_config (uport); ops->start_tx (uport);spin_unlock_irq (&uport->lock); -tty_port_set_initialized (port,1 ); +tty_port_set_initialized (port, true); }else {/* * Failed to resume - maybe hardware went away?
drivers/tty/synclink_gt.c +2 -2
@@ -2354,7 +2354,7 @@ static int startup(struct slgt_info *info)if (info->port.tty)clear_bit (TTY_IO_ERROR , &info->port.tty->flags); -tty_port_set_initialized (&info->port,1 ); +tty_port_set_initialized (&info->port, true);return 0 ; }
@@ -2401,7 +2401,7 @@ static void shutdown(struct slgt_info *info)if (info->port.tty)set_bit (TTY_IO_ERROR , &info->port.tty->flags); -tty_port_set_initialized (&info->port,0 ); +tty_port_set_initialized (&info->port, false); }static void program_hw (struct slgt_info *info)
drivers/tty/tty_port.c +2 -2
@@ -367,7 +367,7 @@ static void tty_port_shutdown(struct tty_port *port, struct tty_struct *tty) goto out;if (tty_port_initialized (port)) { -tty_port_set_initialized (port,0 ); +tty_port_set_initialized (port, false);/* * Drop DTR/RTS if HUPCL is set. This causes any attached * modem to hang up the line.
@@ -788,7 +788,7 @@ int tty_port_open(struct tty_port *port, struct tty_struct *tty,return retval; } } -tty_port_set_initialized (port,1 ); +tty_port_set_initialized (port, true); }mutex_unlock (&port->mutex);return tty_port_block_til_ready (port, tty, filp);
drivers/usb/serial/console.c +1 -1
@@ -169,7 +169,7 @@ static int usb_console_setup(struct console *co, char *options)tty_save_termios (tty);tty_kref_put (tty); } -tty_port_set_initialized (&port->port,1 ); +tty_port_set_initialized (&port->port, true); }/* Now that any required fake tty operations are completed restore * the tty port count */
Signature · 1 line
2.30.2
PATCH v2 2/13 tty: Cleamup tty_port_set_suspended() bool parameter
In reply to Ilpo JärvinenMake callers pass true/false consistently for bool val.
--- drivers/tty/serial/serial_core.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/tty/serial/serial_core.c +4 -4
@@ -312,7 +312,7 @@ static void uart_shutdown(struct tty_struct *tty, struct uart_state *state)* a DCD drop (hangup) at just the right time. Clear suspended bit so * we don't try to resume a port that has been shutdown. */ -tty_port_set_suspended (port,0 ); +tty_port_set_suspended (port, false);/* * Do not free() the transmit buffer page under the port lock since
@@ -1725,7 +1725,7 @@ static void uart_tty_port_shutdown(struct tty_port *port)* a DCD drop (hangup) at just the right time. Clear suspended bit so * we don't try to resume a port that has been shutdown. */ -tty_port_set_suspended (port,0 ); +tty_port_set_suspended (port, false);/* * Free the transmit buffer.
@@ -2346,7 +2346,7 @@ int uart_suspend_port(struct uart_driver *drv, struct uart_port *uport)int tries;unsigned int mctrl; -tty_port_set_suspended (port,1 ); +tty_port_set_suspended (port, true);tty_port_set_initialized (port, false);spin_lock_irq (&uport->lock);
@@ -2469,7 +2469,7 @@ int uart_resume_port(struct uart_driver *drv, struct uart_port *uport) } } -tty_port_set_suspended (port,0 ); +tty_port_set_suspended (port, false); }mutex_unlock (&port->mutex);
Signature · 1 line
2.30.2
PATCH v2 7/13 tty: Convert ->dtr_rts() to take bool argument
In reply to Ilpo JärvinenConvert the raise/on parameter in ->dtr_rts() to bool through the callchain. The parameter is used like bool. In USB serial, there remains a few implicit bool -> larger type conversions because some devices use u8 in their control messages.
In moxa_tiocmget(), dtr variable was reused for line status which requires int so use a separate variable for status.
--- drivers/char/pcmcia/synclink_cs.c | 4 +-- drivers/mmc/core/sdio_uart.c | 4 +-- drivers/staging/greybus/uart.c | 2 +- drivers/tty/amiserial.c | 2 +- drivers/tty/hvc/hvc_console.c | 4 +-- drivers/tty/hvc/hvc_console.h | 2 +- drivers/tty/hvc/hvc_iucv.c | 4 +-- drivers/tty/moxa.c | 52 +++++++++++++++------------- drivers/tty/mxser.c | 2 +- drivers/tty/n_gsm.c | 2 +- drivers/tty/serial/serial_core.c | 8 ++--- drivers/tty/synclink_gt.c | 2 +- drivers/tty/tty_port.c | 4 +-- drivers/usb/class/cdc-acm.c | 2 +- drivers/usb/serial/ch341.c | 2 +- drivers/usb/serial/cp210x.c | 4 +-- drivers/usb/serial/cypress_m8.c | 6 ++-- drivers/usb/serial/digi_acceleport.c | 6 ++-- drivers/usb/serial/f81232.c | 2 +- drivers/usb/serial/f81534.c | 2 +- drivers/usb/serial/ftdi_sio.c | 2 +- drivers/usb/serial/ipw.c | 2 +- drivers/usb/serial/keyspan.c | 2 +- drivers/usb/serial/keyspan_pda.c | 2 +- drivers/usb/serial/mct_u232.c | 4 +-- drivers/usb/serial/mxuport.c | 2 +- drivers/usb/serial/pl2303.c | 2 +- drivers/usb/serial/quatech2.c | 2 +- drivers/usb/serial/sierra.c | 2 +- drivers/usb/serial/spcp8x5.c | 2 +- drivers/usb/serial/ssu100.c | 2 +- drivers/usb/serial/upd78f0730.c | 6 ++-- drivers/usb/serial/usb-serial.c | 2 +- drivers/usb/serial/usb-wwan.h | 2 +- drivers/usb/serial/usb_wwan.c | 2 +- drivers/usb/serial/xr_serial.c | 6 ++-- include/linux/tty_port.h | 4 +-- include/linux/usb/serial.h | 2 +- 38 files changed, 83 insertions(+), 81 deletions(-)
drivers/char/pcmcia/synclink_cs.c +2 -2
@@ -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,int onoff); +static void dtr_rts (struct tty_port *port,bool onoff);#if SYNCLINK_GENERIC_HDLC #define dev_to_port (D ) (dev_to_hdlc(D)->priv)
@@ -2442,7 +2442,7 @@ static bool carrier_raised(struct tty_port *port)return info->serial_signals & SerialSignal_DCD; } -static void dtr_rts (struct tty_port *port,int onoff) +static void dtr_rts (struct tty_port *port,bool onoff) {MGSLPC_INFO *info =container_of (port,MGSLPC_INFO , port);unsigned long flags;
drivers/mmc/core/sdio_uart.c +2 -2
@@ -548,14 +548,14 @@ static bool uart_carrier_raised(struct tty_port *tport)* adjusted during an open, close and hangup. */ -static void uart_dtr_rts (struct tty_port *tport,int onoff) +static void uart_dtr_rts (struct tty_port *tport,bool onoff) {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 ==0 ) +if (!onoff)sdio_uart_clear_mctrl (port,TIOCM_DTR |TIOCM_RTS );else sdio_uart_set_mctrl (port,TIOCM_DTR |TIOCM_RTS );
drivers/staging/greybus/uart.c +1 -1
@@ -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,int on) +static void gb_tty_dtr_rts (struct tty_port *port,bool on) {struct gb_tty *gb_tty;u8 newctrl;
drivers/tty/amiserial.c +1 -1
@@ -1459,7 +1459,7 @@ static bool amiga_carrier_raised(struct tty_port *port)return !(ciab.pra &SER_DCD ); } -static void amiga_dtr_rts (struct tty_port *port,int raise) +static void amiga_dtr_rts (struct tty_port *port,bool raise) { struct serial_state *info = container_of(port, struct serial_state, tport);
drivers/tty/hvc/hvc_console.c +2 -2
@@ -376,7 +376,7 @@ static int hvc_open(struct tty_struct *tty, struct file * filp)/* We are ready... raise DTR/RTS */ if (C_BAUD (tty))if (hp->ops->dtr_rts) - hp->ops->dtr_rts (hp,1 ); + hp->ops->dtr_rts (hp, true);tty_port_set_initialized (&hp->port, true); }
@@ -406,7 +406,7 @@ static void hvc_close(struct tty_struct *tty, struct file * filp)if (C_HUPCL (tty))if (hp->ops->dtr_rts) - hp->ops->dtr_rts (hp,0 ); + hp->ops->dtr_rts (hp, false);if (hp->ops->notifier_del) hp->ops->notifier_del (hp, hp->data);
drivers/tty/hvc/hvc_console.h +1 -1
@@ -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,int raise); +void (*dtr_rts)(struct hvc_struct *hp,bool raise); };/* Register a vterm and a slot index for use as a console (console_init) */
drivers/tty/hvc/hvc_iucv.c +2 -2
@@ -658,13 +658,13 @@ static void hvc_iucv_notifier_hangup(struct hvc_struct *hp, int id)/** * hvc_iucv_dtr_rts() - HVC notifier for handling DTR/RTS * @hp: Pointer the HVC device (struct hvc_struct) -* @raise: Non-zero to raise or zero to lower DTR/RTS lines +* @raise: True to raise or false to lower DTR/RTS lines * * This routine notifies the HVC back-end to raise or lower DTR/RTS * lines. Raising DTR/RTS is ignored. Lowering DTR/RTS indicates to * drop the IUCV connection (similar to hang up the modem). */ -static void hvc_iucv_dtr_rts (struct hvc_struct *hp,int raise) +static void hvc_iucv_dtr_rts (struct hvc_struct *hp,bool raise) {struct hvc_iucv_private *priv;struct iucv_path *path;
drivers/tty/moxa.c +27 -25
133 lines not on this page · raw message
drivers/tty/mxser.c +1 -1
@@ -465,7 +465,7 @@ static bool mxser_carrier_raised(struct tty_port *port)return inb (mp->ioaddr +UART_MSR ) &UART_MSR_DCD ; } -static void mxser_dtr_rts (struct tty_port *port,int on) +static void mxser_dtr_rts (struct tty_port *port,bool on) { struct mxser_port *mp = container_of(port, struct mxser_port, port);unsigned long flags;
drivers/tty/n_gsm.c +1 -1
@@ -3792,7 +3792,7 @@ static bool gsm_carrier_raised(struct tty_port *port)return dlci->modem_rx &TIOCM_CD ; } -static void gsm_dtr_rts (struct tty_port *port,int onoff) +static void gsm_dtr_rts (struct tty_port *port,bool onoff) { struct gsm_dlci *dlci = container_of(port, struct gsm_dlci, port);unsigned int modem_tx = dlci->modem_tx;
drivers/tty/serial/serial_core.c +4 -4
@@ -169,7 +169,7 @@ uart_update_mctrl(struct uart_port *port, unsigned int set, unsigned int clear)#define uart_set_mctrl (port, set) uart_update_mctrl(port, set, 0)#define uart_clear_mctrl (port, clear) uart_update_mctrl(port, 0, clear) -static void uart_port_dtr_rts (struct uart_port *uport,int raise) +static void uart_port_dtr_rts (struct uart_port *uport,bool raise) {if (raise)uart_set_mctrl (uport,TIOCM_DTR |TIOCM_RTS );
@@ -239,7 +239,7 @@ static int uart_port_startup(struct tty_struct *tty, struct uart_state *state,* port is open and ready to respond. */ if (init_hw &&C_BAUD (tty)) -uart_port_dtr_rts (uport,1 ); +uart_port_dtr_rts (uport, true); }/*
@@ -302,7 +302,7 @@ static void uart_shutdown(struct tty_struct *tty, struct uart_state *state) }if (!tty ||C_HUPCL (tty)) -uart_port_dtr_rts (uport,0 ); +uart_port_dtr_rts (uport, false);uart_port_shutdown (port); }
@@ -1885,7 +1885,7 @@ static bool uart_carrier_raised(struct tty_port *port)return mctrl &TIOCM_CAR ; } -static void uart_dtr_rts (struct tty_port *port,int raise) +static void uart_dtr_rts (struct tty_port *port,bool raise) { struct uart_state *state = container_of(port, struct uart_state, port);struct uart_port *uport;
drivers/tty/synclink_gt.c +1 -1
@@ -3138,7 +3138,7 @@ static bool carrier_raised(struct tty_port *port)return info->signals & SerialSignal_DCD; } -static void dtr_rts (struct tty_port *port,int on) +static void dtr_rts (struct tty_port *port,bool on) {unsigned long flags; struct slgt_info *info = container_of(port, struct slgt_info, port);
drivers/tty/tty_port.c +2 -2
@@ -463,7 +463,7 @@ EXPORT_SYMBOL(tty_port_carrier_raised);void tty_port_raise_dtr_rts (struct tty_port *port) {if (port->ops->dtr_rts) - port->ops->dtr_rts (port,1 ); + port->ops->dtr_rts (port, true); }EXPORT_SYMBOL (tty_port_raise_dtr_rts);
@@ -478,7 +478,7 @@ EXPORT_SYMBOL(tty_port_raise_dtr_rts);void tty_port_lower_dtr_rts (struct tty_port *port) {if (port->ops->dtr_rts) - port->ops->dtr_rts (port,0 ); + port->ops->dtr_rts (port, false); }EXPORT_SYMBOL (tty_port_lower_dtr_rts);
drivers/usb/class/cdc-acm.c +1 -1
@@ -651,7 +651,7 @@ static int acm_tty_open(struct tty_struct *tty, struct file *filp)return tty_port_open (&acm->port, tty, filp); } -static void acm_port_dtr_rts (struct tty_port *port,int raise) +static void acm_port_dtr_rts (struct tty_port *port,bool raise) { struct acm *acm = container_of(port, struct acm, port);int val;
drivers/usb/serial/ch341.c +1 -1
@@ -420,7 +420,7 @@ static bool ch341_carrier_raised(struct usb_serial_port *port)return priv->msr &CH341_BIT_DCD ; } -static void ch341_dtr_rts (struct usb_serial_port *port,int on) +static void ch341_dtr_rts (struct usb_serial_port *port,bool on) {struct ch341_private *priv =usb_get_serial_port_data (port);unsigned long flags;
drivers/usb/serial/cp210x.c +2 -2
@@ -45,7 +45,7 @@ static void cp210x_disconnect(struct usb_serial *);static void cp210x_release (struct usb_serial *);static int cp210x_port_probe (struct usb_serial_port *);static void cp210x_port_remove (struct usb_serial_port *); -static void cp210x_dtr_rts (struct usb_serial_port *port,int on); +static void cp210x_dtr_rts (struct usb_serial_port *port,bool on);static void cp210x_process_read_urb (struct urb *urb);static void cp210x_enable_event_mode (struct usb_serial_port *port);static void cp210x_disable_event_mode (struct usb_serial_port *port);
@@ -1402,7 +1402,7 @@ static int cp210x_tiocmset_port(struct usb_serial_port *port,return ret; } -static void cp210x_dtr_rts (struct usb_serial_port *port,int on) +static void cp210x_dtr_rts (struct usb_serial_port *port,bool on) {if (on)cp210x_tiocmset_port (port,TIOCM_DTR |TIOCM_RTS ,0 );
drivers/usb/serial/cypress_m8.c +3 -3
@@ -118,7 +118,7 @@ static int cypress_ca42v2_port_probe(struct usb_serial_port *port);static void cypress_port_remove (struct usb_serial_port *port);static int cypress_open (struct tty_struct *tty,struct usb_serial_port *port);static void cypress_close (struct usb_serial_port *port); -static void cypress_dtr_rts (struct usb_serial_port *port,int on); +static void cypress_dtr_rts (struct usb_serial_port *port,bool on);static int cypress_write (struct tty_struct *tty,struct usb_serial_port *port,const unsigned char *buf,int count);static void cypress_send (struct usb_serial_port *port);
@@ -621,12 +621,12 @@ static int cypress_open(struct tty_struct *tty, struct usb_serial_port *port)return result; }/* cypress_open */ -static void cypress_dtr_rts (struct usb_serial_port *port,int on) +static void cypress_dtr_rts (struct usb_serial_port *port,bool on) {struct cypress_private *priv =usb_get_serial_port_data (port);/* drop dtr and rts */ spin_lock_irq (&priv->lock); -if (on ==0 ) +if (!on) priv->line_control =0 ;else priv->line_control =CONTROL_DTR |CONTROL_RTS ;
drivers/usb/serial/digi_acceleport.c +3 -3
@@ -228,7 +228,7 @@ static unsigned int digi_write_room(struct tty_struct *tty);static unsigned int digi_chars_in_buffer (struct tty_struct *tty);static int digi_open (struct tty_struct *tty,struct usb_serial_port *port);static void digi_close (struct usb_serial_port *port); -static void digi_dtr_rts (struct usb_serial_port *port,int on); +static void digi_dtr_rts (struct usb_serial_port *port,bool on);static int digi_startup_device (struct usb_serial *serial);static int digi_startup (struct usb_serial *serial);static void digi_disconnect (struct usb_serial *serial);
@@ -1060,10 +1060,10 @@ static unsigned int digi_chars_in_buffer(struct tty_struct *tty)return chars; } -static void digi_dtr_rts (struct usb_serial_port *port,int on) +static void digi_dtr_rts (struct usb_serial_port *port,bool on) {/* Adjust DTR and RTS */ -digi_set_modem_signals (port, on * (TIOCM_DTR |TIOCM_RTS ),1 ); +digi_set_modem_signals (port, on ? (TIOCM_DTR |TIOCM_RTS ) :0 ,1 ); }static int digi_open (struct tty_struct *tty,struct usb_serial_port *port)
drivers/usb/serial/f81232.c +1 -1
@@ -752,7 +752,7 @@ static void f81232_close(struct usb_serial_port *port)flush_work (&port_priv->lsr_work); } -static void f81232_dtr_rts (struct usb_serial_port *port,int on) +static void f81232_dtr_rts (struct usb_serial_port *port,bool on) {if (on)f81232_set_mctrl (port,TIOCM_DTR |TIOCM_RTS ,0 );
drivers/usb/serial/f81534.c +1 -1
@@ -1456,7 +1456,7 @@ static int f81534_tiocmset(struct tty_struct *tty, unsigned int set,return f81534_update_mctrl (port, set, clear); } -static void f81534_dtr_rts (struct usb_serial_port *port,int on) +static void f81534_dtr_rts (struct usb_serial_port *port,bool on) {if (on)f81534_update_mctrl (port,TIOCM_DTR |TIOCM_RTS ,0 );
drivers/usb/serial/ftdi_sio.c +1 -1
@@ -2366,7 +2366,7 @@ static int ftdi_open(struct tty_struct *tty, struct usb_serial_port *port)return usb_serial_generic_open (tty, port); } -static void ftdi_dtr_rts (struct usb_serial_port *port,int on) +static void ftdi_dtr_rts (struct usb_serial_port *port,bool on) {struct ftdi_private *priv =usb_get_serial_port_data (port);
drivers/usb/serial/ipw.c +1 -1
@@ -215,7 +215,7 @@ static void ipw_release(struct usb_serial *serial)kfree (data); } -static void ipw_dtr_rts (struct usb_serial_port *port,int on) +static void ipw_dtr_rts (struct usb_serial_port *port,bool on) {struct usb_device *udev = port->serial->dev;struct device *dev = &port->dev;
drivers/usb/serial/keyspan.c +1 -1
@@ -1564,7 +1564,7 @@ static int keyspan_open(struct tty_struct *tty, struct usb_serial_port *port)return 0 ; } -static void keyspan_dtr_rts (struct usb_serial_port *port,int on) +static void keyspan_dtr_rts (struct usb_serial_port *port,bool on) {struct keyspan_port_private *p_priv =usb_get_serial_port_data (port);
drivers/usb/serial/keyspan_pda.c +1 -1
@@ -551,7 +551,7 @@ static int keyspan_pda_write(struct tty_struct *tty, struct usb_serial_port *porreturn count; } -static void keyspan_pda_dtr_rts (struct usb_serial_port *port,int on) +static void keyspan_pda_dtr_rts (struct usb_serial_port *port,bool on) {struct usb_serial *serial = port->serial;
drivers/usb/serial/mct_u232.c +2 -2
@@ -42,7 +42,7 @@ static int mct_u232_port_probe(struct usb_serial_port *port);static void mct_u232_port_remove (struct usb_serial_port *remove);static int mct_u232_open (struct tty_struct *tty,struct usb_serial_port *port);static void mct_u232_close (struct usb_serial_port *port); -static void mct_u232_dtr_rts (struct usb_serial_port *port,int on); +static void mct_u232_dtr_rts (struct usb_serial_port *port,bool on);static void mct_u232_read_int_callback (struct urb *urb); static void mct_u232_set_termios(struct tty_struct *tty, struct usb_serial_port *port,
@@ -477,7 +477,7 @@ static int mct_u232_open(struct tty_struct *tty, struct usb_serial_port *port)return retval; }/* mct_u232_open */ -static void mct_u232_dtr_rts (struct usb_serial_port *port,int on) +static void mct_u232_dtr_rts (struct usb_serial_port *port,bool on) {unsigned int control_state;struct mct_u232_private *priv =usb_get_serial_port_data (port);
drivers/usb/serial/mxuport.c +1 -1
@@ -674,7 +674,7 @@ static int mxuport_set_rts(struct usb_serial_port *port, u8 state)return err; } -static void mxuport_dtr_rts (struct usb_serial_port *port,int on) +static void mxuport_dtr_rts (struct usb_serial_port *port,bool on) {struct mxuport_port *mxport =usb_get_serial_port_data (port);u8 mcr_state;
drivers/usb/serial/pl2303.c +1 -1
@@ -931,7 +931,7 @@ static void pl2303_set_termios(struct tty_struct *tty,kfree (buf); } -static void pl2303_dtr_rts (struct usb_serial_port *port,int on) +static void pl2303_dtr_rts (struct usb_serial_port *port,bool on) {struct pl2303_private *priv =usb_get_serial_port_data (port);unsigned long flags;
drivers/usb/serial/quatech2.c +1 -1
@@ -770,7 +770,7 @@ static void qt2_break_ctl(struct tty_struct *tty, int break_state) -static void qt2_dtr_rts (struct usb_serial_port *port,int on) +static void qt2_dtr_rts (struct usb_serial_port *port,bool on) {struct usb_device *dev = port->serial->dev;struct qt2_port_private *port_priv =usb_get_serial_port_data (port);
drivers/usb/serial/sierra.c +1 -1
@@ -813,7 +813,7 @@ static int sierra_open(struct tty_struct *tty, struct usb_serial_port *port) } -static void sierra_dtr_rts (struct usb_serial_port *port,int on) +static void sierra_dtr_rts (struct usb_serial_port *port,bool on) {struct sierra_port_private *portdata;
drivers/usb/serial/spcp8x5.c +1 -1
@@ -256,7 +256,7 @@ static bool spcp8x5_carrier_raised(struct usb_serial_port *port)return ret || msr &MSR_STATUS_LINE_DCD ; } -static void spcp8x5_dtr_rts (struct usb_serial_port *port,int on) +static void spcp8x5_dtr_rts (struct usb_serial_port *port,bool on) {struct spcp8x5_private *priv =usb_get_serial_port_data (port);unsigned long flags;
drivers/usb/serial/ssu100.c +1 -1
@@ -385,7 +385,7 @@ static int ssu100_tiocmset(struct tty_struct *tty,return update_mctrl (dev, set, clear); } -static void ssu100_dtr_rts (struct usb_serial_port *port,int on) +static void ssu100_dtr_rts (struct usb_serial_port *port,bool on) {struct usb_device *dev = port->serial->dev;
drivers/usb/serial/upd78f0730.c +3 -3
@@ -262,7 +262,7 @@ static void upd78f0730_break_ctl(struct tty_struct *tty, int break_state)mutex_unlock (&private->lock); } -static void upd78f0730_dtr_rts (struct usb_serial_port *port,int on) +static void upd78f0730_dtr_rts (struct usb_serial_port *port,bool on) {struct tty_struct *tty = port->port.tty;unsigned int set =0 ;
@@ -307,9 +307,9 @@ static void upd78f0730_set_termios(struct tty_struct *tty,return ;if (C_BAUD (tty) ==B0 ) -upd78f0730_dtr_rts (port,0 ); +upd78f0730_dtr_rts (port, false);else if (old_termios && (old_termios->c_cflag &CBAUD ) ==B0 ) -upd78f0730_dtr_rts (port,1 ); +upd78f0730_dtr_rts (port, true); baud_rate =upd78f0730_get_baud_rate (tty); request.opcode =UPD78F0730_CMD_LINE_CONTROL ;
drivers/usb/serial/usb-serial.c +1 -1
@@ -765,7 +765,7 @@ static bool serial_port_carrier_raised(struct tty_port *port)return true; } -static void serial_port_dtr_rts (struct tty_port *port,int on) +static void serial_port_dtr_rts (struct tty_port *port,bool on) { struct usb_serial_port *p = container_of(port, struct usb_serial_port, port);struct usb_serial_driver *drv = p->serial->type;
drivers/usb/serial/usb-wwan.h +1 -1
@@ -6,7 +6,7 @@#ifndef __LINUX_USB_USB_WWAN#define __LINUX_USB_USB_WWAN -extern void usb_wwan_dtr_rts (struct usb_serial_port *port,int on); +extern void usb_wwan_dtr_rts (struct usb_serial_port *port,bool on);extern int usb_wwan_open (struct tty_struct *tty,struct usb_serial_port *port);extern void usb_wwan_close (struct usb_serial_port *port);extern int usb_wwan_port_probe (struct usb_serial_port *port);
drivers/usb/serial/usb_wwan.c +1 -1
@@ -69,7 +69,7 @@ static int usb_wwan_send_setup(struct usb_serial_port *port)return res; } -void usb_wwan_dtr_rts (struct usb_serial_port *port,int on) +void usb_wwan_dtr_rts (struct usb_serial_port *port,bool on) {struct usb_wwan_port_private *portdata;struct usb_wwan_intf_private *intfdata;
drivers/usb/serial/xr_serial.c +3 -3
@@ -495,7 +495,7 @@ static int xr_tiocmset(struct tty_struct *tty,return xr_tiocmset_port (port, set, clear); } -static void xr_dtr_rts (struct usb_serial_port *port,int on) +static void xr_dtr_rts (struct usb_serial_port *port,bool on) {if (on)xr_tiocmset_port (port,TIOCM_DTR |TIOCM_RTS ,0 );
@@ -669,9 +669,9 @@ static void xr_set_flow_mode(struct tty_struct *tty,xr_uart_enable (port);if (C_BAUD (tty) ==B0 ) -xr_dtr_rts (port,0 ); +xr_dtr_rts (port, false);else if (old_termios && (old_termios->c_cflag &CBAUD ) ==B0 ) -xr_dtr_rts (port,1 ); +xr_dtr_rts (port, true); } static void xr21v141x_set_line_settings(struct tty_struct *tty,
include/linux/tty_port.h +2 -2
@@ -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 nonzero, otherwise lower DTR +* @dtr_rts: raise the DTR line if @raise 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,int raise); +void (*dtr_rts)(struct tty_port *port,bool raise);void (*shutdown)(struct tty_port *port);int (*activate)(struct tty_port *port,struct tty_struct *tty);void (*destruct)(struct tty_port *port);
include/linux/usb/serial.h +1 -1
@@ -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,int on); +void (*dtr_rts)(struct usb_serial_port *port,bool on);bool (*carrier_raised)(struct usb_serial_port *port);/* Called by the usb serial hooks to allow the user to rework the termios state */
Signature · 1 line
2.30.2
PATCH v2 4/13 tty: moxa: Make local var storing tty_port_initialized() bool
In reply to Ilpo JärvinenReturn type of tty_port_initialized() is bool, use matching type for the local variable.
Also reorder the local vars to reverse-xmas-tree while at it.
--- drivers/tty/moxa.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/tty/moxa.c +1 -1
@@ -1664,8 +1664,8 @@ static int moxa_poll_port(struct moxa_port *p, unsigned int handle, u16 __iomem *ip) {struct tty_struct *tty =tty_port_tty_get (&p->port); +bool inited =tty_port_initialized (&p->port);void __iomem *ofsAddr; -unsigned int inited =tty_port_initialized (&p->port);u16 intr;if (tty) {
Signature · 1 line
2.30.2
PATCH v2 6/13 tty: Convert ->carrier_raised() and callchains to bool
In reply to Ilpo JärvinenReturn boolean from ->carrier_raised() instead of 0 and 1. Make the return type change also to tty_port_carrier_raised() that makes the ->carrier_raised() call (+ cd variable in moxa into which its return value is stored).
Also cleans up a few unnecessary constructs related to this change:
return xx ? 1 : 0; -> return xx; if (xx) return 1; return 0; -> return xx;
--- drivers/char/pcmcia/synclink_cs.c | 8 +++----- drivers/mmc/core/sdio_uart.c | 7 +++---- drivers/tty/amiserial.c | 2 +- drivers/tty/moxa.c | 4 ++-- drivers/tty/mxser.c | 5 +++-- drivers/tty/n_gsm.c | 8 ++++---- drivers/tty/serial/serial_core.c | 9 ++++----- drivers/tty/synclink_gt.c | 7 ++++--- drivers/tty/tty_port.c | 4 ++-- drivers/usb/serial/ch341.c | 7 +++---- drivers/usb/serial/f81232.c | 6 ++---- drivers/usb/serial/pl2303.c | 7 ++----- drivers/usb/serial/spcp8x5.c | 7 ++----- drivers/usb/serial/usb-serial.c | 4 ++-- include/linux/tty_port.h | 6 +++--- include/linux/usb/serial.h | 2 +- net/bluetooth/rfcomm/tty.c | 2 +- 17 files changed, 42 insertions(+), 53 deletions(-)
drivers/char/pcmcia/synclink_cs.c +3 -5
@@ -377,7 +377,7 @@ static void async_mode(MGSLPC_INFO *info);static void tx_timeout (struct timer_list *t); -static int carrier_raised (struct tty_port *port); +static bool carrier_raised (struct tty_port *port);static void dtr_rts (struct tty_port *port,int onoff);#if SYNCLINK_GENERIC_HDLC
@@ -2430,7 +2430,7 @@ static void mgslpc_hangup(struct tty_struct *tty)tty_port_hangup (&info->port); } -static int carrier_raised (struct tty_port *port) +static bool carrier_raised (struct tty_port *port) {MGSLPC_INFO *info =container_of (port,MGSLPC_INFO , port);unsigned long flags;
@@ -2439,9 +2439,7 @@ static int carrier_raised(struct tty_port *port)get_signals (info);spin_unlock_irqrestore (&info->lock, flags); -if (info->serial_signals & SerialSignal_DCD) -return 1 ; -return 0 ; +return info->serial_signals & SerialSignal_DCD; }static void dtr_rts (struct tty_port *port,int onoff)
drivers/mmc/core/sdio_uart.c +3 -4
@@ -526,7 +526,7 @@ static void sdio_uart_irq(struct sdio_func *func) port->in_sdio_uart_irq =NULL ; } -static int uart_carrier_raised (struct tty_port *tport) +static bool uart_carrier_raised (struct tty_port *tport) {struct sdio_uart_port *port = container_of(tport, struct sdio_uart_port, port);
@@ -535,9 +535,8 @@ static int uart_carrier_raised(struct tty_port *tport)return 1 ; ret =sdio_uart_get_mctrl (port);sdio_uart_release_func (port); -if (ret &TIOCM_CAR ) -return 1 ; -return 0 ; + +return ret &TIOCM_CAR ; }/**
drivers/tty/amiserial.c +1 -1
@@ -1454,7 +1454,7 @@ static const struct tty_operations serial_ops = { .proc_show = rs_proc_show, }; -static int amiga_carrier_raised (struct tty_port *port) +static bool amiga_carrier_raised (struct tty_port *port) {return !(ciab.pra &SER_DCD ); }
drivers/tty/moxa.c +2 -2
@@ -501,7 +501,7 @@ static int moxa_tiocmset(struct tty_struct *tty,static void moxa_poll (struct timer_list *);static void moxa_set_tty_param (struct tty_struct *,const struct ktermios *);static void moxa_shutdown (struct tty_port *); -static int moxa_carrier_raised (struct tty_port *); +static bool moxa_carrier_raised (struct tty_port *);static void moxa_dtr_rts (struct tty_port *,int );/* * moxa board interface functions:
@@ -1432,7 +1432,7 @@ static void moxa_shutdown(struct tty_port *port)MoxaPortFlushData (ch,2 ); } -static int moxa_carrier_raised (struct tty_port *port) +static bool moxa_carrier_raised (struct tty_port *port) { struct moxa_port *ch = container_of(port, struct moxa_port, port);int dcd;
drivers/tty/mxser.c +3 -2
@@ -458,10 +458,11 @@ static void __mxser_stop_tx(struct mxser_port *info)outb (info->IER, info->ioaddr +UART_IER ); } -static int mxser_carrier_raised (struct tty_port *port) +static bool mxser_carrier_raised (struct tty_port *port) { struct mxser_port *mp = container_of(port, struct mxser_port, port); -return (inb (mp->ioaddr +UART_MSR ) &UART_MSR_DCD )?1 :0 ; + +return inb (mp->ioaddr +UART_MSR ) &UART_MSR_DCD ; }static void mxser_dtr_rts (struct tty_port *port,int on)
drivers/tty/n_gsm.c +4 -4
@@ -3770,16 +3770,16 @@ static int gsm_modem_update(struct gsm_dlci *dlci, u8 brk)return -EPROTONOSUPPORT ; } -static int gsm_carrier_raised (struct tty_port *port) +static bool gsm_carrier_raised (struct tty_port *port) { struct gsm_dlci *dlci = container_of(port, struct gsm_dlci, port);struct gsm_mux *gsm = dlci->gsm;/* Not yet open so no carrier info */ if (dlci->state !=DLCI_OPEN ) -return 0 ; +return false;if (debug &DBG_CD_ON ) -return 1 ; +return true;/* * Basic mode with control channel in ADM mode may not respond
@@ -3787,7 +3787,7 @@ static int gsm_carrier_raised(struct tty_port *port)*/ if (gsm->encoding ==GSM_BASIC_OPT && gsm->dlci[0 ]->mode ==DLCI_MODE_ADM && !dlci->modem_rx) -return 1 ; +return true;return dlci->modem_rx &TIOCM_CD ; }
drivers/tty/serial/serial_core.c +4 -5
@@ -1861,7 +1861,7 @@ static void uart_port_shutdown(struct tty_port *port) } } -static int uart_carrier_raised (struct tty_port *port) +static bool uart_carrier_raised (struct tty_port *port) { struct uart_state *state = container_of(port, struct uart_state, port);struct uart_port *uport;
@@ -1875,15 +1875,14 @@ static int uart_carrier_raised(struct tty_port *port)* continue and not sleep */ if (WARN_ON (!uport)) -return 1 ; +return true;spin_lock_irq (&uport->lock);uart_enable_ms (uport); mctrl = uport->ops->get_mctrl (uport);spin_unlock_irq (&uport->lock);uart_port_deref (uport); -if (mctrl &TIOCM_CAR ) -return 1 ; -return 0 ; + +return mctrl &TIOCM_CAR ; }static void uart_dtr_rts (struct tty_port *port,int raise)
drivers/tty/synclink_gt.c +4 -3
@@ -3126,7 +3126,7 @@ static int tiocmset(struct tty_struct *tty,return 0 ; } -static int carrier_raised (struct tty_port *port) +static bool carrier_raised (struct tty_port *port) {unsigned long flags; struct slgt_info *info = container_of(port, struct slgt_info, port);
@@ -3134,7 +3134,8 @@ static int carrier_raised(struct tty_port *port)spin_lock_irqsave (&info->lock,flags);get_gtsignals (info);spin_unlock_irqrestore (&info->lock,flags); -return (info->signals & SerialSignal_DCD) ?1 :0 ; + +return info->signals & SerialSignal_DCD; }static void dtr_rts (struct tty_port *port,int on)
@@ -3162,7 +3163,7 @@ static int block_til_ready(struct tty_struct *tty, struct file *filp,int retval;bool do_clocal = false;unsigned long flags; -int cd; +bool cd;struct tty_port *port = &info->port;DBGINFO (("%s block_til_ready\n" , tty->driver->name));
drivers/tty/tty_port.c +2 -2
@@ -444,10 +444,10 @@ EXPORT_SYMBOL_GPL(tty_port_tty_wakeup);* to hide some internal details. This will eventually become entirely * internal to the tty port. */ -int tty_port_carrier_raised (struct tty_port *port) +bool tty_port_carrier_raised (struct tty_port *port) {if (port->ops->carrier_raised ==NULL ) -return 1 ; +return true;return port->ops->carrier_raised (port); }EXPORT_SYMBOL (tty_port_carrier_raised);
drivers/usb/serial/ch341.c +3 -4
@@ -413,12 +413,11 @@ static void ch341_port_remove(struct usb_serial_port *port)kfree (priv); } -static int ch341_carrier_raised (struct usb_serial_port *port) +static bool ch341_carrier_raised (struct usb_serial_port *port) {struct ch341_private *priv =usb_get_serial_port_data (port); -if (priv->msr &CH341_BIT_DCD ) -return 1 ; -return 0 ; + +return priv->msr &CH341_BIT_DCD ; }static void ch341_dtr_rts (struct usb_serial_port *port,int on)
drivers/usb/serial/f81232.c +2 -4
@@ -774,7 +774,7 @@ static bool f81232_tx_empty(struct usb_serial_port *port)return true; } -static int f81232_carrier_raised (struct usb_serial_port *port) +static bool f81232_carrier_raised (struct usb_serial_port *port) {u8 msr;struct f81232_private *priv =usb_get_serial_port_data (port);
@@ -783,9 +783,7 @@ static int f81232_carrier_raised(struct usb_serial_port *port) msr = priv->modem_status;mutex_unlock (&priv->lock); -if (msr &UART_MSR_DCD ) -return 1 ; -return 0 ; +return msr &UART_MSR_DCD ; }static void f81232_get_serial (struct tty_struct *tty,struct serial_struct *ss)
drivers/usb/serial/pl2303.c +2 -5
@@ -1050,14 +1050,11 @@ static int pl2303_tiocmget(struct tty_struct *tty)return result; } -static int pl2303_carrier_raised (struct usb_serial_port *port) +static bool pl2303_carrier_raised (struct usb_serial_port *port) {struct pl2303_private *priv =usb_get_serial_port_data (port); -if (priv->line_status &UART_DCD ) -return 1 ; - -return 0 ; +return priv->line_status &UART_DCD ; }static void pl2303_set_break (struct usb_serial_port *port,bool enable)
drivers/usb/serial/spcp8x5.c +2 -5
@@ -247,16 +247,13 @@ static void spcp8x5_set_work_mode(struct usb_serial_port *port, u16 value,dev_err (&port->dev,"failed to set work mode: %d\n" , ret); } -static int spcp8x5_carrier_raised (struct usb_serial_port *port) +static bool spcp8x5_carrier_raised (struct usb_serial_port *port) {u8 msr;int ret; ret =spcp8x5_get_msr (port, &msr); -if (ret || msr &MSR_STATUS_LINE_DCD ) -return 1 ; - -return 0 ; +return ret || msr &MSR_STATUS_LINE_DCD ; }static void spcp8x5_dtr_rts (struct usb_serial_port *port,int on)
drivers/usb/serial/usb-serial.c +2 -2
@@ -754,7 +754,7 @@ static struct usb_serial_driver *search_serial_device(return NULL ; } -static int serial_port_carrier_raised (struct tty_port *port) +static bool serial_port_carrier_raised (struct tty_port *port) { struct usb_serial_port *p = container_of(port, struct usb_serial_port, port);struct usb_serial_driver *drv = p->serial->type;
@@ -762,7 +762,7 @@ static int serial_port_carrier_raised(struct tty_port *port)if (drv->carrier_raised)return drv->carrier_raised (p);/* No carrier control - don't block */ -return 1 ; +return true; }static void serial_port_dtr_rts (struct tty_port *port,int on)
include/linux/tty_port.h +3 -3
@@ -15,7 +15,7 @@ struct tty_struct;/** * struct tty_port_operations -- operations on tty_port -* @carrier_raised: return 1 if the carrier is raised on @port +* @carrier_raised: return true if the carrier is raised on @port * @dtr_rts: raise the DTR line if @raise is nonzero, 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
@@ -31,7 +31,7 @@ struct tty_struct;* the port itself. */ struct tty_port_operations { -int (*carrier_raised)(struct tty_port *port); +bool (*carrier_raised)(struct tty_port *port);void (*dtr_rts)(struct tty_port *port,int raise);void (*shutdown)(struct tty_port *port);int (*activate)(struct tty_port *port,struct tty_struct *tty);
@@ -230,7 +230,7 @@ static inline void tty_port_set_kopened(struct tty_port *port, bool val)struct tty_struct *tty_port_tty_get (struct tty_port *port);void tty_port_tty_set (struct tty_port *port,struct tty_struct *tty); -int tty_port_carrier_raised (struct tty_port *port); +bool tty_port_carrier_raised (struct tty_port *port);void tty_port_raise_dtr_rts (struct tty_port *port);void tty_port_lower_dtr_rts (struct tty_port *port);void tty_port_hangup (struct tty_port *port);
include/linux/usb/serial.h +1 -1
@@ -293,7 +293,7 @@ struct usb_serial_driver {/* 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,int on); -int (*carrier_raised)(struct usb_serial_port *port); +bool (*carrier_raised)(struct usb_serial_port *port);/* Called by the usb serial hooks to allow the user to rework the termios state */ void (*init_termios)(struct tty_struct *tty);
net/bluetooth/rfcomm/tty.c +1 -1
@@ -119,7 +119,7 @@ static int rfcomm_dev_activate(struct tty_port *port, struct tty_struct *tty) }/* we block the open until the dlc->state becomes BT_CONNECTED */ -static int rfcomm_dev_carrier_raised (struct tty_port *port) +static bool rfcomm_dev_carrier_raised (struct tty_port *port) { struct rfcomm_dev *dev = container_of(port, struct rfcomm_dev, port);
Signature · 1 line
2.30.2
PATCH v2 5/13 serial: Convert uart_{,port_}startup() init_hw param to bool
In reply to Ilpo JärvinenConvert init_hw parameter in uart_startup() and uart_port_startup() to bool as code treats them like bool.
--- drivers/tty/serial/serial_core.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/tty/serial/serial_core.c +5 -5
@@ -182,7 +182,7 @@ static void uart_port_dtr_rts(struct uart_port *uport, int raise)* will be serialised by the per-port mutex. */ static int uart_port_startup (struct tty_struct *tty,struct uart_state *state, -int init_hw) +bool init_hw) {struct uart_port *uport =uart_port_check (state);unsigned long flags;
@@ -254,7 +254,7 @@ static int uart_port_startup(struct tty_struct *tty, struct uart_state *state, }static int uart_startup (struct tty_struct *tty,struct uart_state *state, -int init_hw) +bool init_hw) {struct tty_port *port = &state->port;int retval;
@@ -997,7 +997,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 +1165,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 +1943,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);
Signature · 1 line
2.30.2
PATCH v2 3/13 tty: Cleanup tty_port_set_active() bool parameter
In reply to Ilpo JärvinenMake callers pass true/false consistently for bool val.
--- drivers/tty/amiserial.c | 2 +- drivers/tty/serial/serial_core.c | 4 ++-- drivers/tty/synclink_gt.c | 6 +++--- drivers/tty/tty_port.c | 10 +++++----- 4 files changed, 11 insertions(+), 11 deletions(-)
drivers/tty/amiserial.c +1 -1
@@ -1329,7 +1329,7 @@ static void rs_hangup(struct tty_struct *tty)rs_flush_buffer (tty);shutdown (tty, info); info->tport.count =0 ; -tty_port_set_active (&info->tport,0 ); +tty_port_set_active (&info->tport, false); info->tport.tty =NULL ;wake_up_interruptible (&info->tport.open_wait); }
drivers/tty/serial/serial_core.c +2 -2
@@ -1827,7 +1827,7 @@ static void uart_hangup(struct tty_struct *tty)spin_lock_irqsave (&port->lock, flags); port->count =0 ;spin_unlock_irqrestore (&port->lock, flags); -tty_port_set_active (port,0 ); +tty_port_set_active (port, false);tty_port_tty_set (port,NULL );if (uport && !uart_console (uport))uart_change_pm (state,UART_PM_STATE_OFF );
@@ -1945,7 +1945,7 @@ static int uart_port_activate(struct tty_port *port, struct tty_struct *tty)*/ ret =uart_startup (tty, state,0 );if (ret >0 ) -tty_port_set_active (port,1 ); +tty_port_set_active (port, true);return ret; }
drivers/tty/synclink_gt.c +3 -3
@@ -694,7 +694,7 @@ static void hangup(struct tty_struct *tty) info->port.count =0 ; info->port.tty =NULL ;spin_unlock_irqrestore (&info->port.lock, flags); -tty_port_set_active (&info->port,0 ); +tty_port_set_active (&info->port, false);mutex_unlock (&info->port.mutex);wake_up_interruptible (&info->port.open_wait);
@@ -3169,7 +3169,7 @@ static int block_til_ready(struct tty_struct *tty, struct file *filp,if (filp->f_flags &O_NONBLOCK ||tty_io_error (tty)) {/* nonblock mode is set or port is not enabled */ -tty_port_set_active (port,1 ); +tty_port_set_active (port, true);return 0 ; }
@@ -3226,7 +3226,7 @@ static int block_til_ready(struct tty_struct *tty, struct file *filp, port->blocked_open--;if (!retval) -tty_port_set_active (port,1 ); +tty_port_set_active (port, true);DBGINFO (("%s block_til_ready ready, rc=%d\n" , tty->driver->name, retval));return retval;
drivers/tty/tty_port.c +5 -5
@@ -403,7 +403,7 @@ void tty_port_hangup(struct tty_port *port)set_bit (TTY_IO_ERROR , &tty->flags); port->tty =NULL ;spin_unlock_irqrestore (&port->lock, flags); -tty_port_set_active (port,0 ); +tty_port_set_active (port, false);tty_port_shutdown (port, tty);tty_kref_put (tty);wake_up_interruptible (&port->open_wait);
@@ -518,14 +518,14 @@ int tty_port_block_til_ready(struct tty_port *port,* the port has just hung up or is in another error state. */ if (tty_io_error (tty)) { -tty_port_set_active (port,1 ); +tty_port_set_active (port, true);return 0 ; }if (filp ==NULL || (filp->f_flags &O_NONBLOCK )) {/* Indicate we are open */ if (C_BAUD (tty))tty_port_raise_dtr_rts (port); -tty_port_set_active (port,1 ); +tty_port_set_active (port, true);return 0 ; }
@@ -588,7 +588,7 @@ int tty_port_block_til_ready(struct tty_port *port, port->blocked_open--;spin_unlock_irqrestore (&port->lock, flags);if (retval ==0 ) -tty_port_set_active (port,1 ); +tty_port_set_active (port, true);return retval; }EXPORT_SYMBOL (tty_port_block_til_ready);
@@ -695,7 +695,7 @@ void tty_port_close_end(struct tty_port *port, struct tty_struct *tty)wake_up_interruptible (&port->open_wait); }spin_unlock_irqrestore (&port->lock, flags); -tty_port_set_active (port,0 ); +tty_port_set_active (port, false); }EXPORT_SYMBOL (tty_port_close_end);
Signature · 1 line
2.30.2
PATCH v2 11/13 tty/serial: Call ->dtr_rts() parameter active consistently
In reply to Ilpo JärvinenConvert various parameter names for ->dtr_rts() and related functions from onoff, on, and raise to active.
--- 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(-)
drivers/char/pcmcia/synclink_cs.c +3 -3
@@ -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);
drivers/mmc/core/sdio_uart.c +3 -3
@@ -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 );
drivers/staging/greybus/uart.c +2 -2
@@ -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 );
drivers/tty/amiserial.c +2 -2
@@ -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 );
drivers/tty/hvc/hvc_console.h +1 -1
@@ -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 (*dtr_rts)(struct hvc_struct *hp,bool active); };/* Register a vterm and a slot index for use as a console (console_init) */
drivers/tty/hvc/hvc_iucv.c +3 -3
@@ -658,13 +658,13 @@ static void hvc_iucv_notifier_hangup(struct hvc_struct *hp, int id)/** * hvc_iucv_dtr_rts() - HVC notifier for handling DTR/RTS * @hp: Pointer the HVC device (struct hvc_struct) -* @raise: True to raise or false to lower DTR/RTS lines +* @active: True to raise or false to lower DTR/RTS lines * * This routine notifies the HVC back-end to raise or lower DTR/RTS * lines. Raising DTR/RTS is ignored. Lowering DTR/RTS indicates to * drop the IUCV connection (similar to hang up the modem). */ -static void hvc_iucv_dtr_rts (struct hvc_struct *hp,bool raise) +static void hvc_iucv_dtr_rts (struct hvc_struct *hp,bool active) {struct hvc_iucv_private *priv;struct iucv_path *path;
@@ -672,7 +672,7 @@ static void hvc_iucv_dtr_rts(struct hvc_struct *hp, bool raise)/* Raising the DTR/RTS is ignored as IUCV connections can be * established at any times. */ -if (raise) +if (active)return ; priv =hvc_iucv_get_private (hp->vtermno);
drivers/tty/mxser.c +2 -2
@@ -465,7 +465,7 @@ static bool mxser_carrier_raised(struct tty_port *port)return inb (mp->ioaddr +UART_MSR ) &UART_MSR_DCD ; } -static void mxser_dtr_rts (struct tty_port *port,bool on) +static void mxser_dtr_rts (struct tty_port *port,bool active) { struct mxser_port *mp = container_of(port, struct mxser_port, port);unsigned long flags;
@@ -473,7 +473,7 @@ static void mxser_dtr_rts(struct tty_port *port, bool on)spin_lock_irqsave (&mp->slock, flags); mcr =inb (mp->ioaddr +UART_MCR ); -if (on) +if (active) mcr |=UART_MCR_DTR |UART_MCR_RTS ;else mcr &= ~(UART_MCR_DTR |UART_MCR_RTS );
drivers/tty/n_gsm.c +2 -2
@@ -3792,11 +3792,11 @@ static bool gsm_carrier_raised(struct tty_port *port)return dlci->modem_rx &TIOCM_CD ; } -static void gsm_dtr_rts (struct tty_port *port,bool onoff) +static void gsm_dtr_rts (struct tty_port *port,bool active) { struct gsm_dlci *dlci = container_of(port, struct gsm_dlci, port);unsigned int modem_tx = dlci->modem_tx; -if (onoff) +if (active) modem_tx |=TIOCM_DTR |TIOCM_RTS ;else modem_tx &= ~(TIOCM_DTR |TIOCM_RTS );
drivers/tty/serial/serial_core.c +4 -4
@@ -169,9 +169,9 @@ uart_update_mctrl(struct uart_port *port, unsigned int set, unsigned int clear)#define uart_set_mctrl (port, set) uart_update_mctrl(port, set, 0)#define uart_clear_mctrl (port, clear) uart_update_mctrl(port, 0, clear) -static void uart_port_dtr_rts (struct uart_port *uport,bool raise) +static void uart_port_dtr_rts (struct uart_port *uport,bool active) { -if (raise) +if (active)uart_set_mctrl (uport,TIOCM_DTR |TIOCM_RTS );else uart_clear_mctrl (uport,TIOCM_DTR |TIOCM_RTS );
@@ -1885,7 +1885,7 @@ static bool uart_carrier_raised(struct tty_port *port)return mctrl &TIOCM_CAR ; } -static void uart_dtr_rts (struct tty_port *port,bool raise) +static void uart_dtr_rts (struct tty_port *port,bool active) { struct uart_state *state = container_of(port, struct uart_state, port);struct uart_port *uport;
@@ -1893,7 +1893,7 @@ static void uart_dtr_rts(struct tty_port *port, bool raise) uport =uart_port_ref (state);if (!uport)return ; -uart_port_dtr_rts (uport, raise); +uart_port_dtr_rts (uport, active);uart_port_deref (uport); }
drivers/tty/synclink_gt.c +2 -2
@@ -3138,13 +3138,13 @@ static bool carrier_raised(struct tty_port *port)return info->signals & SerialSignal_DCD; } -static void dtr_rts (struct tty_port *port,bool on) +static void dtr_rts (struct tty_port *port,bool active) {unsigned long flags; struct slgt_info *info = container_of(port, struct slgt_info, port);spin_lock_irqsave (&info->lock,flags); -if (on) +if (active) info->signals |= SerialSignal_RTS | SerialSignal_DTR;else info->signals &= ~(SerialSignal_RTS | SerialSignal_DTR);
include/linux/tty_port.h +2 -2
@@ -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);
include/linux/usb/serial.h +1 -1
@@ -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);bool (*carrier_raised)(struct usb_serial_port *port);/* Called by the usb serial hooks to allow the user to rework the termios state */
Signature · 1 line
2.30.2
PATCH v2 8/13 tty/serial: Make ->dcd_change()+uart_handle_dcd_change() status bool active
In reply to Ilpo JärvinenConvert status parameter for ->dcd_change() and uart_handle_dcd_change() to bool which matches to how the parameter is used.
Rename status to active to better describe what the parameter means.
--- drivers/pps/clients/pps-ldisc.c | 6 +++--- drivers/tty/serial/serial_core.c | 8 ++++---- drivers/tty/serial/sunhv.c | 8 ++++---- drivers/usb/serial/generic.c | 10 +++++----- include/linux/serial_core.h | 3 +-- include/linux/tty_ldisc.h | 4 ++-- include/linux/usb/serial.h | 2 +- 7 files changed, 20 insertions(+), 21 deletions(-)
drivers/pps/clients/pps-ldisc.c +3 -3
@@ -13,7 +13,7 @@#include <linux/pps_kernel.h> #include <linux/bug.h> -static void pps_tty_dcd_change (struct tty_struct *tty,unsigned int status) +static void pps_tty_dcd_change (struct tty_struct *tty,bool active) {struct pps_device *pps;struct pps_event_time ts;
@@ -29,11 +29,11 @@ static void pps_tty_dcd_change(struct tty_struct *tty, unsigned int status)return ;/* Now do the PPS event report */ -pps_event (pps, &ts, status ?PPS_CAPTUREASSERT : +pps_event (pps, &ts, active ?PPS_CAPTUREASSERT :PPS_CAPTURECLEAR ,NULL );dev_dbg (pps->dev,"PPS %s at %lu\n" , - status ?"assert" :"clear" , jiffies); + active ?"assert" :"clear" , jiffies); }static int (*alias_n_tty_open)(struct tty_struct *tty);
drivers/tty/serial/serial_core.c +4 -4
@@ -3252,11 +3252,11 @@ EXPORT_SYMBOL(uart_match_port);/** * uart_handle_dcd_change - handle a change of carrier detect state * @uport: uart_port structure for the open port -* @status: new carrier detect status, nonzero if active +* @active: new carrier detect status * * Caller must hold uport->lock. */ -void uart_handle_dcd_change (struct uart_port *uport,unsigned int status) +void uart_handle_dcd_change (struct uart_port *uport,bool active) {struct tty_port *port = &uport->state->port;struct tty_struct *tty = port->tty;
@@ -3268,7 +3268,7 @@ void uart_handle_dcd_change(struct uart_port *uport, unsigned int status) ld =tty_ldisc_ref (tty);if (ld) {if (ld->ops->dcd_change) - ld->ops->dcd_change (tty, status); + ld->ops->dcd_change (tty, active);tty_ldisc_deref (ld); } }
@@ -3276,7 +3276,7 @@ void uart_handle_dcd_change(struct uart_port *uport, unsigned int status) uport->icount.dcd++;if (uart_dcd_enabled (uport)) { -if (status) +if (active)wake_up_interruptible (&port->open_wait);else if (tty)tty_hangup (tty);
drivers/tty/serial/sunhv.c +4 -4
@@ -87,10 +87,10 @@ static int receive_chars_getchar(struct uart_port *port)if (c ==CON_HUP ) { hung_up =1 ; -uart_handle_dcd_change (port,0 ); +uart_handle_dcd_change (port, false); }else if (hung_up) { hung_up =0 ; -uart_handle_dcd_change (port,1 ); +uart_handle_dcd_change (port, true); }if (port->state ==NULL ) {
@@ -133,7 +133,7 @@ static int receive_chars_read(struct uart_port *port) bytes_read =1 ; }else if (stat ==CON_HUP ) { hung_up =1 ; -uart_handle_dcd_change (port,0 ); +uart_handle_dcd_change (port, false);continue ; }else {/* HV_EWOULDBLOCK, etc. */
@@ -143,7 +143,7 @@ static int receive_chars_read(struct uart_port *port)if (hung_up) { hung_up =0 ; -uart_handle_dcd_change (port,1 ); +uart_handle_dcd_change (port, true); }if (port->sysrq !=0 && *con_read_page) {
drivers/usb/serial/generic.c +5 -5
@@ -605,24 +605,24 @@ EXPORT_SYMBOL_GPL(usb_serial_handle_break);* usb_serial_handle_dcd_change - handle a change of carrier detect state * @port: usb-serial port * @tty: tty for the port -* @status: new carrier detect status, nonzero if active +* @active: new carrier-detect status */ void usb_serial_handle_dcd_change (struct usb_serial_port *port, -struct tty_struct *tty,unsigned int status) +struct tty_struct *tty,bool active) { -dev_dbg (&port->dev,"%s - status %d\n" , __func__, status); +dev_dbg (&port->dev,"%s - active %d\n" , __func__, active);if (tty) {struct tty_ldisc *ld =tty_ldisc_ref (tty);if (ld) {if (ld->ops->dcd_change) - ld->ops->dcd_change (tty, status); + ld->ops->dcd_change (tty, active);tty_ldisc_deref (ld); } } -if (status) +if (active)wake_up_interruptible (&port->port.open_wait);else if (tty && !C_CLOCAL (tty))tty_hangup (tty);
include/linux/serial_core.h +1 -2
@@ -896,8 +896,7 @@ static inline bool uart_softcts_mode(struct uart_port *uport)* The following are helper functions for the low level drivers. */ -extern void uart_handle_dcd_change (struct uart_port *uport, -unsigned int status); +extern void uart_handle_dcd_change (struct uart_port *uport,bool active);extern void uart_handle_cts_change (struct uart_port *uport,unsigned int status);
include/linux/tty_ldisc.h +2 -2
@@ -170,7 +170,7 @@ int ldsem_down_write_nested(struct ld_semaphore *sem, int subclass,* send, please arise a tasklet or workqueue to do the real data transfer. * Do not send data in this hook, it may lead to a deadlock. * -* @dcd_change: [DRV] ``void ()(struct tty_struct *tty, unsigned int status)`` +* @dcd_change: [DRV] ``void ()(struct tty_struct *tty, bool active)`` * * Tells the discipline that the DCD pin has changed its status. Used * exclusively by the %N_PPS (Pulse-Per-Second) line discipline.
@@ -238,7 +238,7 @@ struct tty_ldisc_ops {void (*receive_buf)(struct tty_struct *tty,const unsigned char *cp,const char *fp,int count);void (*write_wakeup)(struct tty_struct *tty); -void (*dcd_change)(struct tty_struct *tty,unsigned int status); +void (*dcd_change)(struct tty_struct *tty,bool active);int (*receive_buf2)(struct tty_struct *tty,const unsigned char *cp,const char *fp,int count); void (*lookahead_buf)(struct tty_struct *tty, const unsigned char *cp,
include/linux/usb/serial.h +1 -1
@@ -372,7 +372,7 @@ static inline int usb_serial_handle_break(struct usb_serial_port *port)#endif void usb_serial_handle_dcd_change (struct usb_serial_port *usb_port, -struct tty_struct *tty,unsigned int status); +struct tty_struct *tty,bool active);int usb_serial_bus_register (struct usb_serial_driver *device);
Signature · 1 line
2.30.2
PATCH v2 9/13 serial: Make uart_handle_cts_change() status param bool active
In reply to Ilpo JärvinenConvert uart_handle_cts_change() to bool which is more appropriate than unsigned int.
Rename status to active to better describe what the parameter means. While at it, make the comment about the active parameter easier to parse.
Cleanup callsites from operations that are not necessary with bool.
--- drivers/tty/serial/imx.c | 2 +- drivers/tty/serial/max3100.c | 2 +- drivers/tty/serial/max310x.c | 3 +-- drivers/tty/serial/serial_core.c | 8 ++++---- include/linux/serial_core.h | 3 +-- 5 files changed, 8 insertions(+), 10 deletions(-)
drivers/tty/serial/imx.c +1 -1
@@ -771,7 +771,7 @@ static irqreturn_t __imx_uart_rtsint(int irq, void *dev_id)imx_uart_writel (sport,USR1_RTSD ,USR1 ); usr1 =imx_uart_readl (sport,USR1 ) &USR1_RTSS ; -uart_handle_cts_change (&sport->port, !!usr1); +uart_handle_cts_change (&sport->port, usr1);wake_up_interruptible (&sport->port.state->port.delta_msr_wait);return IRQ_HANDLED ;
drivers/tty/serial/max3100.c +1 -1
@@ -247,7 +247,7 @@ static int max3100_handlerx(struct max3100_port *s, u16 rx) cts = (rx &MAX3100_CTS ) >0 ;if (s->cts != cts) { s->cts = cts; -uart_handle_cts_change (&s->port, cts ?TIOCM_CTS :0 ); +uart_handle_cts_change (&s->port, cts); }return ret;
drivers/tty/serial/max310x.c +1 -2
@@ -819,8 +819,7 @@ static irqreturn_t max310x_port_irq(struct max310x_port *s, int portno)if (ists &MAX310X_IRQ_CTS_BIT ) { lsr =max310x_port_read (port,MAX310X_LSR_IRQSTS_REG ); -uart_handle_cts_change (port, - !!(lsr &MAX310X_LSR_CTS_BIT )); +uart_handle_cts_change (port, lsr &MAX310X_LSR_CTS_BIT ); }if (rxlen)max310x_handle_rx (port, rxlen);
drivers/tty/serial/serial_core.c +4 -4
@@ -3287,11 +3287,11 @@ EXPORT_SYMBOL_GPL(uart_handle_dcd_change);/** * uart_handle_cts_change - handle a change of clear-to-send state * @uport: uart_port structure for the open port -* @status: new clear to send status, nonzero if active +* @active: new clear-to-send status * * Caller must hold uport->lock. */ -void uart_handle_cts_change (struct uart_port *uport,unsigned int status) +void uart_handle_cts_change (struct uart_port *uport,bool active) {lockdep_assert_held_once (&uport->lock);
@@ -3299,13 +3299,13 @@ void uart_handle_cts_change(struct uart_port *uport, unsigned int status)if (uart_softcts_mode (uport)) {if (uport->hw_stopped) { -if (status) { +if (active) { uport->hw_stopped =0 ; uport->ops->start_tx (uport);uart_write_wakeup (uport); } }else { -if (!status) { +if (!active) { uport->hw_stopped =1 ; uport->ops->stop_tx (uport); }
include/linux/serial_core.h +1 -2
@@ -897,8 +897,7 @@ static inline bool uart_softcts_mode(struct uart_port *uport)*/ extern void uart_handle_dcd_change (struct uart_port *uport,bool active); -extern void uart_handle_cts_change (struct uart_port *uport, -unsigned int status); +extern void uart_handle_cts_change (struct uart_port *uport,bool active);extern void uart_insert_char (struct uart_port *port,unsigned int status,unsigned int overrun,unsigned int ch,unsigned int flag);
Signature · 7 lines
2.30.2 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
PATCH v2 10/13 tty: Return bool from tty_termios_hw_change()
In reply to Ilpo JärvinenChange tty_termios_hw_change() to return bool.
--- drivers/tty/tty_ioctl.c | 8 ++++---- include/linux/tty.h | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-)
drivers/tty/tty_ioctl.c +4 -4
@@ -270,13 +270,13 @@ EXPORT_SYMBOL(tty_termios_copy_hw);* between the two termios structures, or a speed change is needed. */ -int tty_termios_hw_change (const struct ktermios *a,const struct ktermios *b) +bool tty_termios_hw_change (const struct ktermios *a,const struct ktermios *b) {if (a->c_ispeed != b->c_ispeed || a->c_ospeed != b->c_ospeed) -return 1 ; +return true;if ((a->c_cflag ^ b->c_cflag) & ~(HUPCL |CREAD |CLOCAL )) -return 1 ; -return 0 ; +return true; +return false; }EXPORT_SYMBOL (tty_termios_hw_change);
include/linux/tty.h +1 -1
@@ -453,7 +453,7 @@ unsigned char tty_get_char_size(unsigned int cflag);unsigned char tty_get_frame_size (unsigned int cflag);void tty_termios_copy_hw (struct ktermios *new,const struct ktermios *old); -int tty_termios_hw_change (const struct ktermios *a,const struct ktermios *b); +bool tty_termios_hw_change (const struct ktermios *a,const struct ktermios *b);int tty_set_termios (struct tty_struct *tty,struct ktermios *kt);void tty_wakeup (struct tty_struct *tty);
Signature · 1 line
2.30.2
PATCH v2 12/13 tty: moxa: Rename dtr/rts parameters/variables to active
In reply to Ilpo JärvinenUse active consistently for naming parameters and variables.
--- drivers/tty/moxa.c | 52 +++++++++++++++++++++++----------------------- 1 file changed, 26 insertions(+), 26 deletions(-)
drivers/tty/moxa.c +26 -26
@@ -1443,10 +1443,10 @@ static bool moxa_carrier_raised(struct tty_port *port)return dcd; } -static void moxa_dtr_rts (struct tty_port *port,bool onoff) +static void moxa_dtr_rts (struct tty_port *port,bool active) { struct moxa_port *ch = container_of(port, struct moxa_port, port); -MoxaPortLineCtrl (ch, onoff, onoff); +MoxaPortLineCtrl (ch, active, active); }
@@ -1557,14 +1557,14 @@ static unsigned int moxa_chars_in_buffer(struct tty_struct *tty)static int moxa_tiocmget (struct tty_struct *tty) {struct moxa_port *ch = tty->driver_data; -bool dtr, rts; +bool dtr_active, rts_active;int flag =0 ;int status; -MoxaPortGetLineOut (ch, &dtr, &rts); -if (dtr) +MoxaPortGetLineOut (ch, &dtr_active, &rts_active); +if (dtr_active) flag |=TIOCM_DTR ; -if (rts) +if (rts_active) flag |=TIOCM_RTS ; status =MoxaPortLineStatus (ch);if (status &1 )
@@ -1579,8 +1579,8 @@ static int moxa_tiocmget(struct tty_struct *tty)static int moxa_tiocmset (struct tty_struct *tty,unsigned int set,unsigned int clear) { +bool dtr_active, rts_active;struct moxa_port *ch; -bool dtr, rts;mutex_lock (&moxa_openlock); ch = tty->driver_data;
@@ -1589,16 +1589,16 @@ static int moxa_tiocmset(struct tty_struct *tty,return -EINVAL ; } -MoxaPortGetLineOut (ch, &dtr, &rts); +MoxaPortGetLineOut (ch, &dtr_active, &rts_active);if (set &TIOCM_RTS ) - rts = true; + rts_active = true;if (set &TIOCM_DTR ) - dtr = true; + dtr_active = true;if (clear &TIOCM_RTS ) - rts = false; + rts_active = false;if (clear &TIOCM_DTR ) - dtr = false; -MoxaPortLineCtrl (ch, dtr, rts); + dtr_active = false; +MoxaPortLineCtrl (ch, dtr_active, rts_active);mutex_unlock (&moxa_openlock);return 0 ; }
@@ -1881,10 +1881,10 @@ static void MoxaPortFlushData(struct moxa_port *port, int mode)* Syntax: * int MoxaPortGetLineOut(int port, int *dtrState, int *rtsState); * int port : port number (0 - 127) -* bool * dtrState : pointer to bool to receive the current DTR +* bool * dtr_active : pointer to bool to receive the current DTR * state. (if NULL, this function will not * write to this address) -* bool * rtsState : pointer to bool to receive the current RTS +* bool * rts_active : pointer to bool to receive the current RTS * state. (if NULL, this function will not * write to this address) *
@@ -1896,8 +1896,8 @@ static void MoxaPortFlushData(struct moxa_port *port, int mode)* Syntax: * void MoxaPortLineCtrl(int port, bool dtrState, bool rtsState); * int port : port number (0 - 127) -* bool dtrState : DTR output state (0: off, 1: on) -* bool rtsState : RTS output state (0: off, 1: on) +* bool dtr_active : DTR output state +* bool rts_active : RTS output state * * * Function 15: Setting the flow control of this port.
@@ -2105,24 +2105,24 @@ static int MoxaPortSetTermio(struct moxa_port *port, struct ktermios *termio,return baud; } -static int MoxaPortGetLineOut (struct moxa_port *port,bool *dtrState, -bool *rtsState) +static int MoxaPortGetLineOut (struct moxa_port *port,bool *dtr_active, +bool *rts_active) { -if (dtrState) - *dtrState = port->lineCtrl &DTR_ON ; -if (rtsState) - *rtsState = port->lineCtrl &RTS_ON ; +if (dtr_active) + *dtr_active = port->lineCtrl &DTR_ON ; +if (rts_active) + *rts_active = port->lineCtrl &RTS_ON ;return 0 ; } -static void MoxaPortLineCtrl (struct moxa_port *port,bool dtr,bool rts) +static void MoxaPortLineCtrl (struct moxa_port *port,bool dtr_active,bool rts_active) {u8 mode =0 ; -if (dtr) +if (dtr_active) mode |=DTR_ON ; -if (rts) +if (rts_active) mode |=RTS_ON ; port->lineCtrl = mode;moxafunc (port->tableAddr, FC_LineControl, mode);
Signature · 1 line
2.30.2
PATCH v2 13/13 usb/serial: Rename dtr/rts parameters/variables to active
In reply to Ilpo JärvinenUse active consistently for naming parameters and variables. This converts all USB serial drivers + CDC-ACM.
--- drivers/usb/class/cdc-acm.c | 4 ++-- drivers/usb/serial/ch341.c | 4 ++-- drivers/usb/serial/cp210x.c | 6 +++--- drivers/usb/serial/cypress_m8.c | 6 +++--- drivers/usb/serial/digi_acceleport.c | 6 +++--- drivers/usb/serial/f81232.c | 4 ++-- drivers/usb/serial/f81534.c | 4 ++-- drivers/usb/serial/ftdi_sio.c | 6 +++--- drivers/usb/serial/ipw.c | 8 ++++---- drivers/usb/serial/keyspan.c | 6 +++--- drivers/usb/serial/keyspan_pda.c | 4 ++-- drivers/usb/serial/mct_u232.c | 6 +++--- drivers/usb/serial/mxuport.c | 4 ++-- drivers/usb/serial/pl2303.c | 4 ++-- drivers/usb/serial/quatech2.c | 6 +++--- drivers/usb/serial/sierra.c | 6 +++--- drivers/usb/serial/spcp8x5.c | 4 ++-- drivers/usb/serial/ssu100.c | 6 +++--- drivers/usb/serial/upd78f0730.c | 4 ++-- drivers/usb/serial/usb-serial.c | 4 ++-- drivers/usb/serial/usb-wwan.h | 2 +- drivers/usb/serial/usb_wwan.c | 6 +++--- drivers/usb/serial/xr_serial.c | 4 ++-- 23 files changed, 57 insertions(+), 57 deletions(-)
drivers/usb/class/cdc-acm.c +2 -2
@@ -651,13 +651,13 @@ static int acm_tty_open(struct tty_struct *tty, struct file *filp)return tty_port_open (&acm->port, tty, filp); } -static void acm_port_dtr_rts (struct tty_port *port,bool raise) +static void acm_port_dtr_rts (struct tty_port *port,bool active) { struct acm *acm = container_of(port, struct acm, port);int val;int res; -if (raise) +if (active) val =USB_CDC_CTRL_DTR |USB_CDC_CTRL_RTS ;else val =0 ;
drivers/usb/serial/ch341.c +2 -2
@@ -420,14 +420,14 @@ static bool ch341_carrier_raised(struct usb_serial_port *port)return priv->msr &CH341_BIT_DCD ; } -static void ch341_dtr_rts (struct usb_serial_port *port,bool on) +static void ch341_dtr_rts (struct usb_serial_port *port,bool active) {struct ch341_private *priv =usb_get_serial_port_data (port);unsigned long flags;/* drop DTR and RTS */ spin_lock_irqsave (&priv->lock, flags); -if (on) +if (active) priv->mcr |=CH341_BIT_RTS |CH341_BIT_DTR ;else priv->mcr &= ~(CH341_BIT_RTS |CH341_BIT_DTR );
drivers/usb/serial/cp210x.c +3 -3
@@ -45,7 +45,7 @@ static void cp210x_disconnect(struct usb_serial *);static void cp210x_release (struct usb_serial *);static int cp210x_port_probe (struct usb_serial_port *);static void cp210x_port_remove (struct usb_serial_port *); -static void cp210x_dtr_rts (struct usb_serial_port *port,bool on); +static void cp210x_dtr_rts (struct usb_serial_port *port,bool active);static void cp210x_process_read_urb (struct urb *urb);static void cp210x_enable_event_mode (struct usb_serial_port *port);static void cp210x_disable_event_mode (struct usb_serial_port *port);
@@ -1402,9 +1402,9 @@ static int cp210x_tiocmset_port(struct usb_serial_port *port,return ret; } -static void cp210x_dtr_rts (struct usb_serial_port *port,bool on) +static void cp210x_dtr_rts (struct usb_serial_port *port,bool active) { -if (on) +if (active)cp210x_tiocmset_port (port,TIOCM_DTR |TIOCM_RTS ,0 );else cp210x_tiocmset_port (port,0 ,TIOCM_DTR |TIOCM_RTS );
drivers/usb/serial/cypress_m8.c +3 -3
@@ -118,7 +118,7 @@ static int cypress_ca42v2_port_probe(struct usb_serial_port *port);static void cypress_port_remove (struct usb_serial_port *port);static int cypress_open (struct tty_struct *tty,struct usb_serial_port *port);static void cypress_close (struct usb_serial_port *port); -static void cypress_dtr_rts (struct usb_serial_port *port,bool on); +static void cypress_dtr_rts (struct usb_serial_port *port,bool active);static int cypress_write (struct tty_struct *tty,struct usb_serial_port *port,const unsigned char *buf,int count);static void cypress_send (struct usb_serial_port *port);
@@ -621,12 +621,12 @@ static int cypress_open(struct tty_struct *tty, struct usb_serial_port *port)return result; }/* cypress_open */ -static void cypress_dtr_rts (struct usb_serial_port *port,bool on) +static void cypress_dtr_rts (struct usb_serial_port *port,bool active) {struct cypress_private *priv =usb_get_serial_port_data (port);/* drop dtr and rts */ spin_lock_irq (&priv->lock); -if (!on) +if (!active) priv->line_control =0 ;else priv->line_control =CONTROL_DTR |CONTROL_RTS ;
drivers/usb/serial/digi_acceleport.c +3 -3
@@ -228,7 +228,7 @@ static unsigned int digi_write_room(struct tty_struct *tty);static unsigned int digi_chars_in_buffer (struct tty_struct *tty);static int digi_open (struct tty_struct *tty,struct usb_serial_port *port);static void digi_close (struct usb_serial_port *port); -static void digi_dtr_rts (struct usb_serial_port *port,bool on); +static void digi_dtr_rts (struct usb_serial_port *port,bool active);static int digi_startup_device (struct usb_serial *serial);static int digi_startup (struct usb_serial *serial);static void digi_disconnect (struct usb_serial *serial);
@@ -1060,10 +1060,10 @@ static unsigned int digi_chars_in_buffer(struct tty_struct *tty)return chars; } -static void digi_dtr_rts (struct usb_serial_port *port,bool on) +static void digi_dtr_rts (struct usb_serial_port *port,bool active) {/* Adjust DTR and RTS */ -digi_set_modem_signals (port, on ? (TIOCM_DTR |TIOCM_RTS ) :0 ,1 ); +digi_set_modem_signals (port, active ? (TIOCM_DTR |TIOCM_RTS ) :0 ,1 ); }static int digi_open (struct tty_struct *tty,struct usb_serial_port *port)
drivers/usb/serial/f81232.c +2 -2
@@ -752,9 +752,9 @@ static void f81232_close(struct usb_serial_port *port)flush_work (&port_priv->lsr_work); } -static void f81232_dtr_rts (struct usb_serial_port *port,bool on) +static void f81232_dtr_rts (struct usb_serial_port *port,bool active) { -if (on) +if (active)f81232_set_mctrl (port,TIOCM_DTR |TIOCM_RTS ,0 );else f81232_set_mctrl (port,0 ,TIOCM_DTR |TIOCM_RTS );
drivers/usb/serial/f81534.c +2 -2
@@ -1456,9 +1456,9 @@ static int f81534_tiocmset(struct tty_struct *tty, unsigned int set,return f81534_update_mctrl (port, set, clear); } -static void f81534_dtr_rts (struct usb_serial_port *port,bool on) +static void f81534_dtr_rts (struct usb_serial_port *port,bool active) { -if (on) +if (active)f81534_update_mctrl (port,TIOCM_DTR |TIOCM_RTS ,0 );else f81534_update_mctrl (port,0 ,TIOCM_DTR |TIOCM_RTS );
drivers/usb/serial/ftdi_sio.c +3 -3
@@ -2366,12 +2366,12 @@ static int ftdi_open(struct tty_struct *tty, struct usb_serial_port *port)return usb_serial_generic_open (tty, port); } -static void ftdi_dtr_rts (struct usb_serial_port *port,bool on) +static void ftdi_dtr_rts (struct usb_serial_port *port,bool active) {struct ftdi_private *priv =usb_get_serial_port_data (port);/* Disable flow control */ -if (!on) { +if (!active) { if (usb_control_msg(port->serial->dev, usb_sndctrlpipe(port->serial->dev, 0), FTDI_SIO_SET_FLOW_CTRL_REQUEST,
@@ -2382,7 +2382,7 @@ static void ftdi_dtr_rts(struct usb_serial_port *port, bool on) } }/* drop RTS and DTR */ -if (on) +if (active)set_mctrl (port,TIOCM_DTR |TIOCM_RTS );else clear_mctrl (port,TIOCM_DTR |TIOCM_RTS );
drivers/usb/serial/ipw.c +4 -4
@@ -215,18 +215,18 @@ static void ipw_release(struct usb_serial *serial)kfree (data); } -static void ipw_dtr_rts (struct usb_serial_port *port,bool on) +static void ipw_dtr_rts (struct usb_serial_port *port,bool active) {struct usb_device *udev = port->serial->dev;struct device *dev = &port->dev;int result; -dev_dbg (dev,"%s: on = %d\n" , __func__, on); +dev_dbg (dev,"%s: active = %d\n" , __func__, active); result = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), IPW_SIO_SET_PIN, USB_TYPE_VENDOR | USB_RECIP_INTERFACE | USB_DIR_OUT, - on ? IPW_PIN_SETDTR : IPW_PIN_CLRDTR, + active ? IPW_PIN_SETDTR : IPW_PIN_CLRDTR, 0, NULL, 0,
@@ -237,7 +237,7 @@ static void ipw_dtr_rts(struct usb_serial_port *port, bool on) result = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), IPW_SIO_SET_PIN, USB_TYPE_VENDOR | USB_RECIP_INTERFACE | USB_DIR_OUT, - on ? IPW_PIN_SETRTS : IPW_PIN_CLRRTS, + active ? IPW_PIN_SETRTS : IPW_PIN_CLRRTS, 0, NULL, 0,
drivers/usb/serial/keyspan.c +3 -3
@@ -1564,12 +1564,12 @@ static int keyspan_open(struct tty_struct *tty, struct usb_serial_port *port)return 0 ; } -static void keyspan_dtr_rts (struct usb_serial_port *port,bool on) +static void keyspan_dtr_rts (struct usb_serial_port *port,bool active) {struct keyspan_port_private *p_priv =usb_get_serial_port_data (port); - p_priv->rts_state = on; - p_priv->dtr_state = on; + p_priv->rts_state = active; + p_priv->dtr_state = active;keyspan_send_setup (port,0 ); }
drivers/usb/serial/keyspan_pda.c +2 -2
@@ -551,11 +551,11 @@ static int keyspan_pda_write(struct tty_struct *tty, struct usb_serial_port *porreturn count; } -static void keyspan_pda_dtr_rts (struct usb_serial_port *port,bool on) +static void keyspan_pda_dtr_rts (struct usb_serial_port *port,bool active) {struct usb_serial *serial = port->serial; -if (on) +if (active)keyspan_pda_set_modem_info (serial,BIT (7 ) |BIT (2 ));else keyspan_pda_set_modem_info (serial,0 );
drivers/usb/serial/mct_u232.c +3 -3
@@ -42,7 +42,7 @@ static int mct_u232_port_probe(struct usb_serial_port *port);static void mct_u232_port_remove (struct usb_serial_port *remove);static int mct_u232_open (struct tty_struct *tty,struct usb_serial_port *port);static void mct_u232_close (struct usb_serial_port *port); -static void mct_u232_dtr_rts (struct usb_serial_port *port,bool on); +static void mct_u232_dtr_rts (struct usb_serial_port *port,bool active);static void mct_u232_read_int_callback (struct urb *urb); static void mct_u232_set_termios(struct tty_struct *tty, struct usb_serial_port *port,
@@ -477,13 +477,13 @@ static int mct_u232_open(struct tty_struct *tty, struct usb_serial_port *port)return retval; }/* mct_u232_open */ -static void mct_u232_dtr_rts (struct usb_serial_port *port,bool on) +static void mct_u232_dtr_rts (struct usb_serial_port *port,bool active) {unsigned int control_state;struct mct_u232_private *priv =usb_get_serial_port_data (port);spin_lock_irq (&priv->lock); -if (on) +if (active) priv->control_state |=TIOCM_DTR |TIOCM_RTS ;else priv->control_state &= ~(TIOCM_DTR |TIOCM_RTS );
drivers/usb/serial/mxuport.c +2 -2
@@ -674,7 +674,7 @@ static int mxuport_set_rts(struct usb_serial_port *port, u8 state)return err; } -static void mxuport_dtr_rts (struct usb_serial_port *port,bool on) +static void mxuport_dtr_rts (struct usb_serial_port *port,bool active) {struct mxuport_port *mxport =usb_get_serial_port_data (port);u8 mcr_state;
@@ -683,7 +683,7 @@ static void mxuport_dtr_rts(struct usb_serial_port *port, bool on)mutex_lock (&mxport->mutex); mcr_state = mxport->mcr_state; -if (on) +if (active) mcr_state |= (UART_MCR_RTS |UART_MCR_DTR );else mcr_state &= ~(UART_MCR_RTS |UART_MCR_DTR );
drivers/usb/serial/pl2303.c +2 -2
@@ -931,14 +931,14 @@ static void pl2303_set_termios(struct tty_struct *tty,kfree (buf); } -static void pl2303_dtr_rts (struct usb_serial_port *port,bool on) +static void pl2303_dtr_rts (struct usb_serial_port *port,bool active) {struct pl2303_private *priv =usb_get_serial_port_data (port);unsigned long flags;u8 control;spin_lock_irqsave (&priv->lock, flags); -if (on) +if (active) priv->line_control |= (CONTROL_DTR |CONTROL_RTS );else priv->line_control &= ~(CONTROL_DTR |CONTROL_RTS );
drivers/usb/serial/quatech2.c +3 -3
@@ -770,19 +770,19 @@ static void qt2_break_ctl(struct tty_struct *tty, int break_state) -static void qt2_dtr_rts (struct usb_serial_port *port,bool on) +static void qt2_dtr_rts (struct usb_serial_port *port,bool active) {struct usb_device *dev = port->serial->dev;struct qt2_port_private *port_priv =usb_get_serial_port_data (port);/* Disable flow control */ -if (!on) { +if (!active) {if (qt2_setregister (dev, port_priv->device_port,UART_MCR ,0 ) <0 )dev_warn (&port->dev,"error from flowcontrol urb\n" ); }/* drop RTS and DTR */ -if (on) +if (active)update_mctrl (port_priv,TIOCM_DTR |TIOCM_RTS ,0 );else update_mctrl (port_priv,0 ,TIOCM_DTR |TIOCM_RTS );
drivers/usb/serial/sierra.c +3 -3
@@ -813,13 +813,13 @@ static int sierra_open(struct tty_struct *tty, struct usb_serial_port *port) } -static void sierra_dtr_rts (struct usb_serial_port *port,bool on) +static void sierra_dtr_rts (struct usb_serial_port *port,bool active) {struct sierra_port_private *portdata; portdata =usb_get_serial_port_data (port); - portdata->rts_state = on; - portdata->dtr_state = on; + portdata->rts_state = active; + portdata->dtr_state = active;sierra_send_setup (port); }
drivers/usb/serial/spcp8x5.c +2 -2
@@ -256,14 +256,14 @@ static bool spcp8x5_carrier_raised(struct usb_serial_port *port)return ret || msr &MSR_STATUS_LINE_DCD ; } -static void spcp8x5_dtr_rts (struct usb_serial_port *port,bool on) +static void spcp8x5_dtr_rts (struct usb_serial_port *port,bool active) {struct spcp8x5_private *priv =usb_get_serial_port_data (port);unsigned long flags;u8 control;spin_lock_irqsave (&priv->lock, flags); -if (on) +if (active) priv->line_control =MCR_CONTROL_LINE_DTR |MCR_CONTROL_LINE_RTS ;else
drivers/usb/serial/ssu100.c +3 -3
@@ -385,17 +385,17 @@ static int ssu100_tiocmset(struct tty_struct *tty,return update_mctrl (dev, set, clear); } -static void ssu100_dtr_rts (struct usb_serial_port *port,bool on) +static void ssu100_dtr_rts (struct usb_serial_port *port,bool active) {struct usb_device *dev = port->serial->dev;/* Disable flow control */ -if (!on) { +if (!active) {if (ssu100_setregister (dev,0 ,UART_MCR ,0 ) <0 )dev_err (&port->dev,"error from flowcontrol urb\n" ); }/* drop RTS and DTR */ -if (on) +if (active)set_mctrl (dev,TIOCM_DTR |TIOCM_RTS );else clear_mctrl (dev,TIOCM_DTR |TIOCM_RTS );
drivers/usb/serial/upd78f0730.c +2 -2
@@ -262,13 +262,13 @@ static void upd78f0730_break_ctl(struct tty_struct *tty, int break_state)mutex_unlock (&private->lock); } -static void upd78f0730_dtr_rts (struct usb_serial_port *port,bool on) +static void upd78f0730_dtr_rts (struct usb_serial_port *port,bool active) {struct tty_struct *tty = port->port.tty;unsigned int set =0 ;unsigned int clear =0 ; -if (on) +if (active) set =TIOCM_DTR |TIOCM_RTS ;else clear =TIOCM_DTR |TIOCM_RTS ;
drivers/usb/serial/usb-serial.c +2 -2
@@ -765,13 +765,13 @@ static bool serial_port_carrier_raised(struct tty_port *port)return true; } -static void serial_port_dtr_rts (struct tty_port *port,bool on) +static void serial_port_dtr_rts (struct tty_port *port,bool active) { struct usb_serial_port *p = container_of(port, struct usb_serial_port, port);struct usb_serial_driver *drv = p->serial->type;if (drv->dtr_rts) - drv->dtr_rts (p, on); + drv->dtr_rts (p, active); } static ssize_t port_number_show(struct device *dev,
drivers/usb/serial/usb-wwan.h +1 -1
@@ -6,7 +6,7 @@#ifndef __LINUX_USB_USB_WWAN#define __LINUX_USB_USB_WWAN -extern void usb_wwan_dtr_rts (struct usb_serial_port *port,bool on); +extern void usb_wwan_dtr_rts (struct usb_serial_port *port,bool active);extern int usb_wwan_open (struct tty_struct *tty,struct usb_serial_port *port);extern void usb_wwan_close (struct usb_serial_port *port);extern int usb_wwan_port_probe (struct usb_serial_port *port);
drivers/usb/serial/usb_wwan.c +3 -3
@@ -69,7 +69,7 @@ static int usb_wwan_send_setup(struct usb_serial_port *port)return res; } -void usb_wwan_dtr_rts (struct usb_serial_port *port,bool on) +void usb_wwan_dtr_rts (struct usb_serial_port *port,bool active) {struct usb_wwan_port_private *portdata;struct usb_wwan_intf_private *intfdata;
@@ -81,8 +81,8 @@ void usb_wwan_dtr_rts(struct usb_serial_port *port, bool on) portdata =usb_get_serial_port_data (port);/* FIXME: locking */ - portdata->rts_state = on; - portdata->dtr_state = on; + portdata->rts_state = active; + portdata->dtr_state = active;usb_wwan_send_setup (port); }
drivers/usb/serial/xr_serial.c +2 -2
@@ -495,9 +495,9 @@ static int xr_tiocmset(struct tty_struct *tty,return xr_tiocmset_port (port, set, clear); } -static void xr_dtr_rts (struct usb_serial_port *port,bool on) +static void xr_dtr_rts (struct usb_serial_port *port,bool active) { -if (on) +if (active)xr_tiocmset_port (port,TIOCM_DTR |TIOCM_RTS ,0 );else xr_tiocmset_port (port,0 ,TIOCM_DTR |TIOCM_RTS );
Signature · 1 line
2.30.2
Re: [PATCH v2 05/13] serial: Convert uart_{,port_}startup() init_hw param to bool
In reply to Ilpo JärvinenQuoted 4 lines · Ilpo Järvinen
Convert
init_hwparameter inuart_startup()anduart_port_startup()to bool as code treats them like bool.Signed-off-by Ilpo Järvinen <[email protected]>
Quoted 53 lines
--- drivers/tty/serial/serial_core.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)drivers/tty/serial/serial_core.c +5
-5@@ -182,7 +182,7 @@ static void uart_port_dtr_rts(struct uart_port *uport, int raise)* will be serialised by the per-port mutex. */ static int uart_port_startup (struct tty_struct *tty,struct uart_state *state, -int init_hw) +bool init_hw) {struct uart_port *uport =uart_port_check (state);unsigned long flags;@@ -254,7 +254,7 @@ static int uart_port_startup(struct tty_struct *tty, struct uart_state *state, }static int uart_startup (struct tty_struct *tty,struct uart_state *state, -int init_hw) +bool init_hw) {struct tty_port *port = &state->port;int retval;@@ -997,7 +997,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 +1165,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 +1943,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);
Signature · 2 lines
js suse labs
Re: [PATCH v2 09/13] serial: Make uart_handle_cts_change() status param bool active
In reply to Ilpo JärvinenQuoted 10 lines · Ilpo Järvinen
Convert
uart_handle_cts_change()to bool which is more appropriate than unsigned int.Rename status to active to better describe what the parameter means. While at it, make the comment about the active parameter easier to parse.
Cleanup callsites from operations that are not necessary with bool.
Signed-off-by Ilpo Järvinen <[email protected]>
Signature · 2 lines
js suse labs
Re: [PATCH v2 10/13] tty: Return bool from tty_termios_hw_change()
In reply to Ilpo JärvinenQuoted 3 lines · Ilpo Järvinen
Change
tty_termios_hw_change()to return bool.Signed-off-by Ilpo Järvinen <[email protected]>
Signature · 2 lines
js suse labs
Re: [PATCH v2 11/13] tty/serial: Call ->dtr_rts() parameter active consistently
In reply to Ilpo JärvinenQuoted 2 lines · Ilpo Järvinen
Convert various parameter names for ->dtr_rts() and related functions from onoff, on, and raise to active.
Much better.
Quoted 1 line
Signed-off-by Ilpo Järvinen <[email protected]>
Signature · 2 lines
js suse labs
Re: [PATCH v2 12/13] tty: moxa: Rename dtr/rts parameters/variables to active
In reply to Ilpo JärvinenQuoted 3 lines · Ilpo Järvinen
Use active consistently for naming parameters and variables.
Signed-off-by Ilpo Järvinen <[email protected]>
Quoted 2 lines
drivers/tty/moxa.c +0
-0
...
drivers/tty/moxa.c static void MoxaPortFlushData(struct moxa_port *port, int mode) · line 1882
Quoted 3 lines
drivers/tty/moxa.c +0
-0@@ -1881,10 +1881,10 @@ static void MoxaPortFlushData(struct moxa_port *port, int mode)* Syntax: * int MoxaPortGetLineOut(int port, int *dtrState, int *rtsState);
Hmm, this is wrong too ^^. Not sure what introduced the problem.
Quoted 10 lines
drivers/tty/moxa.c +2
-2* int port : port number (0 - 127) -* bool * dtrState : pointer to bool to receive the current DTR +* bool * dtr_active : pointer to bool to receive the current DTR * state. (if NULL, this function will not * write to this address) -* bool * rtsState : pointer to bool to receive the current RTS +* bool * rts_active : pointer to bool to receive the current RTS * state. (if NULL, this function will not * write to this address) *
Signature · 2 lines
js suse labs