From: Linus Torvalds Date: Sun, 20 Sep 2009 22:55:39 +0000 (-0700) Subject: Merge git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core-2.6 X-Git-Tag: v2.6.32-rc1~626 X-Git-Url: https://repo.jachan.dev/linux.git/commitdiff_plain/a57c21c7159e07c27e317ea3513dfb382be3f153?hp=-c Merge git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core-2.6 * git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core-2.6: Driver-Core: extend devnode callbacks to provide permissions --- a57c21c7159e07c27e317ea3513dfb382be3f153 diff --combined drivers/char/tty_io.c index 05f443c47bbe,c70d9dabefae..ea18a129b0b5 --- a/drivers/char/tty_io.c +++ b/drivers/char/tty_io.c @@@ -1184,7 -1184,6 +1184,7 @@@ int tty_init_termios(struct tty_struct tty->termios->c_ospeed = tty_termios_baud_rate(tty->termios); return 0; } +EXPORT_SYMBOL_GPL(tty_init_termios); /** * tty_driver_install_tty() - install a tty entry in the driver @@@ -1387,14 -1386,10 +1387,14 @@@ EXPORT_SYMBOL(tty_shutdown) * tty_mutex - sometimes only * takes the file list lock internally when working on the list * of ttys that the driver keeps. + * + * This method gets called from a work queue so that the driver private + * shutdown ops can sleep (needed for USB at least) */ -static void release_one_tty(struct kref *kref) +static void release_one_tty(struct work_struct *work) { - struct tty_struct *tty = container_of(kref, struct tty_struct, kref); + struct tty_struct *tty = + container_of(work, struct tty_struct, hangup_work); struct tty_driver *driver = tty->driver; if (tty->ops->shutdown) @@@ -1412,15 -1407,6 +1412,15 @@@ free_tty_struct(tty); } +static void queue_release_one_tty(struct kref *kref) +{ + struct tty_struct *tty = container_of(kref, struct tty_struct, kref); + /* The hangup queue is now free so we can reuse it rather than + waste a chunk of memory for each port */ + INIT_WORK(&tty->hangup_work, release_one_tty); + schedule_work(&tty->hangup_work); +} + /** * tty_kref_put - release a tty kref * @tty: tty device @@@ -1432,7 -1418,7 +1432,7 @@@ void tty_kref_put(struct tty_struct *tty) { if (tty) - kref_put(&tty->kref, release_one_tty); + kref_put(&tty->kref, queue_release_one_tty); } EXPORT_SYMBOL(tty_kref_put); @@@ -2099,7 -2085,7 +2099,7 @@@ static int tioccons(struct file *file * the generic functionality existed. This piece of history is preserved * in the expected tty API of posix OS's. * - * Locking: none, the open fle handle ensures it won't go away. + * Locking: none, the open file handle ensures it won't go away. */ static int fionbio(struct file *file, int __user *p) @@@ -3070,11 -3056,22 +3070,22 @@@ void __init console_init(void } } + static char *tty_devnode(struct device *dev, mode_t *mode) + { + if (!mode) + return NULL; + if (dev->devt == MKDEV(TTYAUX_MAJOR, 0) || + dev->devt == MKDEV(TTYAUX_MAJOR, 2)) + *mode = 0666; + return NULL; + } + static int __init tty_class_init(void) { tty_class = class_create(THIS_MODULE, "tty"); if (IS_ERR(tty_class)) return PTR_ERR(tty_class); + tty_class->devnode = tty_devnode; return 0; }