Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 28284
b: refs/heads/master
c: 1cdcb6b
h: refs/heads/master
v: v3
  • Loading branch information
Hansjoerg Lipp authored and Greg Kroah-Hartman committed Jun 21, 2006
1 parent b278aff commit 37cbf5f
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 53877d06d53a412d901bb323f080296c363d8b51
refs/heads/master: 1cdcb6b43fda7424b7435dac8f80b2b5d8a48899
11 changes: 7 additions & 4 deletions trunk/drivers/char/tty_io.c
Original file line number Diff line number Diff line change
Expand Up @@ -2961,20 +2961,22 @@ static struct class *tty_class;
* This field is optional, if there is no known struct device for this
* tty device it can be set to NULL safely.
*
* Returns a pointer to the class device (or ERR_PTR(-EFOO) on error).
*
* This call is required to be made to register an individual tty device if
* the tty driver's flags have the TTY_DRIVER_NO_DEVFS bit set. If that
* bit is not set, this function should not be called.
*/
void tty_register_device(struct tty_driver *driver, unsigned index,
struct device *device)
struct class_device *tty_register_device(struct tty_driver *driver,
unsigned index, struct device *device)
{
char name[64];
dev_t dev = MKDEV(driver->major, driver->minor_start) + index;

if (index >= driver->num) {
printk(KERN_ERR "Attempt to register invalid tty line number "
" (%d).\n", index);
return;
return ERR_PTR(-EINVAL);
}

devfs_mk_cdev(dev, S_IFCHR | S_IRUSR | S_IWUSR,
Expand All @@ -2984,7 +2986,8 @@ void tty_register_device(struct tty_driver *driver, unsigned index,
pty_line_name(driver, index, name);
else
tty_line_name(driver, index, name);
class_device_create(tty_class, NULL, dev, device, "%s", name);

return class_device_create(tty_class, NULL, dev, device, "%s", name);
}

/**
Expand Down
4 changes: 3 additions & 1 deletion trunk/include/linux/tty.h
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,9 @@ extern int tty_register_ldisc(int disc, struct tty_ldisc *new_ldisc);
extern int tty_unregister_ldisc(int disc);
extern int tty_register_driver(struct tty_driver *driver);
extern int tty_unregister_driver(struct tty_driver *driver);
extern void tty_register_device(struct tty_driver *driver, unsigned index, struct device *dev);
extern struct class_device *tty_register_device(struct tty_driver *driver,
unsigned index,
struct device *dev);
extern void tty_unregister_device(struct tty_driver *driver, unsigned index);
extern int tty_read_raw_data(struct tty_struct *tty, unsigned char *bufp,
int buflen);
Expand Down

0 comments on commit 37cbf5f

Please sign in to comment.