tty: let tty_unregister_driver return void

Now that noone checks the return value, switch the return type of
tty_unregister_driver to void. We can do that as we always return zero.

Generally, drivers are not allowed to call tty_unregister_driver while
there are open devices.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Link: https://lore.kernel.org/r/20210302062214.29627-35-jslaby@suse.cz
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Jiri Slaby 2021-03-02 07:22:05 +01:00 committed by Greg Kroah-Hartman
parent 6c2e6317c9
commit a872ab4d6d
2 changed files with 2 additions and 9 deletions

View File

@ -3525,21 +3525,14 @@ EXPORT_SYMBOL(tty_register_driver);
/* /*
* Called by a tty driver to unregister itself. * Called by a tty driver to unregister itself.
*/ */
int tty_unregister_driver(struct tty_driver *driver) void tty_unregister_driver(struct tty_driver *driver)
{ {
#if 0
/* FIXME */
if (driver->refcount)
return -EBUSY;
#endif
unregister_chrdev_region(MKDEV(driver->major, driver->minor_start), unregister_chrdev_region(MKDEV(driver->major, driver->minor_start),
driver->num); driver->num);
mutex_lock(&tty_mutex); mutex_lock(&tty_mutex);
list_del(&driver->tty_drivers); list_del(&driver->tty_drivers);
mutex_unlock(&tty_mutex); mutex_unlock(&tty_mutex);
return 0;
} }
EXPORT_SYMBOL(tty_unregister_driver); EXPORT_SYMBOL(tty_unregister_driver);
dev_t tty_devnum(struct tty_struct *tty) dev_t tty_devnum(struct tty_struct *tty)

View File

@ -482,7 +482,7 @@ extern void stop_tty(struct tty_struct *tty);
extern void __start_tty(struct tty_struct *tty); extern void __start_tty(struct tty_struct *tty);
extern void start_tty(struct tty_struct *tty); extern void start_tty(struct tty_struct *tty);
extern int tty_register_driver(struct tty_driver *driver); extern int tty_register_driver(struct tty_driver *driver);
extern int tty_unregister_driver(struct tty_driver *driver); extern void tty_unregister_driver(struct tty_driver *driver);
extern struct device *tty_register_device(struct tty_driver *driver, extern struct device *tty_register_device(struct tty_driver *driver,
unsigned index, struct device *dev); unsigned index, struct device *dev);
extern struct device *tty_register_device_attr(struct tty_driver *driver, extern struct device *tty_register_device_attr(struct tty_driver *driver,