Message ID | 243519fa733359d22ce008b795f5686411e6038a.1400449372.git.tilman@imap.cc |
---|---|
State | Changes Requested, archived |
Delegated to: | David Miller |
Headers | show |
On Wed, May 21, 2014 at 11:39:26PM +0200, Tilman Schmidt wrote: > From: Paul Bolle <pebolle@tiscali.nl> > > The device nodes for tty drivers are named using a straightforward > scheme: tty_driver->name with an (increasing) digit appended. But the > capi driver (a part of one of the current ISDN subsystems) requires a > different naming scheme for its "capi_nc" tty_driver: > /dev/capi/0 > /dev/capi/1 > [...] Can't you just use a '!' character to represent the '/' and the tty core will handle it all properly for you without this tty core change needed? > So add a devnode() callback to struct tty_driver to allow tty drivers > to use a more elaborate naming scheme. And let tty_devnode(), the > devnode() callback for the "tty" class, call that new callback if a tty > driver uses one. This allows the capi driver to add a callback to > enable its scheme. And why the sudden need for this feature, what changed in isdn to warrant this change? greg k-h -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Wed, 2014-05-28 at 13:56 -0700, Greg Kroah-Hartman wrote: > On Wed, May 21, 2014 at 11:39:26PM +0200, Tilman Schmidt wrote: > > From: Paul Bolle <pebolle@tiscali.nl> >> > > The device nodes for tty drivers are named using a straightforward > > scheme: tty_driver->name with an (increasing) digit appended. But the > > capi driver (a part of one of the current ISDN subsystems) requires a > > different naming scheme for its "capi_nc" tty_driver: > > /dev/capi/0 > > /dev/capi/1 > > [...] > > Can't you just use a '!' character to represent the '/' and the tty core > will handle it all properly for you without this tty core change needed? As in: set struct tty_driver.name to "capi!"? > > So add a devnode() callback to struct tty_driver to allow tty drivers > > to use a more elaborate naming scheme. And let tty_devnode(), the > > devnode() callback for the "tty" class, call that new callback if a tty > > driver uses one. This allows the capi driver to add a callback to > > enable its scheme. > > And why the sudden need for this feature, what changed in isdn to > warrant this change? Did you already read the explanation to 4/4? It contains a summary of the events that got us in the current situation. Paul Bolle -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Wed, May 28, 2014 at 11:06:41PM +0200, Paul Bolle wrote: > On Wed, 2014-05-28 at 13:56 -0700, Greg Kroah-Hartman wrote: > > On Wed, May 21, 2014 at 11:39:26PM +0200, Tilman Schmidt wrote: > > > From: Paul Bolle <pebolle@tiscali.nl> > >> > > > The device nodes for tty drivers are named using a straightforward > > > scheme: tty_driver->name with an (increasing) digit appended. But the > > > capi driver (a part of one of the current ISDN subsystems) requires a > > > different naming scheme for its "capi_nc" tty_driver: > > > /dev/capi/0 > > > /dev/capi/1 > > > [...] > > > > Can't you just use a '!' character to represent the '/' and the tty core > > will handle it all properly for you without this tty core change needed? > > As in: set struct tty_driver.name to "capi!"? Yes. Try it and see :) If not, let me know, it should "just work". > > > So add a devnode() callback to struct tty_driver to allow tty drivers > > > to use a more elaborate naming scheme. And let tty_devnode(), the > > > devnode() callback for the "tty" class, call that new callback if a tty > > > driver uses one. This allows the capi driver to add a callback to > > > enable its scheme. > > > > And why the sudden need for this feature, what changed in isdn to > > warrant this change? > > Did you already read the explanation to 4/4? It contains a summary of > the events that got us in the current situation. Sorry, only read patch 3 as it came first :) But try the above first, the driver core and udev supports the '!' character for subdirs for a very long time thanks to some horrid scsi drivers needing it... thanks, greg k-h -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On Wed, 2014-05-28 at 14:12 -0700, Greg Kroah-Hartman wrote: > On Wed, May 28, 2014 at 11:06:41PM +0200, Paul Bolle wrote: > > On Wed, 2014-05-28 at 13:56 -0700, Greg Kroah-Hartman wrote: > > > On Wed, May 21, 2014 at 11:39:26PM +0200, Tilman Schmidt wrote: > > > > From: Paul Bolle <pebolle@tiscali.nl> > > >> > > > > The device nodes for tty drivers are named using a straightforward > > > > scheme: tty_driver->name with an (increasing) digit appended. But the > > > > capi driver (a part of one of the current ISDN subsystems) requires a > > > > different naming scheme for its "capi_nc" tty_driver: > > > > /dev/capi/0 > > > > /dev/capi/1 > > > > [...] > > > > > > Can't you just use a '!' character to represent the '/' and the tty core > > > will handle it all properly for you without this tty core change needed? > > > > As in: set struct tty_driver.name to "capi!"? > > Yes. Try it and see :) > > If not, let me know, it should "just work". I'll let you know. But chances are v2 will only contain 3 patches! > > > > So add a devnode() callback to struct tty_driver to allow tty drivers > > > > to use a more elaborate naming scheme. And let tty_devnode(), the > > > > devnode() callback for the "tty" class, call that new callback if a tty > > > > driver uses one. This allows the capi driver to add a callback to > > > > enable its scheme. > > > > > > And why the sudden need for this feature, what changed in isdn to > > > warrant this change? > > > > Did you already read the explanation to 4/4? It contains a summary of > > the events that got us in the current situation. > > Sorry, only read patch 3 as it came first :) > > But try the above first, the driver core and udev supports the '!' > character for subdirs for a very long time thanks to some horrid scsi > drivers needing it... Will do. And I'll probably ponder how I managed to miss an easy way out. Thanks for the review! Paul Bolle -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c index 3411071..32d7878 100644 --- a/drivers/tty/tty_io.c +++ b/drivers/tty/tty_io.c @@ -3504,12 +3504,24 @@ void __init console_init(void) static char *tty_devnode(struct device *dev, umode_t *mode) { + struct tty_driver *driver = NULL; + int unused; + char *ret = NULL; + + mutex_lock(&tty_mutex); + driver = get_tty_driver(dev->devt, &unused); + mutex_unlock(&tty_mutex); + if (driver && driver->devnode) + ret = driver->devnode(dev, mode); + if (driver) + tty_driver_kref_put(driver); + if (!mode) - return NULL; + return ret; if (dev->devt == MKDEV(TTYAUX_MAJOR, 0) || dev->devt == MKDEV(TTYAUX_MAJOR, 2)) *mode = 0666; - return NULL; + return ret; } static int __init tty_class_init(void) diff --git a/include/linux/tty_driver.h b/include/linux/tty_driver.h index 756a609..91265bf 100644 --- a/include/linux/tty_driver.h +++ b/include/linux/tty_driver.h @@ -294,6 +294,7 @@ struct tty_driver { struct module *owner; const char *driver_name; const char *name; + char *(*devnode)(struct device *dev, umode_t *mode); int name_base; /* offset of printed name */ int major; /* major device number */ int minor_start; /* start of minor device number */