Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 41181
b: refs/heads/master
c: 01107d3
h: refs/heads/master
i:
  41179: 2b4bb3c
v: v3
  • Loading branch information
Greg Kroah-Hartman committed Dec 1, 2006
1 parent 8bb3784 commit 28db955
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 29 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: 94fbcded4ea0dc14cbfb222a5c68372f150d1476
refs/heads/master: 01107d343076c34b9e1ce5d073292bd7f3097fda
19 changes: 10 additions & 9 deletions trunk/drivers/char/tty_io.c
Original file line number Diff line number Diff line change
Expand Up @@ -3612,7 +3612,8 @@ 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).
* Returns a pointer to the struct device for this tty 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_DYNAMIC_DEV bit set. If
Expand All @@ -3622,8 +3623,8 @@ static struct class *tty_class;
* Locking: ??
*/

struct class_device *tty_register_device(struct tty_driver *driver,
unsigned index, struct device *device)
struct 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;
Expand All @@ -3639,7 +3640,7 @@ struct class_device *tty_register_device(struct tty_driver *driver,
else
tty_line_name(driver, index, name);

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

/**
Expand All @@ -3655,7 +3656,7 @@ struct class_device *tty_register_device(struct tty_driver *driver,

void tty_unregister_device(struct tty_driver *driver, unsigned index)
{
class_device_destroy(tty_class, MKDEV(driver->major, driver->minor_start) + index);
device_destroy(tty_class, MKDEV(driver->major, driver->minor_start) + index);
}

EXPORT_SYMBOL(tty_register_device);
Expand Down Expand Up @@ -3895,28 +3896,28 @@ static int __init tty_init(void)
if (cdev_add(&tty_cdev, MKDEV(TTYAUX_MAJOR, 0), 1) ||
register_chrdev_region(MKDEV(TTYAUX_MAJOR, 0), 1, "/dev/tty") < 0)
panic("Couldn't register /dev/tty driver\n");
class_device_create(tty_class, NULL, MKDEV(TTYAUX_MAJOR, 0), NULL, "tty");
device_create(tty_class, NULL, MKDEV(TTYAUX_MAJOR, 0), "tty");

cdev_init(&console_cdev, &console_fops);
if (cdev_add(&console_cdev, MKDEV(TTYAUX_MAJOR, 1), 1) ||
register_chrdev_region(MKDEV(TTYAUX_MAJOR, 1), 1, "/dev/console") < 0)
panic("Couldn't register /dev/console driver\n");
class_device_create(tty_class, NULL, MKDEV(TTYAUX_MAJOR, 1), NULL, "console");
device_create(tty_class, NULL, MKDEV(TTYAUX_MAJOR, 1), "console");

#ifdef CONFIG_UNIX98_PTYS
cdev_init(&ptmx_cdev, &ptmx_fops);
if (cdev_add(&ptmx_cdev, MKDEV(TTYAUX_MAJOR, 2), 1) ||
register_chrdev_region(MKDEV(TTYAUX_MAJOR, 2), 1, "/dev/ptmx") < 0)
panic("Couldn't register /dev/ptmx driver\n");
class_device_create(tty_class, NULL, MKDEV(TTYAUX_MAJOR, 2), NULL, "ptmx");
device_create(tty_class, NULL, MKDEV(TTYAUX_MAJOR, 2), "ptmx");
#endif

#ifdef CONFIG_VT
cdev_init(&vc0_cdev, &console_fops);
if (cdev_add(&vc0_cdev, MKDEV(TTY_MAJOR, 0), 1) ||
register_chrdev_region(MKDEV(TTY_MAJOR, 0), 1, "/dev/vc/0") < 0)
panic("Couldn't register /dev/tty0 driver\n");
class_device_create(tty_class, NULL, MKDEV(TTY_MAJOR, 0), NULL, "tty0");
device_create(tty_class, NULL, MKDEV(TTY_MAJOR, 0), "tty0");

vty_init();
#endif
Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/isdn/gigaset/common.c
Original file line number Diff line number Diff line change
Expand Up @@ -702,7 +702,7 @@ struct cardstate *gigaset_initcs(struct gigaset_driver *drv, int channels,
cs->open_count = 0;
cs->dev = NULL;
cs->tty = NULL;
cs->class = NULL;
cs->tty_dev = NULL;
cs->cidmode = cidmode != 0;

//if(onechannel) { //FIXME
Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/isdn/gigaset/gigaset.h
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,7 @@ struct cardstate {
struct gigaset_driver *driver;
unsigned minor_index;
struct device *dev;
struct class_device *class;
struct device *tty_dev;

const struct gigaset_ops *ops;

Expand Down
10 changes: 5 additions & 5 deletions trunk/drivers/isdn/gigaset/interface.c
Original file line number Diff line number Diff line change
Expand Up @@ -625,13 +625,13 @@ void gigaset_if_init(struct cardstate *cs)
return;

tasklet_init(&cs->if_wake_tasklet, &if_wake, (unsigned long) cs);
cs->class = tty_register_device(drv->tty, cs->minor_index, NULL);
cs->tty_dev = tty_register_device(drv->tty, cs->minor_index, NULL);

if (!IS_ERR(cs->class))
class_set_devdata(cs->class, cs);
if (!IS_ERR(cs->tty_dev))
dev_set_drvdata(cs->tty_dev, cs);
else {
warn("could not register device to the tty subsystem");
cs->class = NULL;
cs->tty_dev = NULL;
}
}

Expand All @@ -645,7 +645,7 @@ void gigaset_if_free(struct cardstate *cs)

tasklet_disable(&cs->if_wake_tasklet);
tasklet_kill(&cs->if_wake_tasklet);
cs->class = NULL;
cs->tty_dev = NULL;
tty_unregister_device(drv->tty, cs->minor_index);
}

Expand Down
19 changes: 10 additions & 9 deletions trunk/drivers/isdn/gigaset/proc.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,12 @@
#include "gigaset.h"
#include <linux/ctype.h>

static ssize_t show_cidmode(struct class_device *class, char *buf)
static ssize_t show_cidmode(struct device *dev,
struct device_attribute *attr, char *buf)
{
int ret;
unsigned long flags;
struct cardstate *cs = class_get_devdata(class);
struct cardstate *cs = dev_get_drvdata(dev);

spin_lock_irqsave(&cs->lock, flags);
ret = sprintf(buf, "%u\n", cs->cidmode);
Expand All @@ -29,10 +30,10 @@ static ssize_t show_cidmode(struct class_device *class, char *buf)
return ret;
}

static ssize_t set_cidmode(struct class_device *class,
static ssize_t set_cidmode(struct device *dev, struct device_attribute *attr,
const char *buf, size_t count)
{
struct cardstate *cs = class_get_devdata(class);
struct cardstate *cs = dev_get_drvdata(dev);
long int value;
char *end;

Expand Down Expand Up @@ -64,25 +65,25 @@ static ssize_t set_cidmode(struct class_device *class,
return count;
}

static CLASS_DEVICE_ATTR(cidmode, S_IRUGO|S_IWUSR, show_cidmode, set_cidmode);
static DEVICE_ATTR(cidmode, S_IRUGO|S_IWUSR, show_cidmode, set_cidmode);

/* free sysfs for device */
void gigaset_free_dev_sysfs(struct cardstate *cs)
{
if (!cs->class)
if (!cs->tty_dev)
return;

gig_dbg(DEBUG_INIT, "removing sysfs entries");
class_device_remove_file(cs->class, &class_device_attr_cidmode);
device_remove_file(cs->tty_dev, &dev_attr_cidmode);
}

/* initialize sysfs for device */
void gigaset_init_dev_sysfs(struct cardstate *cs)
{
if (!cs->class)
if (!cs->tty_dev)
return;

gig_dbg(DEBUG_INIT, "setting up sysfs");
if (class_device_create_file(cs->class, &class_device_attr_cidmode))
if (device_create_file(cs->tty_dev, &dev_attr_cidmode))
dev_err(cs->dev, "could not create sysfs attribute\n");
}
5 changes: 2 additions & 3 deletions trunk/include/linux/tty.h
Original file line number Diff line number Diff line change
Expand Up @@ -276,9 +276,8 @@ 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 struct class_device *tty_register_device(struct tty_driver *driver,
unsigned index,
struct device *dev);
extern struct 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 28db955

Please sign in to comment.