Commit f62b69ad authored by Paul Fulghum's avatar Paul Fulghum Committed by Linus Torvalds

[PATCH] tty_register_driver

This patch reinstates the ability of tty devices to use dynamically
allocated major numbers yet specify the minor numbers statically.

The synclink drivers do this.
parent 5c88d5d3
...@@ -2241,7 +2241,7 @@ int tty_register_driver(struct tty_driver *driver) ...@@ -2241,7 +2241,7 @@ int tty_register_driver(struct tty_driver *driver)
return 0; return 0;
if (!driver->major) { if (!driver->major) {
error = alloc_chrdev_region(&dev, driver->num, error = alloc_chrdev_region(&dev, driver->minor_start, driver->num,
(char*)driver->name); (char*)driver->name);
if (!error) { if (!error) {
driver->major = MAJOR(dev); driver->major = MAJOR(dev);
......
...@@ -179,10 +179,10 @@ int register_chrdev_region(dev_t from, unsigned count, char *name) ...@@ -179,10 +179,10 @@ int register_chrdev_region(dev_t from, unsigned count, char *name)
return PTR_ERR(cd); return PTR_ERR(cd);
} }
int alloc_chrdev_region(dev_t *dev, unsigned count, char *name) int alloc_chrdev_region(dev_t *dev, unsigned baseminor, unsigned count, char *name)
{ {
struct char_device_struct *cd; struct char_device_struct *cd;
cd = __register_chrdev_region(0, 0, count, name); cd = __register_chrdev_region(0, baseminor, count, name);
if (IS_ERR(cd)) if (IS_ERR(cd))
return PTR_ERR(cd); return PTR_ERR(cd);
*dev = MKDEV(cd->major, cd->baseminor); *dev = MKDEV(cd->major, cd->baseminor);
......
...@@ -1059,7 +1059,7 @@ extern void bd_release(struct block_device *); ...@@ -1059,7 +1059,7 @@ extern void bd_release(struct block_device *);
extern void blk_run_queues(void); extern void blk_run_queues(void);
/* fs/char_dev.c */ /* fs/char_dev.c */
extern int alloc_chrdev_region(dev_t *, unsigned, char *); extern int alloc_chrdev_region(dev_t *, unsigned, unsigned, char *);
extern int register_chrdev_region(dev_t, unsigned, char *); extern int register_chrdev_region(dev_t, unsigned, char *);
extern int register_chrdev(unsigned int, const char *, extern int register_chrdev(unsigned int, const char *,
struct file_operations *); struct file_operations *);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment