Skip to content

Commit

Permalink
tty: drop put_tty_driver
Browse files Browse the repository at this point in the history
put_tty_driver() is an alias for tty_driver_kref_put(). There is no need
for two exported identical functions, therefore switch all users of
old put_tty_driver() to new tty_driver_kref_put() and remove the former
for good.

Cc: Richard Henderson <[email protected]>
Cc: Ivan Kokshaysky <[email protected]>
Cc: Matt Turner <[email protected]>
Cc: Geert Uytterhoeven <[email protected]>
Cc: Jeff Dike <[email protected]>
Cc: Richard Weinberger <[email protected]>
Cc: Anton Ivanov <[email protected]>
Cc: Chris Zankel <[email protected]>
Cc: Max Filippov <[email protected]>
Cc: Arnd Bergmann <[email protected]>
Cc: Greg Kroah-Hartman <[email protected]>
Cc: Samuel Iglesias Gonsalvez <[email protected]>
Cc: Jens Taprogge <[email protected]>
Cc: Karsten Keil <[email protected]>
Cc: Scott Branden <[email protected]>
Cc: Ulf Hansson <[email protected]>
Cc: "David S. Miller" <[email protected]>
Cc: Jakub Kicinski <[email protected]>
Cc: Heiko Carstens <[email protected]>
Cc: Vasily Gorbik <[email protected]>
Cc: Christian Borntraeger <[email protected]>
Cc: David Lin <[email protected]>
Cc: Johan Hovold <[email protected]>
Cc: Alex Elder <[email protected]>
Cc: Jiri Slaby <[email protected]>
Cc: Laurentiu Tudor <[email protected]>
Cc: Jiri Kosina <[email protected]>
Cc: David Sterba <[email protected]>
Cc: Shawn Guo <[email protected]>
Cc: Sascha Hauer <[email protected]>
Cc: Pengutronix Kernel Team <[email protected]>
Cc: Fabio Estevam <[email protected]>
Cc: NXP Linux Team <[email protected]>
Cc: Oliver Neukum <[email protected]>
Cc: Felipe Balbi <[email protected]>
Cc: Mathias Nyman <[email protected]>
Cc: Marcel Holtmann <[email protected]>
Cc: Johan Hedberg <[email protected]>
Cc: Luiz Augusto von Dentz <[email protected]>
Acked-by: Alex Elder <[email protected]>
Acked-by: Christian Borntraeger <[email protected]>
Acked-by: Max Filippov <[email protected]>
Acked-by: David Sterba <[email protected]>
Acked-by: Samuel Iglesias Gonsálvez <[email protected]>
Signed-off-by: Jiri Slaby <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Greg Kroah-Hartman <[email protected]>
  • Loading branch information
Jiri Slaby authored and gregkh committed Jul 27, 2021
1 parent cb9ea61 commit 9f90a4d
Show file tree
Hide file tree
Showing 41 changed files with 82 additions and 89 deletions.
2 changes: 1 addition & 1 deletion arch/alpha/kernel/srmcons.c
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ srmcons_init(void)
tty_port_link_device(&srmcons_singleton.port, driver, 0);
err = tty_register_driver(driver);
if (err) {
put_tty_driver(driver);
tty_driver_kref_put(driver);
tty_port_destroy(&srmcons_singleton.port);
return err;
}
Expand Down
4 changes: 2 additions & 2 deletions arch/m68k/emu/nfcon.c
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ static int __init nfcon_init(void)
res = tty_register_driver(driver);
if (res) {
pr_err("failed to register nfcon tty driver\n");
put_tty_driver(driver);
tty_driver_kref_put(driver);
tty_port_destroy(&nfcon_tty_port);
return res;
}
Expand All @@ -161,7 +161,7 @@ static void __exit nfcon_exit(void)
{
unregister_console(&nf_console);
tty_unregister_driver(nfcon_tty_driver);
put_tty_driver(nfcon_tty_driver);
tty_driver_kref_put(nfcon_tty_driver);
tty_port_destroy(&nfcon_tty_port);
}

Expand Down
2 changes: 1 addition & 1 deletion arch/um/drivers/line.c
Original file line number Diff line number Diff line change
Expand Up @@ -568,7 +568,7 @@ int register_lines(struct line_driver *line_driver,
if (err) {
printk(KERN_ERR "register_lines : can't register %s driver\n",
line_driver->name);
put_tty_driver(driver);
tty_driver_kref_put(driver);
for (i = 0; i < nlines; i++)
tty_port_destroy(&lines[i].port);
return err;
Expand Down
2 changes: 1 addition & 1 deletion arch/xtensa/platforms/iss/console.c
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ static int __init rs_init(void)
static __exit void rs_exit(void)
{
tty_unregister_driver(serial_driver);
put_tty_driver(serial_driver);
tty_driver_kref_put(serial_driver);
tty_port_destroy(&serial_port);
}

Expand Down
4 changes: 2 additions & 2 deletions drivers/char/pcmcia/synclink_cs.c
Original file line number Diff line number Diff line change
Expand Up @@ -2841,7 +2841,7 @@ static int __init synclink_cs_init(void)
err_unreg_tty:
tty_unregister_driver(serial_driver);
err_put_tty:
put_tty_driver(serial_driver);
tty_driver_kref_put(serial_driver);
err:
return rc;
}
Expand All @@ -2850,7 +2850,7 @@ static void __exit synclink_cs_exit(void)
{
pcmcia_unregister_driver(&mgslpc_driver);
tty_unregister_driver(serial_driver);
put_tty_driver(serial_driver);
tty_driver_kref_put(serial_driver);
}

module_init(synclink_cs_init);
Expand Down
4 changes: 2 additions & 2 deletions drivers/char/ttyprintk.c
Original file line number Diff line number Diff line change
Expand Up @@ -198,15 +198,15 @@ static int __init ttyprintk_init(void)
return 0;

error:
put_tty_driver(ttyprintk_driver);
tty_driver_kref_put(ttyprintk_driver);
tty_port_destroy(&tpk_port.port);
return ret;
}

static void __exit ttyprintk_exit(void)
{
tty_unregister_driver(ttyprintk_driver);
put_tty_driver(ttyprintk_driver);
tty_driver_kref_put(ttyprintk_driver);
tty_port_destroy(&tpk_port.port);
}

Expand Down
4 changes: 2 additions & 2 deletions drivers/ipack/devices/ipoctal.c
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ static int ipoctal_inst_slot(struct ipoctal *ipoctal, unsigned int bus_nr,
res = tty_register_driver(tty);
if (res) {
dev_err(&ipoctal->dev->dev, "Can't register tty driver.\n");
put_tty_driver(tty);
tty_driver_kref_put(tty);
return res;
}

Expand Down Expand Up @@ -696,7 +696,7 @@ static void __ipoctal_remove(struct ipoctal *ipoctal)
}

tty_unregister_driver(ipoctal->tty_drv);
put_tty_driver(ipoctal->tty_drv);
tty_driver_kref_put(ipoctal->tty_drv);
kfree(ipoctal);
}

Expand Down
4 changes: 2 additions & 2 deletions drivers/isdn/capi/capi.c
Original file line number Diff line number Diff line change
Expand Up @@ -1290,7 +1290,7 @@ static int __init capinc_tty_init(void)

err = tty_register_driver(drv);
if (err) {
put_tty_driver(drv);
tty_driver_kref_put(drv);
kfree(capiminors);
printk(KERN_ERR "Couldn't register capi_nc driver\n");
return err;
Expand All @@ -1302,7 +1302,7 @@ static int __init capinc_tty_init(void)
static void __exit capinc_tty_exit(void)
{
tty_unregister_driver(capinc_tty_driver);
put_tty_driver(capinc_tty_driver);
tty_driver_kref_put(capinc_tty_driver);
kfree(capiminors);
}

Expand Down
8 changes: 4 additions & 4 deletions drivers/misc/bcm-vk/bcm_vk_tty.c
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ int bcm_vk_tty_init(struct bcm_vk *vk, char *name)
tty_drv->name = kstrdup(name, GFP_KERNEL);
if (!tty_drv->name) {
err = -ENOMEM;
goto err_put_tty_driver;
goto err_tty_driver_kref_put;
}
tty_drv->type = TTY_DRIVER_TYPE_SERIAL;
tty_drv->subtype = SERIAL_TYPE_NORMAL;
Expand Down Expand Up @@ -295,8 +295,8 @@ int bcm_vk_tty_init(struct bcm_vk *vk, char *name)
kfree(tty_drv->name);
tty_drv->name = NULL;

err_put_tty_driver:
put_tty_driver(tty_drv);
err_tty_driver_kref_put:
tty_driver_kref_put(tty_drv);

return err;
}
Expand All @@ -317,7 +317,7 @@ void bcm_vk_tty_exit(struct bcm_vk *vk)
kfree(vk->tty_drv->name);
vk->tty_drv->name = NULL;

put_tty_driver(vk->tty_drv);
tty_driver_kref_put(vk->tty_drv);
}

void bcm_vk_tty_terminate_tty_user(struct bcm_vk *vk)
Expand Down
4 changes: 2 additions & 2 deletions drivers/mmc/core/sdio_uart.c
Original file line number Diff line number Diff line change
Expand Up @@ -1165,15 +1165,15 @@ static int __init sdio_uart_init(void)
err2:
tty_unregister_driver(tty_drv);
err1:
put_tty_driver(tty_drv);
tty_driver_kref_put(tty_drv);
return ret;
}

static void __exit sdio_uart_exit(void)
{
sdio_unregister_driver(&sdio_uart_driver);
tty_unregister_driver(sdio_uart_tty_driver);
put_tty_driver(sdio_uart_tty_driver);
tty_driver_kref_put(sdio_uart_tty_driver);
}

module_init(sdio_uart_init);
Expand Down
4 changes: 2 additions & 2 deletions drivers/net/usb/hso.c
Original file line number Diff line number Diff line change
Expand Up @@ -3269,7 +3269,7 @@ static int __init hso_init(void)
err_unreg_tty:
tty_unregister_driver(tty_drv);
err_free_tty:
put_tty_driver(tty_drv);
tty_driver_kref_put(tty_drv);
return result;
}

Expand All @@ -3280,7 +3280,7 @@ static void __exit hso_exit(void)
tty_unregister_driver(tty_drv);
/* deregister the usb driver */
usb_deregister(&hso_driver);
put_tty_driver(tty_drv);
tty_driver_kref_put(tty_drv);
}

/* Module definitions */
Expand Down
4 changes: 2 additions & 2 deletions drivers/s390/char/con3215.c
Original file line number Diff line number Diff line change
Expand Up @@ -1082,7 +1082,7 @@ static int __init tty3215_init(void)

ret = ccw_driver_register(&raw3215_ccw_driver);
if (ret) {
put_tty_driver(driver);
tty_driver_kref_put(driver);
return ret;
}
/*
Expand All @@ -1104,7 +1104,7 @@ static int __init tty3215_init(void)
tty_set_operations(driver, &tty3215_ops);
ret = tty_register_driver(driver);
if (ret) {
put_tty_driver(driver);
tty_driver_kref_put(driver);
return ret;
}
tty3215_driver = driver;
Expand Down
8 changes: 4 additions & 4 deletions drivers/s390/char/sclp_tty.c
Original file line number Diff line number Diff line change
Expand Up @@ -509,14 +509,14 @@ sclp_tty_init(void)

rc = sclp_rw_init();
if (rc) {
put_tty_driver(driver);
tty_driver_kref_put(driver);
return rc;
}
/* Allocate pages for output buffering */
for (i = 0; i < MAX_KMEM_PAGES; i++) {
page = (void *) get_zeroed_page(GFP_KERNEL | GFP_DMA);
if (page == NULL) {
put_tty_driver(driver);
tty_driver_kref_put(driver);
return -ENOMEM;
}
list_add_tail((struct list_head *) page, &sclp_tty_pages);
Expand All @@ -532,7 +532,7 @@ sclp_tty_init(void)

rc = sclp_register(&sclp_input_event);
if (rc) {
put_tty_driver(driver);
tty_driver_kref_put(driver);
return rc;
}

Expand All @@ -552,7 +552,7 @@ sclp_tty_init(void)
tty_port_link_device(&sclp_port, driver, 0);
rc = tty_register_driver(driver);
if (rc) {
put_tty_driver(driver);
tty_driver_kref_put(driver);
tty_port_destroy(&sclp_port);
return rc;
}
Expand Down
2 changes: 1 addition & 1 deletion drivers/s390/char/sclp_vt220.c
Original file line number Diff line number Diff line change
Expand Up @@ -763,7 +763,7 @@ static int __init sclp_vt220_tty_init(void)
out_init:
__sclp_vt220_cleanup();
out_driver:
put_tty_driver(driver);
tty_driver_kref_put(driver);
return rc;
}
__initcall(sclp_vt220_tty_init);
Expand Down
4 changes: 2 additions & 2 deletions drivers/s390/char/tty3270.c
Original file line number Diff line number Diff line change
Expand Up @@ -1935,7 +1935,7 @@ static int __init tty3270_init(void)
tty_set_operations(driver, &tty3270_ops);
ret = tty_register_driver(driver);
if (ret) {
put_tty_driver(driver);
tty_driver_kref_put(driver);
return ret;
}
tty3270_driver = driver;
Expand All @@ -1952,7 +1952,7 @@ tty3270_exit(void)
driver = tty3270_driver;
tty3270_driver = NULL;
tty_unregister_driver(driver);
put_tty_driver(driver);
tty_driver_kref_put(driver);
tty3270_del_views();
}

Expand Down
8 changes: 4 additions & 4 deletions drivers/staging/fwserial/fwserial.c
Original file line number Diff line number Diff line change
Expand Up @@ -2852,11 +2852,11 @@ static int __init fwserial_init(void)
tty_unregister_driver(fwloop_driver);
put_loop:
if (create_loop_dev)
put_tty_driver(fwloop_driver);
tty_driver_kref_put(fwloop_driver);
unregister_driver:
tty_unregister_driver(fwtty_driver);
put_tty:
put_tty_driver(fwtty_driver);
tty_driver_kref_put(fwtty_driver);
remove_debugfs:
debugfs_remove_recursive(fwserial_debugfs);

Expand All @@ -2871,10 +2871,10 @@ static void __exit fwserial_exit(void)
kmem_cache_destroy(fwtty_txn_cache);
if (create_loop_dev) {
tty_unregister_driver(fwloop_driver);
put_tty_driver(fwloop_driver);
tty_driver_kref_put(fwloop_driver);
}
tty_unregister_driver(fwtty_driver);
put_tty_driver(fwtty_driver);
tty_driver_kref_put(fwtty_driver);
debugfs_remove_recursive(fwserial_debugfs);
}

Expand Down
4 changes: 2 additions & 2 deletions drivers/staging/gdm724x/gdm_tty.c
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ int register_lte_tty_driver(void)

ret = tty_register_driver(tty_driver);
if (ret) {
put_tty_driver(tty_driver);
tty_driver_kref_put(tty_driver);
return ret;
}

Expand All @@ -318,7 +318,7 @@ void unregister_lte_tty_driver(void)
tty_driver = gdm_driver[i];
if (tty_driver) {
tty_unregister_driver(tty_driver);
put_tty_driver(tty_driver);
tty_driver_kref_put(tty_driver);
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions drivers/staging/greybus/uart.c
Original file line number Diff line number Diff line change
Expand Up @@ -973,15 +973,15 @@ static int gb_tty_init(void)
return 0;

fail_put_gb_tty:
put_tty_driver(gb_tty_driver);
tty_driver_kref_put(gb_tty_driver);
fail_unregister_dev:
return retval;
}

static void gb_tty_exit(void)
{
tty_unregister_driver(gb_tty_driver);
put_tty_driver(gb_tty_driver);
tty_driver_kref_put(gb_tty_driver);
idr_destroy(&tty_minors);
}

Expand Down
8 changes: 4 additions & 4 deletions drivers/tty/amiserial.c
Original file line number Diff line number Diff line change
Expand Up @@ -1519,7 +1519,7 @@ static int __init amiga_serial_probe(struct platform_device *pdev)

error = tty_register_driver(driver);
if (error)
goto fail_put_tty_driver;
goto fail_tty_driver_kref_put;

printk(KERN_INFO "ttyS0 is the amiga builtin serial port\n");

Expand Down Expand Up @@ -1566,9 +1566,9 @@ static int __init amiga_serial_probe(struct platform_device *pdev)
free_irq(IRQ_AMIGA_TBE, state);
fail_unregister:
tty_unregister_driver(driver);
fail_put_tty_driver:
fail_tty_driver_kref_put:
tty_port_destroy(&state->tport);
put_tty_driver(driver);
tty_driver_kref_put(driver);
return error;
}

Expand All @@ -1577,7 +1577,7 @@ static int __exit amiga_serial_remove(struct platform_device *pdev)
struct serial_state *state = platform_get_drvdata(pdev);

tty_unregister_driver(serial_driver);
put_tty_driver(serial_driver);
tty_driver_kref_put(serial_driver);
tty_port_destroy(&state->tport);

free_irq(IRQ_AMIGA_TBE, state);
Expand Down
6 changes: 3 additions & 3 deletions drivers/tty/ehv_bytechan.c
Original file line number Diff line number Diff line change
Expand Up @@ -791,7 +791,7 @@ static int __init ehv_bc_init(void)
ret = tty_register_driver(driver);
if (ret) {
pr_err("ehv-bc: could not register tty driver (ret=%i)\n", ret);
goto err_put_tty_driver;
goto err_tty_driver_kref_put;
}

ehv_bc_driver = driver;
Expand All @@ -808,8 +808,8 @@ static int __init ehv_bc_init(void)
err_deregister_tty_driver:
ehv_bc_driver = NULL;
tty_unregister_driver(driver);
err_put_tty_driver:
put_tty_driver(driver);
err_tty_driver_kref_put:
tty_driver_kref_put(driver);
err_free_bcs:
kfree(bcs);

Expand Down
4 changes: 2 additions & 2 deletions drivers/tty/goldfish.c
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ static int goldfish_tty_create_driver(void)
return 0;

err_tty_register_driver_failed:
put_tty_driver(tty);
tty_driver_kref_put(tty);
err_tty_alloc_driver_failed:
kfree(goldfish_ttys);
goldfish_ttys = NULL;
Expand All @@ -285,7 +285,7 @@ static int goldfish_tty_create_driver(void)
static void goldfish_tty_delete_driver(void)
{
tty_unregister_driver(goldfish_tty_driver);
put_tty_driver(goldfish_tty_driver);
tty_driver_kref_put(goldfish_tty_driver);
goldfish_tty_driver = NULL;
kfree(goldfish_ttys);
goldfish_ttys = NULL;
Expand Down
Loading

0 comments on commit 9f90a4d

Please sign in to comment.