Loading drivers/char/hw_random/core.c +19 −19 Original line number Original line Diff line number Diff line Loading @@ -162,7 +162,8 @@ static struct miscdevice rng_miscdev = { }; }; static ssize_t hwrng_attr_current_store(struct class_device *class, static ssize_t hwrng_attr_current_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t len) const char *buf, size_t len) { { int err; int err; Loading Loading @@ -192,7 +193,8 @@ static ssize_t hwrng_attr_current_store(struct class_device *class, return err ? : len; return err ? : len; } } static ssize_t hwrng_attr_current_show(struct class_device *class, static ssize_t hwrng_attr_current_show(struct device *dev, struct device_attribute *attr, char *buf) char *buf) { { int err; int err; Loading @@ -210,7 +212,8 @@ static ssize_t hwrng_attr_current_show(struct class_device *class, return ret; return ret; } } static ssize_t hwrng_attr_available_show(struct class_device *class, static ssize_t hwrng_attr_available_show(struct device *dev, struct device_attribute *attr, char *buf) char *buf) { { int err; int err; Loading @@ -234,20 +237,18 @@ static ssize_t hwrng_attr_available_show(struct class_device *class, return ret; return ret; } } static CLASS_DEVICE_ATTR(rng_current, S_IRUGO | S_IWUSR, static DEVICE_ATTR(rng_current, S_IRUGO | S_IWUSR, hwrng_attr_current_show, hwrng_attr_current_show, hwrng_attr_current_store); hwrng_attr_current_store); static CLASS_DEVICE_ATTR(rng_available, S_IRUGO, static DEVICE_ATTR(rng_available, S_IRUGO, hwrng_attr_available_show, hwrng_attr_available_show, NULL); NULL); static void unregister_miscdev(void) static void unregister_miscdev(void) { { class_device_remove_file(rng_miscdev.class, device_remove_file(rng_miscdev.this_device, &dev_attr_rng_available); &class_device_attr_rng_available); device_remove_file(rng_miscdev.this_device, &dev_attr_rng_current); class_device_remove_file(rng_miscdev.class, &class_device_attr_rng_current); misc_deregister(&rng_miscdev); misc_deregister(&rng_miscdev); } } Loading @@ -258,20 +259,19 @@ static int register_miscdev(void) err = misc_register(&rng_miscdev); err = misc_register(&rng_miscdev); if (err) if (err) goto out; goto out; err = class_device_create_file(rng_miscdev.class, err = device_create_file(rng_miscdev.this_device, &class_device_attr_rng_current); &dev_attr_rng_current); if (err) if (err) goto err_misc_dereg; goto err_misc_dereg; err = class_device_create_file(rng_miscdev.class, err = device_create_file(rng_miscdev.this_device, &class_device_attr_rng_available); &dev_attr_rng_available); if (err) if (err) goto err_remove_current; goto err_remove_current; out: out: return err; return err; err_remove_current: err_remove_current: class_device_remove_file(rng_miscdev.class, device_remove_file(rng_miscdev.this_device, &dev_attr_rng_current); &class_device_attr_rng_current); err_misc_dereg: err_misc_dereg: misc_deregister(&rng_miscdev); misc_deregister(&rng_miscdev); goto out; goto out; Loading drivers/char/misc.c +4 −9 Original line number Original line Diff line number Diff line Loading @@ -169,11 +169,6 @@ static int misc_open(struct inode * inode, struct file * file) return err; return err; } } /* * TODO for 2.7: * - add a struct kref to struct miscdevice and make all usages of * them dynamic. */ static struct class *misc_class; static struct class *misc_class; static const struct file_operations misc_fops = { static const struct file_operations misc_fops = { Loading Loading @@ -228,10 +223,10 @@ int misc_register(struct miscdevice * misc) misc_minors[misc->minor >> 3] |= 1 << (misc->minor & 7); misc_minors[misc->minor >> 3] |= 1 << (misc->minor & 7); dev = MKDEV(MISC_MAJOR, misc->minor); dev = MKDEV(MISC_MAJOR, misc->minor); misc->class = class_device_create(misc_class, NULL, dev, misc->dev, misc->this_device = device_create(misc_class, misc->parent, dev, "%s", misc->name); "%s", misc->name); if (IS_ERR(misc->class)) { if (IS_ERR(misc->this_device)) { err = PTR_ERR(misc->class); err = PTR_ERR(misc->this_device); goto out; goto out; } } Loading Loading @@ -264,7 +259,7 @@ int misc_deregister(struct miscdevice * misc) down(&misc_sem); down(&misc_sem); list_del(&misc->list); list_del(&misc->list); class_device_destroy(misc_class, MKDEV(MISC_MAJOR, misc->minor)); device_destroy(misc_class, MKDEV(MISC_MAJOR, misc->minor)); if (i < DYNAMIC_MINORS && i>0) { if (i < DYNAMIC_MINORS && i>0) { misc_minors[i>>3] &= ~(1 << (misc->minor & 7)); misc_minors[i>>3] &= ~(1 << (misc->minor & 7)); } } Loading drivers/char/tpm/tpm.c +1 −1 Original line number Original line Diff line number Diff line Loading @@ -1130,7 +1130,7 @@ struct tpm_chip *tpm_register_hardware(struct device *dev, const struct tpm_vend scnprintf(devname, DEVNAME_SIZE, "%s%d", "tpm", chip->dev_num); scnprintf(devname, DEVNAME_SIZE, "%s%d", "tpm", chip->dev_num); chip->vendor.miscdev.name = devname; chip->vendor.miscdev.name = devname; chip->vendor.miscdev.dev = dev; chip->vendor.miscdev.parent = dev; chip->dev = get_device(dev); chip->dev = get_device(dev); if (misc_register(&chip->vendor.miscdev)) { if (misc_register(&chip->vendor.miscdev)) { Loading drivers/input/serio/serio_raw.c +1 −1 Original line number Original line Diff line number Diff line Loading @@ -297,7 +297,7 @@ static int serio_raw_connect(struct serio *serio, struct serio_driver *drv) serio_raw->dev.minor = PSMOUSE_MINOR; serio_raw->dev.minor = PSMOUSE_MINOR; serio_raw->dev.name = serio_raw->name; serio_raw->dev.name = serio_raw->name; serio_raw->dev.dev = &serio->dev; serio_raw->dev.parent = &serio->dev; serio_raw->dev.fops = &serio_raw_fops; serio_raw->dev.fops = &serio_raw_fops; err = misc_register(&serio_raw->dev); err = misc_register(&serio_raw->dev); Loading include/linux/miscdevice.h +2 −3 Original line number Original line Diff line number Diff line Loading @@ -31,15 +31,14 @@ #define HPET_MINOR 228 #define HPET_MINOR 228 struct device; struct device; struct class_device; struct miscdevice { struct miscdevice { int minor; int minor; const char *name; const char *name; const struct file_operations *fops; const struct file_operations *fops; struct list_head list; struct list_head list; struct device *dev; struct device *parent; struct class_device *class; struct device *this_device; }; }; extern int misc_register(struct miscdevice * misc); extern int misc_register(struct miscdevice * misc); Loading Loading
drivers/char/hw_random/core.c +19 −19 Original line number Original line Diff line number Diff line Loading @@ -162,7 +162,8 @@ static struct miscdevice rng_miscdev = { }; }; static ssize_t hwrng_attr_current_store(struct class_device *class, static ssize_t hwrng_attr_current_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t len) const char *buf, size_t len) { { int err; int err; Loading Loading @@ -192,7 +193,8 @@ static ssize_t hwrng_attr_current_store(struct class_device *class, return err ? : len; return err ? : len; } } static ssize_t hwrng_attr_current_show(struct class_device *class, static ssize_t hwrng_attr_current_show(struct device *dev, struct device_attribute *attr, char *buf) char *buf) { { int err; int err; Loading @@ -210,7 +212,8 @@ static ssize_t hwrng_attr_current_show(struct class_device *class, return ret; return ret; } } static ssize_t hwrng_attr_available_show(struct class_device *class, static ssize_t hwrng_attr_available_show(struct device *dev, struct device_attribute *attr, char *buf) char *buf) { { int err; int err; Loading @@ -234,20 +237,18 @@ static ssize_t hwrng_attr_available_show(struct class_device *class, return ret; return ret; } } static CLASS_DEVICE_ATTR(rng_current, S_IRUGO | S_IWUSR, static DEVICE_ATTR(rng_current, S_IRUGO | S_IWUSR, hwrng_attr_current_show, hwrng_attr_current_show, hwrng_attr_current_store); hwrng_attr_current_store); static CLASS_DEVICE_ATTR(rng_available, S_IRUGO, static DEVICE_ATTR(rng_available, S_IRUGO, hwrng_attr_available_show, hwrng_attr_available_show, NULL); NULL); static void unregister_miscdev(void) static void unregister_miscdev(void) { { class_device_remove_file(rng_miscdev.class, device_remove_file(rng_miscdev.this_device, &dev_attr_rng_available); &class_device_attr_rng_available); device_remove_file(rng_miscdev.this_device, &dev_attr_rng_current); class_device_remove_file(rng_miscdev.class, &class_device_attr_rng_current); misc_deregister(&rng_miscdev); misc_deregister(&rng_miscdev); } } Loading @@ -258,20 +259,19 @@ static int register_miscdev(void) err = misc_register(&rng_miscdev); err = misc_register(&rng_miscdev); if (err) if (err) goto out; goto out; err = class_device_create_file(rng_miscdev.class, err = device_create_file(rng_miscdev.this_device, &class_device_attr_rng_current); &dev_attr_rng_current); if (err) if (err) goto err_misc_dereg; goto err_misc_dereg; err = class_device_create_file(rng_miscdev.class, err = device_create_file(rng_miscdev.this_device, &class_device_attr_rng_available); &dev_attr_rng_available); if (err) if (err) goto err_remove_current; goto err_remove_current; out: out: return err; return err; err_remove_current: err_remove_current: class_device_remove_file(rng_miscdev.class, device_remove_file(rng_miscdev.this_device, &dev_attr_rng_current); &class_device_attr_rng_current); err_misc_dereg: err_misc_dereg: misc_deregister(&rng_miscdev); misc_deregister(&rng_miscdev); goto out; goto out; Loading
drivers/char/misc.c +4 −9 Original line number Original line Diff line number Diff line Loading @@ -169,11 +169,6 @@ static int misc_open(struct inode * inode, struct file * file) return err; return err; } } /* * TODO for 2.7: * - add a struct kref to struct miscdevice and make all usages of * them dynamic. */ static struct class *misc_class; static struct class *misc_class; static const struct file_operations misc_fops = { static const struct file_operations misc_fops = { Loading Loading @@ -228,10 +223,10 @@ int misc_register(struct miscdevice * misc) misc_minors[misc->minor >> 3] |= 1 << (misc->minor & 7); misc_minors[misc->minor >> 3] |= 1 << (misc->minor & 7); dev = MKDEV(MISC_MAJOR, misc->minor); dev = MKDEV(MISC_MAJOR, misc->minor); misc->class = class_device_create(misc_class, NULL, dev, misc->dev, misc->this_device = device_create(misc_class, misc->parent, dev, "%s", misc->name); "%s", misc->name); if (IS_ERR(misc->class)) { if (IS_ERR(misc->this_device)) { err = PTR_ERR(misc->class); err = PTR_ERR(misc->this_device); goto out; goto out; } } Loading Loading @@ -264,7 +259,7 @@ int misc_deregister(struct miscdevice * misc) down(&misc_sem); down(&misc_sem); list_del(&misc->list); list_del(&misc->list); class_device_destroy(misc_class, MKDEV(MISC_MAJOR, misc->minor)); device_destroy(misc_class, MKDEV(MISC_MAJOR, misc->minor)); if (i < DYNAMIC_MINORS && i>0) { if (i < DYNAMIC_MINORS && i>0) { misc_minors[i>>3] &= ~(1 << (misc->minor & 7)); misc_minors[i>>3] &= ~(1 << (misc->minor & 7)); } } Loading
drivers/char/tpm/tpm.c +1 −1 Original line number Original line Diff line number Diff line Loading @@ -1130,7 +1130,7 @@ struct tpm_chip *tpm_register_hardware(struct device *dev, const struct tpm_vend scnprintf(devname, DEVNAME_SIZE, "%s%d", "tpm", chip->dev_num); scnprintf(devname, DEVNAME_SIZE, "%s%d", "tpm", chip->dev_num); chip->vendor.miscdev.name = devname; chip->vendor.miscdev.name = devname; chip->vendor.miscdev.dev = dev; chip->vendor.miscdev.parent = dev; chip->dev = get_device(dev); chip->dev = get_device(dev); if (misc_register(&chip->vendor.miscdev)) { if (misc_register(&chip->vendor.miscdev)) { Loading
drivers/input/serio/serio_raw.c +1 −1 Original line number Original line Diff line number Diff line Loading @@ -297,7 +297,7 @@ static int serio_raw_connect(struct serio *serio, struct serio_driver *drv) serio_raw->dev.minor = PSMOUSE_MINOR; serio_raw->dev.minor = PSMOUSE_MINOR; serio_raw->dev.name = serio_raw->name; serio_raw->dev.name = serio_raw->name; serio_raw->dev.dev = &serio->dev; serio_raw->dev.parent = &serio->dev; serio_raw->dev.fops = &serio_raw_fops; serio_raw->dev.fops = &serio_raw_fops; err = misc_register(&serio_raw->dev); err = misc_register(&serio_raw->dev); Loading
include/linux/miscdevice.h +2 −3 Original line number Original line Diff line number Diff line Loading @@ -31,15 +31,14 @@ #define HPET_MINOR 228 #define HPET_MINOR 228 struct device; struct device; struct class_device; struct miscdevice { struct miscdevice { int minor; int minor; const char *name; const char *name; const struct file_operations *fops; const struct file_operations *fops; struct list_head list; struct list_head list; struct device *dev; struct device *parent; struct class_device *class; struct device *this_device; }; }; extern int misc_register(struct miscdevice * misc); extern int misc_register(struct miscdevice * misc); Loading