tty: Change tty_{port|standard}_install() return type to void
Subsystems (18)
PATCH v2 1/1 tty: Change tty_{port|standard}_install() return type to void
Many drivers with tty use the tty_stand_install(). But, there is no need to handle the error, since it always returns 0. So, change the return type of tty_standard_install() and tty_port_install() to void type and remove unnecessary exception handling where we use these functions.
---
Changes in v2:
- Update commit title
- Squash other patches into one
https://lkml.org/lkml/2018/9/4/70
arch/um/drivers/line.c | 7 +------ drivers/isdn/capi/capi.c | 10 ++++------ drivers/isdn/i4l/isdn_tty.c | 3 ++- drivers/misc/pti.c | 28 +++++++++++++--------------- drivers/mmc/core/sdio_uart.c | 11 ++++------- drivers/s390/char/con3215.c | 3 ++- drivers/s390/char/tty3270.c | 7 +------ drivers/staging/fwserial/fwserial.c | 22 ++++++++-------------- drivers/staging/gdm724x/gdm_tty.c | 11 +++-------- drivers/staging/greybus/uart.c | 10 ++-------- drivers/tty/hvc/hvc_console.c | 7 ++----- drivers/tty/hvc/hvcs.c | 10 ++-------- drivers/tty/mips_ejtag_fdc.c | 4 +++- drivers/tty/n_gsm.c | 9 +-------- drivers/tty/nozomi.c | 8 +++----- drivers/tty/serial/kgdb_nmi.c | 11 +---------- drivers/tty/synclink.c | 3 ++- drivers/tty/synclinkmp.c | 3 ++- drivers/tty/tty_io.c | 10 ++++++---- drivers/tty/tty_port.c | 4 ++-- drivers/tty/vcc.c | 5 +---- drivers/tty/vt/vt.c | 5 +---- drivers/usb/class/cdc-acm.c | 10 +--------- drivers/usb/host/xhci-dbgtty.c | 3 ++- drivers/usb/serial/usb-serial.c | 6 +----- include/linux/tty.h | 4 ++-- net/bluetooth/rfcomm/tty.c | 7 +------ 27 files changed, 73 insertions(+), 148 deletions(-)
arch/um/drivers/line.c +1 -6
@@ -338,12 +338,7 @@ int line_open(struct tty_struct *tty, struct file *filp)int line_install (struct tty_driver *driver,struct tty_struct *tty,struct line *line) { -int ret; - - ret =tty_standard_install (driver, tty); -if (ret) -return ret; - +tty_standard_install (driver, tty); tty->driver_data = line;return 0 ;
drivers/isdn/capi/capi.c +4 -6
@@ -999,13 +999,11 @@ static int capinc_tty_install(struct tty_driver *driver, struct tty_struct *tty) { struct capiminor *mp = capiminor_get(tty->index); -int ret =tty_standard_install (driver, tty); -if (ret ==0 ) - tty->driver_data = mp; -else -capiminor_put (mp); -return ret; +tty_standard_install (driver, tty); + tty->driver_data = mp; + +return 0 ; }static void capinc_tty_cleanup (struct tty_struct *tty)
drivers/isdn/i4l/isdn_tty.c +2 -1
@@ -1481,8 +1481,9 @@ static int isdn_tty_install(struct tty_driver *driver, struct tty_struct *tty)return -ENODEV ; tty->driver_data = info; +tty_port_install (&info->port, driver, tty); -return tty_port_install (&info->port, driver, tty); +return 0 ; }/*
drivers/misc/pti.c +13 -15
@@ -462,26 +462,24 @@ static int pti_tty_install(struct tty_driver *driver, struct tty_struct *tty) {int idx = tty->index;struct pti_tty *pti_tty_data; -int ret =tty_standard_install (driver, tty); -if (ret ==0 ) { - pti_tty_data =kmalloc (sizeof (struct pti_tty ),GFP_KERNEL ); -if (pti_tty_data ==NULL ) -return -ENOMEM ; +tty_standard_install (driver, tty); + pti_tty_data =kmalloc (sizeof (struct pti_tty ),GFP_KERNEL ); +if (pti_tty_data ==NULL ) +return -ENOMEM ; -if (idx ==PTITTY_MINOR_START ) - pti_tty_data->mc =pti_request_masterchannel (0 ,NULL ); -else - pti_tty_data->mc =pti_request_masterchannel (2 ,NULL ); +if (idx ==PTITTY_MINOR_START ) + pti_tty_data->mc =pti_request_masterchannel (0 ,NULL ); +else + pti_tty_data->mc =pti_request_masterchannel (2 ,NULL ); -if (pti_tty_data->mc ==NULL ) { -kfree (pti_tty_data); -return -ENXIO ; - } - tty->driver_data = pti_tty_data; +if (pti_tty_data->mc ==NULL ) { +kfree (pti_tty_data); +return -ENXIO ; } + tty->driver_data = pti_tty_data; -return ret; +return 0 ; }/**
drivers/mmc/core/sdio_uart.c +4 -7
@@ -731,14 +731,11 @@ static int sdio_uart_install(struct tty_driver *driver, struct tty_struct *tty) {int idx = tty->index;struct sdio_uart_port *port =sdio_uart_port_get (idx); -int ret =tty_standard_install (driver, tty); -if (ret ==0 ) -/* This is the ref sdio_uart_port get provided */ - tty->driver_data = port; -else -sdio_uart_port_put (port); -return ret; +tty_standard_install (driver, tty); + tty->driver_data = port; + +return 0 ; }/**
drivers/s390/char/con3215.c +2 -1
@@ -965,8 +965,9 @@ static int tty3215_install(struct tty_driver *driver, struct tty_struct *tty)return -ENODEV ; tty->driver_data = raw; +tty_port_install (&raw->port, driver, tty); -return tty_port_install (&raw->port, driver, tty); +return 0 ; }/*
drivers/s390/char/tty3270.c +1 -6
@@ -1017,12 +1017,7 @@ static int tty3270_install(struct tty_driver *driver, struct tty_struct *tty)raw3270_activate_view (&tp->view); port_install: - rc =tty_port_install (&tp->port, driver, tty); -if (rc) { -raw3270_put_view (&tp->view); -return rc; - } - +tty_port_install (&tp->port, driver, tty); tty->driver_data = tp;return 0 ;
drivers/staging/fwserial/fwserial.c +8 -14
@@ -1064,27 +1064,21 @@ static void fwtty_cleanup(struct tty_struct *tty)static int fwtty_install (struct tty_driver *driver,struct tty_struct *tty) {struct fwtty_port *port =fwtty_port_get (tty->index); -int err; - err =tty_standard_install (driver, tty); -if (!err) - tty->driver_data = port; -else -fwtty_port_put (port); -return err; +tty_standard_install (driver, tty); + tty->driver_data = port; + +return 0 ; }static int fwloop_install (struct tty_driver *driver,struct tty_struct *tty) {struct fwtty_port *port =fwtty_port_get (table_idx (tty->index)); -int err; - err =tty_standard_install (driver, tty); -if (!err) - tty->driver_data = port; -else -fwtty_port_put (port); -return err; +tty_standard_install (driver, tty); + tty->driver_data = port; + +return 0 ; }static int fwtty_write (struct tty_struct *tty,const unsigned char *buf,int c)
drivers/staging/gdm724x/gdm_tty.c +3 -8
@@ -62,6 +62,7 @@ static int gdm_tty_install(struct tty_driver *driver, struct tty_struct *tty)return -ENODEV ;mutex_lock (&gdm_table_lock); + gdm = gdm_table[ret][tty->index];if (!gdm) {mutex_unlock (&gdm_table_lock);
@@ -69,15 +70,9 @@ static int gdm_tty_install(struct tty_driver *driver, struct tty_struct *tty) }tty_port_get (&gdm->port); - - ret =tty_standard_install (driver, tty); -if (ret) { -tty_port_put (&gdm->port); -mutex_unlock (&gdm_table_lock); -return ret; - } - +tty_standard_install (driver, tty); tty->driver_data = gdm; +mutex_unlock (&gdm_table_lock);return 0 ;
drivers/staging/greybus/uart.c +2 -8
@@ -393,21 +393,15 @@ static void release_minor(struct gb_tty *gb_tty)static int gb_tty_install (struct tty_driver *driver,struct tty_struct *tty) {struct gb_tty *gb_tty; -int retval; gb_tty =get_gb_by_minor (tty->index);if (!gb_tty)return -ENODEV ; - retval =tty_standard_install (driver, tty); -if (retval) - goto error; - +tty_standard_install (driver, tty); tty->driver_data = gb_tty; +return 0 ; -error: -tty_port_put (&gb_tty->port); -return retval; }static int gb_tty_open (struct tty_struct *tty,struct file *file)
drivers/tty/hvc/hvc_console.c +2 -5
@@ -329,7 +329,6 @@ static void hvc_unthrottle(struct tty_struct *tty)static int hvc_install (struct tty_driver *driver,struct tty_struct *tty) {struct hvc_struct *hp; -int rc;/* Auto increments kref reference if found. */ hp =hvc_get_by_index (tty->index);
@@ -337,11 +336,9 @@ static int hvc_install(struct tty_driver *driver, struct tty_struct *tty)return -ENODEV ; tty->driver_data = hp; +tty_port_install (&hp->port, driver, tty); - rc =tty_port_install (&hp->port, driver, tty); -if (rc) -tty_port_put (&hp->port); -return rc; +return 0 ; }/*
drivers/tty/hvc/hvcs.c +2 -8
@@ -1140,16 +1140,10 @@ static int hvcs_install(struct tty_driver *driver, struct tty_struct *tty) goto err_put; } - retval =tty_port_install (&hvcsd->port, driver, tty); -if (retval) - goto err_irq; +tty_port_install (&hvcsd->port, driver, tty);return 0 ; -err_irq: -spin_lock_irqsave (&hvcsd->lock, flags); -vio_disable_interrupts (hvcsd->vdev); -spin_unlock_irqrestore (&hvcsd->lock, flags); -free_irq (irq, hvcsd); + err_put:tty_port_put (&hvcsd->port);
drivers/tty/mips_ejtag_fdc.c +3 -1
@@ -763,7 +763,9 @@ static int mips_ejtag_fdc_tty_install(struct tty_driver *driver,struct mips_ejtag_fdc_tty *priv = driver->driver_state; tty->driver_data = &priv->ports[tty->index]; -return tty_port_install (&priv->ports[tty->index].port, driver, tty); +tty_port_install (&priv->ports[tty->index].port, driver, tty); + +return 0 ; }static int mips_ejtag_fdc_tty_open (struct tty_struct *tty,struct file *filp)
drivers/tty/n_gsm.c +1 -8
@@ -2917,7 +2917,6 @@ static int gsmtty_install(struct tty_driver *driver, struct tty_struct *tty)unsigned int line = tty->index;unsigned int mux = line >>6 ;bool alloc = false; -int ret; line = line &0x3F ;
@@ -2949,14 +2948,8 @@ static int gsmtty_install(struct tty_driver *driver, struct tty_struct *tty)mutex_unlock (&gsm->mutex);return -ENOMEM ; } - ret =tty_port_install (&dlci->port, driver, tty); -if (ret) { -if (alloc) -dlci_put (dlci); -mutex_unlock (&gsm->mutex); -return ret; - } +tty_port_install (&dlci->port, driver, tty);dlci_get (dlci);dlci_get (gsm->dlci[0 ]);mux_get (gsm);
drivers/tty/nozomi.c +3 -5
@@ -1555,13 +1555,11 @@ static int ntty_install(struct tty_driver *driver, struct tty_struct *tty) {struct port *port =get_port_by_tty (tty);struct nozomi *dc =get_dc_by_tty (tty); -int ret;if (!port || !dc || dc->state !=NOZOMI_STATE_READY )return -ENODEV ; - ret =tty_standard_install (driver, tty); -if (ret ==0 ) - tty->driver_data = port; -return ret; +tty_standard_install (driver, tty); + tty->driver_data = port; +return 0 ; }static void ntty_cleanup (struct tty_struct *tty)
drivers/tty/serial/kgdb_nmi.c +1 -10
@@ -234,7 +234,6 @@ static const struct tty_port_operations kgdb_nmi_tty_port_ops = {static int kgdb_nmi_tty_install (struct tty_driver *drv,struct tty_struct *tty) {struct kgdb_nmi_tty_priv *priv; -int ret; priv =kzalloc (sizeof (*priv),GFP_KERNEL );if (!priv)
@@ -245,17 +244,9 @@ static int kgdb_nmi_tty_install(struct tty_driver *drv, struct tty_struct *tty)tty_port_init (&priv->port); priv->port.ops = &kgdb_nmi_tty_port_ops; tty->driver_data = priv; +tty_port_install (&priv->port, drv, tty); - ret =tty_port_install (&priv->port, drv, tty); -if (ret) { -pr_err ("%s: can't install tty port: %d\n" , __func__, ret); - goto err; - }return 0 ; -err: -tty_port_destroy (&priv->port); -kfree (priv); -return ret; }static void kgdb_nmi_tty_cleanup (struct tty_struct *tty)
drivers/tty/synclink.c +2 -1
@@ -3355,8 +3355,9 @@ static int mgsl_install(struct tty_driver *driver, struct tty_struct *tty)if (mgsl_paranoia_check (info, tty->name,"mgsl_open" ))return -ENODEV ; tty->driver_data = info; +tty_port_install (&info->port, driver, tty); -return tty_port_install (&info->port, driver, tty); +return 0 ; }/* mgsl_open()
drivers/tty/synclinkmp.c +2 -1
@@ -734,8 +734,9 @@ static int install(struct tty_driver *driver, struct tty_struct *tty) } tty->driver_data = info; +tty_port_install (&info->port, driver, tty); -return tty_port_install (&info->port, driver, tty); +return 0 ; }/* Called when a port is opened. Init and enable port.
drivers/tty/tty_io.c +6 -4
@@ -1196,13 +1196,12 @@ void tty_init_termios(struct tty_struct *tty) }EXPORT_SYMBOL_GPL (tty_init_termios); -int tty_standard_install (struct tty_driver *driver,struct tty_struct *tty) +void tty_standard_install (struct tty_driver *driver,struct tty_struct *tty) {tty_init_termios (tty);tty_driver_kref_get (driver); tty->count++; driver->ttys[tty->index] = tty; -return 0 ; }EXPORT_SYMBOL_GPL (tty_standard_install);
@@ -1221,8 +1220,11 @@ EXPORT_SYMBOL_GPL(tty_standard_install);static int tty_driver_install_tty (struct tty_driver *driver,struct tty_struct *tty) { -return driver->ops->install ? driver->ops->install (driver, tty) : -tty_standard_install (driver, tty); +if (driver->ops->install) +return driver->ops->install (driver, tty); + +tty_standard_install (driver, tty); +return 0 ; }/**
drivers/tty/tty_port.c +2 -2
@@ -656,11 +656,11 @@ EXPORT_SYMBOL(tty_port_close);* to a concrete tty specified by @tty. Use this or tty_port_register_device * (or both). Call tty_port_link_device as a last resort. */ -int tty_port_install (struct tty_port *port,struct tty_driver *driver, +void tty_port_install (struct tty_port *port,struct tty_driver *driver,struct tty_struct *tty) { tty->port = port; -return tty_standard_install (driver, tty); +tty_standard_install (driver, tty); }EXPORT_SYMBOL_GPL (tty_port_install);
drivers/tty/vcc.c +1 -4
@@ -987,7 +987,6 @@ static int vcc_install(struct tty_driver *driver, struct tty_struct *tty) {struct vcc_port *port_vcc;struct tty_port *port_tty; -int ret;if (unlikely (!tty)) {pr_err ("VCC: install: Invalid TTY handle\n" );
@@ -997,9 +996,7 @@ static int vcc_install(struct tty_driver *driver, struct tty_struct *tty)if (tty->index >=VCC_MAX_PORTS )return -EINVAL ; - ret =tty_standard_install (driver, tty); -if (ret) -return ret; +tty_standard_install (driver, tty); port_tty =kzalloc (sizeof (struct tty_port ),GFP_KERNEL );if (!port_tty)
drivers/tty/vt/vt.c +1 -4
@@ -3222,10 +3222,7 @@ static int con_install(struct tty_driver *driver, struct tty_struct *tty) goto unlock; } - ret =tty_port_install (&vc->port, driver, tty); -if (ret) - goto unlock; - +tty_port_install (&vc->port, driver, tty); tty->driver_data = vc; vc->port.tty = tty;
drivers/usb/class/cdc-acm.c +1 -9
@@ -572,23 +572,15 @@ static void acm_softint(struct work_struct *work)static int acm_tty_install (struct tty_driver *driver,struct tty_struct *tty) {struct acm *acm; -int retval; acm =acm_get_by_minor (tty->index);if (!acm)return -ENODEV ; - retval =tty_standard_install (driver, tty); -if (retval) - goto error_init_termios; - +tty_standard_install (driver, tty); tty->driver_data = acm;return 0 ; - -error_init_termios: -tty_port_put (&acm->port); -return retval; }static int acm_tty_open (struct tty_struct *tty,struct file *filp)
drivers/usb/host/xhci-dbgtty.c +2 -1
@@ -174,8 +174,9 @@ static int dbc_tty_install(struct tty_driver *driver, struct tty_struct *tty)struct dbc_port *port = driver->driver_state; tty->driver_data = port; +tty_port_install (&port->port, driver, tty); -return tty_port_install (&port->port, driver, tty); +return 0 ; }static int dbc_tty_open (struct tty_struct *tty,struct file *file)
drivers/usb/serial/usb-serial.c +1 -5
@@ -192,9 +192,7 @@ static int serial_install(struct tty_driver *driver, struct tty_struct *tty)if (retval) goto error_get_interface; - retval =tty_standard_install (driver, tty); -if (retval) - goto error_init_termios; +tty_standard_install (driver, tty);mutex_unlock (&serial->disc_mutex);
@@ -206,8 +204,6 @@ static int serial_install(struct tty_driver *driver, struct tty_struct *tty)return retval; - error_init_termios: -usb_autopm_put_interface (serial->interface); error_get_interface:module_put (serial->type->driver.owner); error_module_get:
include/linux/tty.h +2 -2
@@ -556,7 +556,7 @@ extern struct tty_struct *tty_init_dev(struct tty_driver *driver, int idx);extern void tty_release_struct (struct tty_struct *tty,int idx);extern int tty_release (struct inode *inode,struct file *filp);extern void tty_init_termios (struct tty_struct *tty); -extern int tty_standard_install (struct tty_driver *driver, +extern void tty_standard_install (struct tty_driver *driver,struct tty_struct *tty);extern struct mutex tty_mutex;
@@ -688,7 +688,7 @@ extern int tty_port_close_start(struct tty_port *port,extern void tty_port_close_end (struct tty_port *port,struct tty_struct *tty);extern void tty_port_close (struct tty_port *port,struct tty_struct *tty,struct file *filp); -extern int tty_port_install (struct tty_port *port,struct tty_driver *driver, +extern void tty_port_install (struct tty_port *port,struct tty_driver *driver,struct tty_struct *tty);extern int tty_port_open (struct tty_port *port,struct tty_struct *tty,struct file *filp);
net/bluetooth/rfcomm/tty.c +1 -6
@@ -710,7 +710,6 @@ static int rfcomm_tty_install(struct tty_driver *driver, struct tty_struct *tty) {struct rfcomm_dev *dev;struct rfcomm_dlc *dlc; -int err; dev =rfcomm_dev_get (tty->index);if (!dev)
@@ -725,11 +724,7 @@ static int rfcomm_tty_install(struct tty_driver *driver, struct tty_struct *tty)set_bit (RFCOMM_TTY_ATTACHED , &dev->flags);/* install the tty_port */ - err =tty_port_install (&dev->port, driver, tty); -if (err) { -rfcomm_tty_cleanup (tty); -return err; - } +tty_port_install (&dev->port, driver, tty);/* take over the tty_port reference if the port was created with the * flag RFCOMM_RELEASE_ONHUP. This will force the release of the port
Signature · 1 line
2.7.4
Please ignore this patch. I will drop this V2 and will be update with V3 which is made by seperate.
Sorry for the noisy again.
BR.
Jaejoong
Quoted 728 lines · Jaejoong Kim
Many drivers with tty use the
tty_stand_install(). But, there is no need to handle the error, since it always returns 0. So, change the return type oftty_standard_install()andtty_port_install()to void type and remove unnecessary exception handling where we use these functions.Signed-off-by Jaejoong Kim <[email protected]>---
Changes in v2:
- Update commit title
- Squash other patches into one
https://lkml.org/lkml/2018/9/4/70arch/um/drivers/line.c | 7 +------ drivers/isdn/capi/capi.c | 10 ++++------ drivers/isdn/i4l/isdn_tty.c | 3 ++- drivers/misc/pti.c | 28 +++++++++++++--------------- drivers/mmc/core/sdio_uart.c | 11 ++++------- drivers/s390/char/con3215.c | 3 ++- drivers/s390/char/tty3270.c | 7 +------ drivers/staging/fwserial/fwserial.c | 22 ++++++++-------------- drivers/staging/gdm724x/gdm_tty.c | 11 +++-------- drivers/staging/greybus/uart.c | 10 ++-------- drivers/tty/hvc/hvc_console.c | 7 ++----- drivers/tty/hvc/hvcs.c | 10 ++-------- drivers/tty/mips_ejtag_fdc.c | 4 +++- drivers/tty/n_gsm.c | 9 +-------- drivers/tty/nozomi.c | 8 +++----- drivers/tty/serial/kgdb_nmi.c | 11 +---------- drivers/tty/synclink.c | 3 ++- drivers/tty/synclinkmp.c | 3 ++- drivers/tty/tty_io.c | 10 ++++++---- drivers/tty/tty_port.c | 4 ++-- drivers/tty/vcc.c | 5 +---- drivers/tty/vt/vt.c | 5 +---- drivers/usb/class/cdc-acm.c | 10 +--------- drivers/usb/host/xhci-dbgtty.c | 3 ++- drivers/usb/serial/usb-serial.c | 6 +----- include/linux/tty.h | 4 ++-- net/bluetooth/rfcomm/tty.c | 7 +------ 27 files changed, 73 insertions(+), 148 deletions(-)arch/um/drivers/line.c +1
-6@@ -338,12 +338,7 @@ int line_open(struct tty_struct *tty, struct file *filp)int line_install (struct tty_driver *driver,struct tty_struct *tty,struct line *line) { -int ret; - - ret =tty_standard_install (driver, tty); -if (ret) -return ret; - +tty_standard_install (driver, tty); tty->driver_data = line;return 0;drivers/isdn/capi/capi.c +4
-6@@ -999,13 +999,11 @@ static int capinc_tty_install(struct tty_driver *driver, struct tty_struct *tty) { struct capiminor *mp = capiminor_get(tty->index); -int ret =tty_standard_install (driver, tty); -if (ret ==0 ) - tty->driver_data = mp; -else -capiminor_put (mp); -return ret; +tty_standard_install (driver, tty); + tty->driver_data = mp; + +return 0 ; }static void capinc_tty_cleanup (struct tty_struct *tty)drivers/isdn/i4l/isdn_tty.c +2
-1@@ -1481,8 +1481,9 @@ static int isdn_tty_install(struct tty_driver *driver, struct tty_struct *tty)return -ENODEV ; tty->driver_data = info; +tty_port_install (&info->port, driver, tty); -return tty_port_install (&info->port, driver, tty); +return 0 ; }/*
drivers/misc/pti.c +13
-15@@ -462,26 +462,24 @@ static int pti_tty_install(struct tty_driver *driver, struct tty_struct *tty) {int idx = tty->index;struct pti_tty *pti_tty_data; -int ret =tty_standard_install (driver, tty); -if (ret ==0 ) { - pti_tty_data =kmalloc (sizeof (struct pti_tty ),GFP_KERNEL ); -if (pti_tty_data ==NULL ) -return -ENOMEM ; +tty_standard_install (driver, tty); + pti_tty_data =kmalloc (sizeof (struct pti_tty ),GFP_KERNEL ); +if (pti_tty_data ==NULL ) +return -ENOMEM ; -if (idx ==PTITTY_MINOR_START ) - pti_tty_data->mc =pti_request_masterchannel (0 , NULL); -else - pti_tty_data->mc =pti_request_masterchannel (2 , NULL); +if (idx ==PTITTY_MINOR_START ) + pti_tty_data->mc =pti_request_masterchannel (0 ,NULL ); +else + pti_tty_data->mc =pti_request_masterchannel (2 ,NULL ); -if (pti_tty_data->mc ==NULL ) { -kfree (pti_tty_data); -return -ENXIO ; - } - tty->driver_data = pti_tty_data; +if (pti_tty_data->mc ==NULL ) { +kfree (pti_tty_data); +return -ENXIO ; } + tty->driver_data = pti_tty_data; -return ret; +return 0 ;}
/**
drivers/mmc/core/sdio_uart.c +4
-7@@ -731,14 +731,11 @@ static int sdio_uart_install(struct tty_driver *driver, struct tty_struct *tty) {int idx = tty->index;struct sdio_uart_port *port =sdio_uart_port_get (idx); -int ret =tty_standard_install (driver, tty); -if (ret ==0 ) -/* This is the ref sdio_uart_port get provided */ - tty->driver_data = port; -else -sdio_uart_port_put (port); -return ret; +tty_standard_install (driver, tty); + tty->driver_data = port; + +return 0 ; }/**
drivers/s390/char/con3215.c +2
-1@@ -965,8 +965,9 @@ static int tty3215_install(struct tty_driver *driver, struct tty_struct *tty)return -ENODEV ; tty->driver_data = raw; +tty_port_install (&raw->port, driver, tty); -return tty_port_install (&raw->port, driver, tty); +return 0 ; }/*
drivers/s390/char/tty3270.c +1
-6@@ -1017,12 +1017,7 @@ static int tty3270_install(struct tty_driver *driver, struct tty_struct *tty)raw3270_activate_view (&tp->view); port_install: - rc =tty_port_install (&tp->port, driver, tty); -if (rc) { -raw3270_put_view (&tp->view); -return rc; - } - +tty_port_install (&tp->port, driver, tty); tty->driver_data = tp;return 0;drivers/staging/fwserial/fwserial.c +8
-14@@ -1064,27 +1064,21 @@ static void fwtty_cleanup(struct tty_struct *tty)static int fwtty_install (struct tty_driver *driver,struct tty_struct *tty) {struct fwtty_port *port =fwtty_port_get (tty->index); -int err; - err =tty_standard_install (driver, tty); -if (!err) - tty->driver_data = port; -else -fwtty_port_put (port); -return err; +tty_standard_install (driver, tty); + tty->driver_data = port; + +return 0 ; }static int fwloop_install (struct tty_driver *driver,struct tty_struct *tty) {struct fwtty_port *port =fwtty_port_get (table_idx (tty->index)); -int err; - err =tty_standard_install (driver, tty); -if (!err) - tty->driver_data = port; -else -fwtty_port_put (port); -return err; +tty_standard_install (driver, tty); + tty->driver_data = port; + +return 0 ; }static int fwtty_write(struct
tty_struct*tty, const unsigned char *buf,
int c)drivers/staging/gdm724x/gdm_tty.c +1
-0@@ -62,6 +62,7 @@ static int gdm_tty_install(struct tty_driver *driver, struct tty_struct *tty)return -ENODEV ;mutex_lock (&gdm_table_lock); + gdm = gdm_table[ret][tty->index];if (!gdm) {mutex_unlock(&gdm_table_lock);drivers/staging/gdm724x/gdm_tty.c +2
-8@@ -69,15 +70,9 @@ static int gdm_tty_install(struct tty_driver *driver, struct tty_struct *tty) }tty_port_get (&gdm->port); - - ret =tty_standard_install (driver, tty); -if (ret) { -tty_port_put (&gdm->port); -mutex_unlock (&gdm_table_lock); -return ret; - } - +tty_standard_install (driver, tty); tty->driver_data = gdm; +mutex_unlock (&gdm_table_lock);return 0;drivers/staging/greybus/uart.c +2
-8@@ -393,21 +393,15 @@ static void release_minor(struct gb_tty *gb_tty)static int gb_tty_install (struct tty_driver *driver,struct tty_struct *tty) {struct gb_tty *gb_tty; -int retval; gb_tty =get_gb_by_minor (tty->index);if (!gb_tty)return -ENODEV ; - retval =tty_standard_install (driver, tty); -if (retval) - goto error; - +tty_standard_install (driver, tty); tty->driver_data = gb_tty; +return 0 ; -error: -tty_port_put (&gb_tty->port); -return retval; }static int
gb_tty_open(struct tty_struct *tty, struct file *file)drivers/tty/hvc/hvc_console.c +2
-5@@ -329,7 +329,6 @@ static void hvc_unthrottle(struct tty_struct *tty)static int hvc_install (struct tty_driver *driver,struct tty_struct *tty) {struct hvc_struct *hp; -int rc;/* Auto increments kref reference if found. */ hp =hvc_get_by_index (tty->index);@@ -337,11 +336,9 @@ static int hvc_install(struct tty_driver *driver, struct tty_struct *tty)return -ENODEV ; tty->driver_data = hp; +tty_port_install (&hp->port, driver, tty); - rc =tty_port_install (&hp->port, driver, tty); -if (rc) -tty_port_put (&hp->port); -return rc; +return 0 ; }/*
drivers/tty/hvc/hvcs.c +2
-8@@ -1140,16 +1140,10 @@ static int hvcs_install(struct tty_driver *driver, struct tty_struct *tty) goto err_put; } - retval =tty_port_install (&hvcsd->port, driver, tty); -if (retval) - goto err_irq; +tty_port_install (&hvcsd->port, driver, tty);return 0 ; -err_irq: -spin_lock_irqsave (&hvcsd->lock, flags); -vio_disable_interrupts (hvcsd->vdev); -spin_unlock_irqrestore (&hvcsd->lock, flags); -free_irq (irq, hvcsd); + err_put:tty_port_put (&hvcsd->port);drivers/tty/mips_ejtag_fdc.c +3
-1@@ -763,7 +763,9 @@ static int mips_ejtag_fdc_tty_install(structtty_driver *driver, struct mips_ejtag_fdc_tty *priv = driver->driver_state; tty->driver_data = &priv->ports[tty->index]; -return tty_port_install (&priv->ports[tty->index].port, driver, tty); +tty_port_install (&priv->ports[tty->index].port, driver, tty); + +return 0 ; }static int mips_ejtag_fdc_tty_open(struct
tty_struct*tty, struct file
*filp)drivers/tty/n_gsm.c +1
-8@@ -2917,7 +2917,6 @@ static int gsmtty_install(struct tty_driver *driver, struct tty_struct *tty)unsigned int line = tty->index;unsigned int mux = line >>6 ;bool alloc = false; -int ret; line = line &0x3F ;@@ -2949,14 +2948,8 @@ static int gsmtty_install(struct tty_driver *driver, struct tty_struct *tty)mutex_unlock (&gsm->mutex);return -ENOMEM ; } - ret =tty_port_install (&dlci->port, driver, tty); -if (ret) { -if (alloc) -dlci_put (dlci); -mutex_unlock (&gsm->mutex); -return ret; - } +tty_port_install (&dlci->port, driver, tty);dlci_get (dlci);dlci_get (gsm->dlci[0 ]);mux_get(gsm);drivers/tty/nozomi.c +3
-5@@ -1555,13 +1555,11 @@ static int ntty_install(struct tty_driver *driver, struct tty_struct *tty) {struct port *port =get_port_by_tty (tty);struct nozomi *dc =get_dc_by_tty (tty); -int ret;if (!port || !dc || dc->state !=NOZOMI_STATE_READY )return -ENODEV ; - ret =tty_standard_install (driver, tty); -if (ret ==0 ) - tty->driver_data = port; -return ret; +tty_standard_install (driver, tty); + tty->driver_data = port; +return 0 ; }static void
ntty_cleanup(struct tty_struct *tty)drivers/tty/serial/kgdb_nmi.c +0
-1@@ -234,7 +234,6 @@ static const struct tty_port_operations kgdb_nmi_tty_port_ops = {static int kgdb_nmi_tty_install (struct tty_driver *drv,struct tty_struct *tty) {struct kgdb_nmi_tty_priv *priv; -int ret;priv = kzalloc(sizeof(*priv), GFP_KERNEL); if (!priv)drivers/tty/serial/kgdb_nmi.c +1
-9@@ -245,17 +244,9 @@ static int kgdb_nmi_tty_install(struct tty_driver *drv, struct tty_struct *tty)tty_port_init (&priv->port); priv->port.ops = &kgdb_nmi_tty_port_ops; tty->driver_data = priv; +tty_port_install (&priv->port, drv, tty); - ret =tty_port_install (&priv->port, drv, tty); -if (ret) { -pr_err ("%s: can't install tty port: %d\n" , __func__, ret); - goto err; - }return 0 ; -err: -tty_port_destroy (&priv->port); -kfree (priv); -return ret; }static void
kgdb_nmi_tty_cleanup(struct tty_struct *tty)drivers/tty/synclink.c +2
-1@@ -3355,8 +3355,9 @@ static int mgsl_install(struct tty_driver *driver, struct tty_struct *tty)if (mgsl_paranoia_check (info, tty->name,"mgsl_open" ))return -ENODEV ; tty->driver_data = info; +tty_port_install (&info->port, driver, tty); -return tty_port_install (&info->port, driver, tty); +return 0 ; }/*
mgsl_open()drivers/tty/synclinkmp.c +2
-1@@ -734,8 +734,9 @@ static int install(struct tty_driver *driver, struct tty_struct *tty) } tty->driver_data = info; +tty_port_install (&info->port, driver, tty); -return tty_port_install (&info->port, driver, tty); +return 0 ; }/* Called when a port is opened. Init and enable port.
drivers/tty/tty_io.c +1
-2@@ -1196,13 +1196,12 @@ void tty_init_termios(struct tty_struct *tty) }EXPORT_SYMBOL_GPL (tty_init_termios); -int tty_standard_install (struct tty_driver *driver,struct tty_struct *tty) +void tty_standard_install (struct tty_driver *driver,struct tty_struct *tty) {tty_init_termios (tty);tty_driver_kref_get (driver); tty->count++; driver->ttys[tty->index] = tty; -return 0 ; }
EXPORT_SYMBOL_GPL(tty_standard_install);drivers/tty/tty_io.c +5
-2@@ -1221,8 +1220,11 @@ EXPORT_SYMBOL_GPL(tty_standard_install);static int tty_driver_install_tty (struct tty_driver *driver,struct tty_struct *tty) { -return driver->ops->install ? driver->ops->install (driver, tty) : -tty_standard_install (driver, tty); +if (driver->ops->install) +return driver->ops->install (driver, tty); + +tty_standard_install (driver, tty); +return 0 ; }/** drivers/tty/tty_port.c +0
-0@@ -656,11 +656,11 @@ EXPORT_SYMBOL(tty_port_close);* to a concrete tty specified by @tty. Use this or
tty_port_register_device
* (or both). Calltty_port_link_deviceas a last resort. */drivers/tty/tty_port.c +2
-2-int tty_port_install (struct tty_port *port,struct tty_driver *driver, +void tty_port_install (struct tty_port *port,struct tty_driver *driver,struct tty_struct *tty) { tty->port = port; -return tty_standard_install (driver, tty); +tty_standard_install (driver, tty); }EXPORT_SYMBOL_GPL (tty_port_install);drivers/tty/vcc.c +0
-1@@ -987,7 +987,6 @@ static int vcc_install(struct tty_driver *driver, struct tty_struct *tty) {struct vcc_port *port_vcc;struct tty_port *port_tty; -int ret;if (unlikely (!tty)) {pr_err("VCC: install: Invalid TTY handle\n");drivers/tty/vcc.c +1
-3@@ -997,9 +996,7 @@ static int vcc_install(struct tty_driver *driver, struct tty_struct *tty)if (tty->index >=VCC_MAX_PORTS )return -EINVAL ; - ret =tty_standard_install (driver, tty); -if (ret) -return ret; +tty_standard_install (driver, tty); port_tty =kzalloc (sizeof (struct tty_port ),GFP_KERNEL );if (!port_tty)drivers/tty/vt/vt.c +1
-4@@ -3222,10 +3222,7 @@ static int con_install(struct tty_driver *driver, struct tty_struct *tty) goto unlock; } - ret =tty_port_install (&vc->port, driver, tty); -if (ret) - goto unlock; - +tty_port_install (&vc->port, driver, tty); tty->driver_data = vc; vc->port.tty = tty;drivers/usb/class/cdc-acm.c +1
-9@@ -572,23 +572,15 @@ static void acm_softint(struct work_struct *work)static int acm_tty_install (struct tty_driver *driver,struct tty_struct *tty) {struct acm *acm; -int retval; acm =acm_get_by_minor (tty->index);if (!acm)return -ENODEV ; - retval =tty_standard_install (driver, tty); -if (retval) - goto error_init_termios; - +tty_standard_install (driver, tty); tty->driver_data = acm;return 0 ; - -error_init_termios: -tty_port_put (&acm->port); -return retval; }static int
acm_tty_open(struct tty_struct *tty, struct file *filp)drivers/usb/host/xhci-dbgtty.c +2
-1@@ -174,8 +174,9 @@ static int dbc_tty_install(struct tty_driver *driver, struct tty_struct *tty)struct dbc_port *port = driver->driver_state; tty->driver_data = port; +tty_port_install (&port->port, driver, tty); -return tty_port_install (&port->port, driver, tty); +return 0 ; }static int
dbc_tty_open(struct tty_struct *tty, struct file *file)drivers/usb/serial/usb-serial.c +1
-5@@ -192,9 +192,7 @@ static int serial_install(struct tty_driver *driver, struct tty_struct *tty)if (retval) goto error_get_interface; - retval =tty_standard_install (driver, tty); -if (retval) - goto error_init_termios; +tty_standard_install (driver, tty);mutex_unlock (&serial->disc_mutex);@@ -206,8 +204,6 @@ static int serial_install(struct tty_driver *driver, struct tty_struct *tty)return retval; - error_init_termios: -usb_autopm_put_interface (serial->interface); error_get_interface:module_put (serial->type->driver.owner);
error_module_get:include/linux/tty.h +1
-1@@ -556,7 +556,7 @@ extern struct tty_struct *tty_init_dev(struct tty_driver *driver, int idx);extern void tty_release_struct (struct tty_struct *tty,int idx);extern int tty_release (struct inode *inode,struct file *filp);extern void tty_init_termios (struct tty_struct *tty); -extern int tty_standard_install (struct tty_driver *driver, +extern void tty_standard_install (struct tty_driver *driver,struct tty_struct *tty);extern struct mutex
tty_mutex;include/linux/tty.h +1
-1@@ -688,7 +688,7 @@ extern int tty_port_close_start(struct tty_port *port,extern void tty_port_close_end (struct tty_port *port,struct tty_struct *tty);extern void tty_port_close (struct tty_port *port,struct tty_struct *tty,struct file *filp); -extern int tty_port_install(struct tty_port *port, struct tty_driver *driver, +extern void tty_port_install(struct tty_port *port, struct tty_driver *driver,struct tty_struct *tty); extern int tty_port_open(struct tty_port *port, struct tty_struct *tty, struct file *filp);net/bluetooth/rfcomm/tty.c +0
-1@@ -710,7 +710,6 @@ static int rfcomm_tty_install(struct tty_driver *driver, struct tty_struct *tty) {struct rfcomm_dev *dev;struct rfcomm_dlc *dlc; -int err; dev =rfcomm_dev_get (tty->index);if (!dev)net/bluetooth/rfcomm/tty.c +1
-5@@ -725,11 +724,7 @@ static int rfcomm_tty_install(struct tty_driver *driver, struct tty_struct *tty)set_bit (RFCOMM_TTY_ATTACHED , &dev->flags);/* install the tty_port */ - err =tty_port_install (&dev->port, driver, tty); -if (err) { -rfcomm_tty_cleanup (tty); -return err; - } +tty_port_install (&dev->port, driver, tty);/* take over the tty_port reference if the port was created with the
* flagRFCOMM_RELEASE_ONHUP. This will force the release of the
port
--
2.7.4