diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/base/core.c | 19 | ||||
-rw-r--r-- | drivers/base/devtmpfs.c | 24 | ||||
-rw-r--r-- | drivers/block/aoe/aoechr.c | 4 | ||||
-rw-r--r-- | drivers/block/pktcdvd.c | 6 | ||||
-rw-r--r-- | drivers/char/hw_random/core.c | 2 | ||||
-rw-r--r-- | drivers/char/mem.c | 29 | ||||
-rw-r--r-- | drivers/char/misc.c | 10 | ||||
-rw-r--r-- | drivers/char/raw.c | 4 | ||||
-rw-r--r-- | drivers/char/tty_io.c | 11 | ||||
-rw-r--r-- | drivers/gpu/drm/drm_sysfs.c | 4 | ||||
-rw-r--r-- | drivers/hid/usbhid/hiddev.c | 4 | ||||
-rw-r--r-- | drivers/input/input.c | 4 | ||||
-rw-r--r-- | drivers/md/dm-ioctl.c | 2 | ||||
-rw-r--r-- | drivers/media/dvb/dvb-core/dvbdev.c | 4 | ||||
-rw-r--r-- | drivers/net/tun.c | 2 | ||||
-rw-r--r-- | drivers/usb/class/usblp.c | 4 | ||||
-rw-r--r-- | drivers/usb/core/file.c | 8 | ||||
-rw-r--r-- | drivers/usb/core/usb.c | 4 | ||||
-rw-r--r-- | drivers/usb/misc/iowarrior.c | 4 | ||||
-rw-r--r-- | drivers/usb/misc/legousbtower.c | 4 |
20 files changed, 94 insertions, 59 deletions
diff --git a/drivers/base/core.c b/drivers/base/core.c index 390e664ec1c7..6bee6af8d8e1 100644 --- a/drivers/base/core.c +++ b/drivers/base/core.c | |||
@@ -166,13 +166,16 @@ static int dev_uevent(struct kset *kset, struct kobject *kobj, | |||
166 | if (MAJOR(dev->devt)) { | 166 | if (MAJOR(dev->devt)) { |
167 | const char *tmp; | 167 | const char *tmp; |
168 | const char *name; | 168 | const char *name; |
169 | mode_t mode = 0; | ||
169 | 170 | ||
170 | add_uevent_var(env, "MAJOR=%u", MAJOR(dev->devt)); | 171 | add_uevent_var(env, "MAJOR=%u", MAJOR(dev->devt)); |
171 | add_uevent_var(env, "MINOR=%u", MINOR(dev->devt)); | 172 | add_uevent_var(env, "MINOR=%u", MINOR(dev->devt)); |
172 | name = device_get_nodename(dev, &tmp); | 173 | name = device_get_devnode(dev, &mode, &tmp); |
173 | if (name) { | 174 | if (name) { |
174 | add_uevent_var(env, "DEVNAME=%s", name); | 175 | add_uevent_var(env, "DEVNAME=%s", name); |
175 | kfree(tmp); | 176 | kfree(tmp); |
177 | if (mode) | ||
178 | add_uevent_var(env, "DEVMODE=%#o", mode & 0777); | ||
176 | } | 179 | } |
177 | } | 180 | } |
178 | 181 | ||
@@ -1148,8 +1151,9 @@ static struct device *next_device(struct klist_iter *i) | |||
1148 | } | 1151 | } |
1149 | 1152 | ||
1150 | /** | 1153 | /** |
1151 | * device_get_nodename - path of device node file | 1154 | * device_get_devnode - path of device node file |
1152 | * @dev: device | 1155 | * @dev: device |
1156 | * @mode: returned file access mode | ||
1153 | * @tmp: possibly allocated string | 1157 | * @tmp: possibly allocated string |
1154 | * | 1158 | * |
1155 | * Return the relative path of a possible device node. | 1159 | * Return the relative path of a possible device node. |
@@ -1157,21 +1161,22 @@ static struct device *next_device(struct klist_iter *i) | |||
1157 | * a name. This memory is returned in tmp and needs to be | 1161 | * a name. This memory is returned in tmp and needs to be |
1158 | * freed by the caller. | 1162 | * freed by the caller. |
1159 | */ | 1163 | */ |
1160 | const char *device_get_nodename(struct device *dev, const char **tmp) | 1164 | const char *device_get_devnode(struct device *dev, |
1165 | mode_t *mode, const char **tmp) | ||
1161 | { | 1166 | { |
1162 | char *s; | 1167 | char *s; |
1163 | 1168 | ||
1164 | *tmp = NULL; | 1169 | *tmp = NULL; |
1165 | 1170 | ||
1166 | /* the device type may provide a specific name */ | 1171 | /* the device type may provide a specific name */ |
1167 | if (dev->type && dev->type->nodename) | 1172 | if (dev->type && dev->type->devnode) |
1168 | *tmp = dev->type->nodename(dev); | 1173 | *tmp = dev->type->devnode(dev, mode); |
1169 | if (*tmp) | 1174 | if (*tmp) |
1170 | return *tmp; | 1175 | return *tmp; |
1171 | 1176 | ||
1172 | /* the class may provide a specific name */ | 1177 | /* the class may provide a specific name */ |
1173 | if (dev->class && dev->class->nodename) | 1178 | if (dev->class && dev->class->devnode) |
1174 | *tmp = dev->class->nodename(dev); | 1179 | *tmp = dev->class->devnode(dev, mode); |
1175 | if (*tmp) | 1180 | if (*tmp) |
1176 | return *tmp; | 1181 | return *tmp; |
1177 | 1182 | ||
diff --git a/drivers/base/devtmpfs.c b/drivers/base/devtmpfs.c index fd488ad4263a..a1cb5afe6801 100644 --- a/drivers/base/devtmpfs.c +++ b/drivers/base/devtmpfs.c | |||
@@ -6,9 +6,10 @@ | |||
6 | * During bootup, before any driver core device is registered, | 6 | * During bootup, before any driver core device is registered, |
7 | * devtmpfs, a tmpfs-based filesystem is created. Every driver-core | 7 | * devtmpfs, a tmpfs-based filesystem is created. Every driver-core |
8 | * device which requests a device node, will add a node in this | 8 | * device which requests a device node, will add a node in this |
9 | * filesystem. The node is named after the the name of the device, | 9 | * filesystem. |
10 | * or the susbsytem can provide a custom name. All devices are | 10 | * By default, all devices are named after the the name of the |
11 | * owned by root and have a mode of 0600. | 11 | * device, owned by root and have a default mode of 0600. Subsystems |
12 | * can overwrite the default setting if needed. | ||
12 | */ | 13 | */ |
13 | 14 | ||
14 | #include <linux/kernel.h> | 15 | #include <linux/kernel.h> |
@@ -20,6 +21,7 @@ | |||
20 | #include <linux/fs.h> | 21 | #include <linux/fs.h> |
21 | #include <linux/shmem_fs.h> | 22 | #include <linux/shmem_fs.h> |
22 | #include <linux/cred.h> | 23 | #include <linux/cred.h> |
24 | #include <linux/sched.h> | ||
23 | #include <linux/init_task.h> | 25 | #include <linux/init_task.h> |
24 | 26 | ||
25 | static struct vfsmount *dev_mnt; | 27 | static struct vfsmount *dev_mnt; |
@@ -134,7 +136,7 @@ int devtmpfs_create_node(struct device *dev) | |||
134 | const char *tmp = NULL; | 136 | const char *tmp = NULL; |
135 | const char *nodename; | 137 | const char *nodename; |
136 | const struct cred *curr_cred; | 138 | const struct cred *curr_cred; |
137 | mode_t mode; | 139 | mode_t mode = 0; |
138 | struct nameidata nd; | 140 | struct nameidata nd; |
139 | struct dentry *dentry; | 141 | struct dentry *dentry; |
140 | int err; | 142 | int err; |
@@ -142,14 +144,16 @@ int devtmpfs_create_node(struct device *dev) | |||
142 | if (!dev_mnt) | 144 | if (!dev_mnt) |
143 | return 0; | 145 | return 0; |
144 | 146 | ||
145 | nodename = device_get_nodename(dev, &tmp); | 147 | nodename = device_get_devnode(dev, &mode, &tmp); |
146 | if (!nodename) | 148 | if (!nodename) |
147 | return -ENOMEM; | 149 | return -ENOMEM; |
148 | 150 | ||
151 | if (mode == 0) | ||
152 | mode = 0600; | ||
149 | if (is_blockdev(dev)) | 153 | if (is_blockdev(dev)) |
150 | mode = S_IFBLK|0600; | 154 | mode |= S_IFBLK; |
151 | else | 155 | else |
152 | mode = S_IFCHR|0600; | 156 | mode |= S_IFCHR; |
153 | 157 | ||
154 | curr_cred = override_creds(&init_cred); | 158 | curr_cred = override_creds(&init_cred); |
155 | err = vfs_path_lookup(dev_mnt->mnt_root, dev_mnt, | 159 | err = vfs_path_lookup(dev_mnt->mnt_root, dev_mnt, |
@@ -165,8 +169,12 @@ int devtmpfs_create_node(struct device *dev) | |||
165 | 169 | ||
166 | dentry = lookup_create(&nd, 0); | 170 | dentry = lookup_create(&nd, 0); |
167 | if (!IS_ERR(dentry)) { | 171 | if (!IS_ERR(dentry)) { |
172 | int umask; | ||
173 | |||
174 | umask = sys_umask(0000); | ||
168 | err = vfs_mknod(nd.path.dentry->d_inode, | 175 | err = vfs_mknod(nd.path.dentry->d_inode, |
169 | dentry, mode, dev->devt); | 176 | dentry, mode, dev->devt); |
177 | sys_umask(umask); | ||
170 | /* mark as kernel created inode */ | 178 | /* mark as kernel created inode */ |
171 | if (!err) | 179 | if (!err) |
172 | dentry->d_inode->i_private = &dev_mnt; | 180 | dentry->d_inode->i_private = &dev_mnt; |
@@ -271,7 +279,7 @@ int devtmpfs_delete_node(struct device *dev) | |||
271 | if (!dev_mnt) | 279 | if (!dev_mnt) |
272 | return 0; | 280 | return 0; |
273 | 281 | ||
274 | nodename = device_get_nodename(dev, &tmp); | 282 | nodename = device_get_devnode(dev, NULL, &tmp); |
275 | if (!nodename) | 283 | if (!nodename) |
276 | return -ENOMEM; | 284 | return -ENOMEM; |
277 | 285 | ||
diff --git a/drivers/block/aoe/aoechr.c b/drivers/block/aoe/aoechr.c index 19888354188f..62141ec09a22 100644 --- a/drivers/block/aoe/aoechr.c +++ b/drivers/block/aoe/aoechr.c | |||
@@ -266,7 +266,7 @@ static const struct file_operations aoe_fops = { | |||
266 | .owner = THIS_MODULE, | 266 | .owner = THIS_MODULE, |
267 | }; | 267 | }; |
268 | 268 | ||
269 | static char *aoe_nodename(struct device *dev) | 269 | static char *aoe_devnode(struct device *dev, mode_t *mode) |
270 | { | 270 | { |
271 | return kasprintf(GFP_KERNEL, "etherd/%s", dev_name(dev)); | 271 | return kasprintf(GFP_KERNEL, "etherd/%s", dev_name(dev)); |
272 | } | 272 | } |
@@ -288,7 +288,7 @@ aoechr_init(void) | |||
288 | unregister_chrdev(AOE_MAJOR, "aoechr"); | 288 | unregister_chrdev(AOE_MAJOR, "aoechr"); |
289 | return PTR_ERR(aoe_class); | 289 | return PTR_ERR(aoe_class); |
290 | } | 290 | } |
291 | aoe_class->nodename = aoe_nodename; | 291 | aoe_class->devnode = aoe_devnode; |
292 | 292 | ||
293 | for (i = 0; i < ARRAY_SIZE(chardevs); ++i) | 293 | for (i = 0; i < ARRAY_SIZE(chardevs); ++i) |
294 | device_create(aoe_class, NULL, | 294 | device_create(aoe_class, NULL, |
diff --git a/drivers/block/pktcdvd.c b/drivers/block/pktcdvd.c index 95f11cdef203..fd5bb8ad59a9 100644 --- a/drivers/block/pktcdvd.c +++ b/drivers/block/pktcdvd.c | |||
@@ -2857,7 +2857,7 @@ static struct block_device_operations pktcdvd_ops = { | |||
2857 | .media_changed = pkt_media_changed, | 2857 | .media_changed = pkt_media_changed, |
2858 | }; | 2858 | }; |
2859 | 2859 | ||
2860 | static char *pktcdvd_nodename(struct gendisk *gd) | 2860 | static char *pktcdvd_devnode(struct gendisk *gd, mode_t *mode) |
2861 | { | 2861 | { |
2862 | return kasprintf(GFP_KERNEL, "pktcdvd/%s", gd->disk_name); | 2862 | return kasprintf(GFP_KERNEL, "pktcdvd/%s", gd->disk_name); |
2863 | } | 2863 | } |
@@ -2914,7 +2914,7 @@ static int pkt_setup_dev(dev_t dev, dev_t* pkt_dev) | |||
2914 | disk->fops = &pktcdvd_ops; | 2914 | disk->fops = &pktcdvd_ops; |
2915 | disk->flags = GENHD_FL_REMOVABLE; | 2915 | disk->flags = GENHD_FL_REMOVABLE; |
2916 | strcpy(disk->disk_name, pd->name); | 2916 | strcpy(disk->disk_name, pd->name); |
2917 | disk->nodename = pktcdvd_nodename; | 2917 | disk->devnode = pktcdvd_devnode; |
2918 | disk->private_data = pd; | 2918 | disk->private_data = pd; |
2919 | disk->queue = blk_alloc_queue(GFP_KERNEL); | 2919 | disk->queue = blk_alloc_queue(GFP_KERNEL); |
2920 | if (!disk->queue) | 2920 | if (!disk->queue) |
@@ -3070,7 +3070,7 @@ static const struct file_operations pkt_ctl_fops = { | |||
3070 | static struct miscdevice pkt_misc = { | 3070 | static struct miscdevice pkt_misc = { |
3071 | .minor = MISC_DYNAMIC_MINOR, | 3071 | .minor = MISC_DYNAMIC_MINOR, |
3072 | .name = DRIVER_NAME, | 3072 | .name = DRIVER_NAME, |
3073 | .name = "pktcdvd/control", | 3073 | .nodename = "pktcdvd/control", |
3074 | .fops = &pkt_ctl_fops | 3074 | .fops = &pkt_ctl_fops |
3075 | }; | 3075 | }; |
3076 | 3076 | ||
diff --git a/drivers/char/hw_random/core.c b/drivers/char/hw_random/core.c index fc93e2fc7c71..1573aebd54b5 100644 --- a/drivers/char/hw_random/core.c +++ b/drivers/char/hw_random/core.c | |||
@@ -153,7 +153,7 @@ static const struct file_operations rng_chrdev_ops = { | |||
153 | static struct miscdevice rng_miscdev = { | 153 | static struct miscdevice rng_miscdev = { |
154 | .minor = RNG_MISCDEV_MINOR, | 154 | .minor = RNG_MISCDEV_MINOR, |
155 | .name = RNG_MODULE_NAME, | 155 | .name = RNG_MODULE_NAME, |
156 | .devnode = "hwrng", | 156 | .nodename = "hwrng", |
157 | .fops = &rng_chrdev_ops, | 157 | .fops = &rng_chrdev_ops, |
158 | }; | 158 | }; |
159 | 159 | ||
diff --git a/drivers/char/mem.c b/drivers/char/mem.c index 0491cdf63f2a..0aede1d6a9ea 100644 --- a/drivers/char/mem.c +++ b/drivers/char/mem.c | |||
@@ -866,24 +866,25 @@ static const struct file_operations kmsg_fops = { | |||
866 | 866 | ||
867 | static const struct memdev { | 867 | static const struct memdev { |
868 | const char *name; | 868 | const char *name; |
869 | mode_t mode; | ||
869 | const struct file_operations *fops; | 870 | const struct file_operations *fops; |
870 | struct backing_dev_info *dev_info; | 871 | struct backing_dev_info *dev_info; |
871 | } devlist[] = { | 872 | } devlist[] = { |
872 | [ 1] = { "mem", &mem_fops, &directly_mappable_cdev_bdi }, | 873 | [1] = { "mem", 0, &mem_fops, &directly_mappable_cdev_bdi }, |
873 | #ifdef CONFIG_DEVKMEM | 874 | #ifdef CONFIG_DEVKMEM |
874 | [ 2] = { "kmem", &kmem_fops, &directly_mappable_cdev_bdi }, | 875 | [2] = { "kmem", 0, &kmem_fops, &directly_mappable_cdev_bdi }, |
875 | #endif | 876 | #endif |
876 | [ 3] = {"null", &null_fops, NULL }, | 877 | [3] = { "null", 0666, &null_fops, NULL }, |
877 | #ifdef CONFIG_DEVPORT | 878 | #ifdef CONFIG_DEVPORT |
878 | [ 4] = { "port", &port_fops, NULL }, | 879 | [4] = { "port", 0, &port_fops, NULL }, |
879 | #endif | 880 | #endif |
880 | [ 5] = { "zero", &zero_fops, &zero_bdi }, | 881 | [5] = { "zero", 0666, &zero_fops, &zero_bdi }, |
881 | [ 7] = { "full", &full_fops, NULL }, | 882 | [7] = { "full", 0666, &full_fops, NULL }, |
882 | [ 8] = { "random", &random_fops, NULL }, | 883 | [8] = { "random", 0666, &random_fops, NULL }, |
883 | [ 9] = { "urandom", &urandom_fops, NULL }, | 884 | [9] = { "urandom", 0666, &urandom_fops, NULL }, |
884 | [11] = { "kmsg", &kmsg_fops, NULL }, | 885 | [11] = { "kmsg", 0, &kmsg_fops, NULL }, |
885 | #ifdef CONFIG_CRASH_DUMP | 886 | #ifdef CONFIG_CRASH_DUMP |
886 | [12] = { "oldmem", &oldmem_fops, NULL }, | 887 | [12] = { "oldmem", 0, &oldmem_fops, NULL }, |
887 | #endif | 888 | #endif |
888 | }; | 889 | }; |
889 | 890 | ||
@@ -920,6 +921,13 @@ static const struct file_operations memory_fops = { | |||
920 | .open = memory_open, | 921 | .open = memory_open, |
921 | }; | 922 | }; |
922 | 923 | ||
924 | static char *mem_devnode(struct device *dev, mode_t *mode) | ||
925 | { | ||
926 | if (mode && devlist[MINOR(dev->devt)].mode) | ||
927 | *mode = devlist[MINOR(dev->devt)].mode; | ||
928 | return NULL; | ||
929 | } | ||
930 | |||
923 | static struct class *mem_class; | 931 | static struct class *mem_class; |
924 | 932 | ||
925 | static int __init chr_dev_init(void) | 933 | static int __init chr_dev_init(void) |
@@ -935,6 +943,7 @@ static int __init chr_dev_init(void) | |||
935 | printk("unable to get major %d for memory devs\n", MEM_MAJOR); | 943 | printk("unable to get major %d for memory devs\n", MEM_MAJOR); |
936 | 944 | ||
937 | mem_class = class_create(THIS_MODULE, "mem"); | 945 | mem_class = class_create(THIS_MODULE, "mem"); |
946 | mem_class->devnode = mem_devnode; | ||
938 | for (minor = 1; minor < ARRAY_SIZE(devlist); minor++) { | 947 | for (minor = 1; minor < ARRAY_SIZE(devlist); minor++) { |
939 | if (!devlist[minor].name) | 948 | if (!devlist[minor].name) |
940 | continue; | 949 | continue; |
diff --git a/drivers/char/misc.c b/drivers/char/misc.c index 62c99fa59e2b..1ee27cc23426 100644 --- a/drivers/char/misc.c +++ b/drivers/char/misc.c | |||
@@ -263,12 +263,14 @@ int misc_deregister(struct miscdevice *misc) | |||
263 | EXPORT_SYMBOL(misc_register); | 263 | EXPORT_SYMBOL(misc_register); |
264 | EXPORT_SYMBOL(misc_deregister); | 264 | EXPORT_SYMBOL(misc_deregister); |
265 | 265 | ||
266 | static char *misc_nodename(struct device *dev) | 266 | static char *misc_devnode(struct device *dev, mode_t *mode) |
267 | { | 267 | { |
268 | struct miscdevice *c = dev_get_drvdata(dev); | 268 | struct miscdevice *c = dev_get_drvdata(dev); |
269 | 269 | ||
270 | if (c->devnode) | 270 | if (mode && c->mode) |
271 | return kstrdup(c->devnode, GFP_KERNEL); | 271 | *mode = c->mode; |
272 | if (c->nodename) | ||
273 | return kstrdup(c->nodename, GFP_KERNEL); | ||
272 | return NULL; | 274 | return NULL; |
273 | } | 275 | } |
274 | 276 | ||
@@ -287,7 +289,7 @@ static int __init misc_init(void) | |||
287 | err = -EIO; | 289 | err = -EIO; |
288 | if (register_chrdev(MISC_MAJOR,"misc",&misc_fops)) | 290 | if (register_chrdev(MISC_MAJOR,"misc",&misc_fops)) |
289 | goto fail_printk; | 291 | goto fail_printk; |
290 | misc_class->nodename = misc_nodename; | 292 | misc_class->devnode = misc_devnode; |
291 | return 0; | 293 | return 0; |
292 | 294 | ||
293 | fail_printk: | 295 | fail_printk: |
diff --git a/drivers/char/raw.c b/drivers/char/raw.c index 40268db02e22..64acd05f71c8 100644 --- a/drivers/char/raw.c +++ b/drivers/char/raw.c | |||
@@ -261,7 +261,7 @@ static const struct file_operations raw_ctl_fops = { | |||
261 | 261 | ||
262 | static struct cdev raw_cdev; | 262 | static struct cdev raw_cdev; |
263 | 263 | ||
264 | static char *raw_nodename(struct device *dev) | 264 | static char *raw_devnode(struct device *dev, mode_t *mode) |
265 | { | 265 | { |
266 | return kasprintf(GFP_KERNEL, "raw/%s", dev_name(dev)); | 266 | return kasprintf(GFP_KERNEL, "raw/%s", dev_name(dev)); |
267 | } | 267 | } |
@@ -289,7 +289,7 @@ static int __init raw_init(void) | |||
289 | ret = PTR_ERR(raw_class); | 289 | ret = PTR_ERR(raw_class); |
290 | goto error_region; | 290 | goto error_region; |
291 | } | 291 | } |
292 | raw_class->nodename = raw_nodename; | 292 | raw_class->devnode = raw_devnode; |
293 | device_create(raw_class, NULL, MKDEV(RAW_MAJOR, 0), NULL, "rawctl"); | 293 | device_create(raw_class, NULL, MKDEV(RAW_MAJOR, 0), NULL, "rawctl"); |
294 | 294 | ||
295 | return 0; | 295 | return 0; |
diff --git a/drivers/char/tty_io.c b/drivers/char/tty_io.c index 05f443c47bbe..ea18a129b0b5 100644 --- a/drivers/char/tty_io.c +++ b/drivers/char/tty_io.c | |||
@@ -3070,11 +3070,22 @@ void __init console_init(void) | |||
3070 | } | 3070 | } |
3071 | } | 3071 | } |
3072 | 3072 | ||
3073 | static char *tty_devnode(struct device *dev, mode_t *mode) | ||
3074 | { | ||
3075 | if (!mode) | ||
3076 | return NULL; | ||
3077 | if (dev->devt == MKDEV(TTYAUX_MAJOR, 0) || | ||
3078 | dev->devt == MKDEV(TTYAUX_MAJOR, 2)) | ||
3079 | *mode = 0666; | ||
3080 | return NULL; | ||
3081 | } | ||
3082 | |||
3073 | static int __init tty_class_init(void) | 3083 | static int __init tty_class_init(void) |
3074 | { | 3084 | { |
3075 | tty_class = class_create(THIS_MODULE, "tty"); | 3085 | tty_class = class_create(THIS_MODULE, "tty"); |
3076 | if (IS_ERR(tty_class)) | 3086 | if (IS_ERR(tty_class)) |
3077 | return PTR_ERR(tty_class); | 3087 | return PTR_ERR(tty_class); |
3088 | tty_class->devnode = tty_devnode; | ||
3078 | return 0; | 3089 | return 0; |
3079 | } | 3090 | } |
3080 | 3091 | ||
diff --git a/drivers/gpu/drm/drm_sysfs.c b/drivers/gpu/drm/drm_sysfs.c index f7a615b80c70..5301f226cb1c 100644 --- a/drivers/gpu/drm/drm_sysfs.c +++ b/drivers/gpu/drm/drm_sysfs.c | |||
@@ -76,7 +76,7 @@ static ssize_t version_show(struct class *dev, char *buf) | |||
76 | CORE_MINOR, CORE_PATCHLEVEL, CORE_DATE); | 76 | CORE_MINOR, CORE_PATCHLEVEL, CORE_DATE); |
77 | } | 77 | } |
78 | 78 | ||
79 | static char *drm_nodename(struct device *dev) | 79 | static char *drm_devnode(struct device *dev, mode_t *mode) |
80 | { | 80 | { |
81 | return kasprintf(GFP_KERNEL, "dri/%s", dev_name(dev)); | 81 | return kasprintf(GFP_KERNEL, "dri/%s", dev_name(dev)); |
82 | } | 82 | } |
@@ -112,7 +112,7 @@ struct class *drm_sysfs_create(struct module *owner, char *name) | |||
112 | if (err) | 112 | if (err) |
113 | goto err_out_class; | 113 | goto err_out_class; |
114 | 114 | ||
115 | class->nodename = drm_nodename; | 115 | class->devnode = drm_devnode; |
116 | 116 | ||
117 | return class; | 117 | return class; |
118 | 118 | ||
diff --git a/drivers/hid/usbhid/hiddev.c b/drivers/hid/usbhid/hiddev.c index 4d1dc0cf1401..8b6ee247bfe4 100644 --- a/drivers/hid/usbhid/hiddev.c +++ b/drivers/hid/usbhid/hiddev.c | |||
@@ -852,14 +852,14 @@ static const struct file_operations hiddev_fops = { | |||
852 | #endif | 852 | #endif |
853 | }; | 853 | }; |
854 | 854 | ||
855 | static char *hiddev_nodename(struct device *dev) | 855 | static char *hiddev_devnode(struct device *dev, mode_t *mode) |
856 | { | 856 | { |
857 | return kasprintf(GFP_KERNEL, "usb/%s", dev_name(dev)); | 857 | return kasprintf(GFP_KERNEL, "usb/%s", dev_name(dev)); |
858 | } | 858 | } |
859 | 859 | ||
860 | static struct usb_class_driver hiddev_class = { | 860 | static struct usb_class_driver hiddev_class = { |
861 | .name = "hiddev%d", | 861 | .name = "hiddev%d", |
862 | .nodename = hiddev_nodename, | 862 | .devnode = hiddev_devnode, |
863 | .fops = &hiddev_fops, | 863 | .fops = &hiddev_fops, |
864 | .minor_base = HIDDEV_MINOR_BASE, | 864 | .minor_base = HIDDEV_MINOR_BASE, |
865 | }; | 865 | }; |
diff --git a/drivers/input/input.c b/drivers/input/input.c index 851791d955f3..556539d617a4 100644 --- a/drivers/input/input.c +++ b/drivers/input/input.c | |||
@@ -1265,14 +1265,14 @@ static struct device_type input_dev_type = { | |||
1265 | .uevent = input_dev_uevent, | 1265 | .uevent = input_dev_uevent, |
1266 | }; | 1266 | }; |
1267 | 1267 | ||
1268 | static char *input_nodename(struct device *dev) | 1268 | static char *input_devnode(struct device *dev, mode_t *mode) |
1269 | { | 1269 | { |
1270 | return kasprintf(GFP_KERNEL, "input/%s", dev_name(dev)); | 1270 | return kasprintf(GFP_KERNEL, "input/%s", dev_name(dev)); |
1271 | } | 1271 | } |
1272 | 1272 | ||
1273 | struct class input_class = { | 1273 | struct class input_class = { |
1274 | .name = "input", | 1274 | .name = "input", |
1275 | .nodename = input_nodename, | 1275 | .devnode = input_devnode, |
1276 | }; | 1276 | }; |
1277 | EXPORT_SYMBOL_GPL(input_class); | 1277 | EXPORT_SYMBOL_GPL(input_class); |
1278 | 1278 | ||
diff --git a/drivers/md/dm-ioctl.c b/drivers/md/dm-ioctl.c index 7f77f18fcafa..a67942931582 100644 --- a/drivers/md/dm-ioctl.c +++ b/drivers/md/dm-ioctl.c | |||
@@ -1532,7 +1532,7 @@ static const struct file_operations _ctl_fops = { | |||
1532 | static struct miscdevice _dm_misc = { | 1532 | static struct miscdevice _dm_misc = { |
1533 | .minor = MISC_DYNAMIC_MINOR, | 1533 | .minor = MISC_DYNAMIC_MINOR, |
1534 | .name = DM_NAME, | 1534 | .name = DM_NAME, |
1535 | .devnode = "mapper/control", | 1535 | .nodename = "mapper/control", |
1536 | .fops = &_ctl_fops | 1536 | .fops = &_ctl_fops |
1537 | }; | 1537 | }; |
1538 | 1538 | ||
diff --git a/drivers/media/dvb/dvb-core/dvbdev.c b/drivers/media/dvb/dvb-core/dvbdev.c index 479dd05762a5..94159b90f733 100644 --- a/drivers/media/dvb/dvb-core/dvbdev.c +++ b/drivers/media/dvb/dvb-core/dvbdev.c | |||
@@ -447,7 +447,7 @@ static int dvb_uevent(struct device *dev, struct kobj_uevent_env *env) | |||
447 | return 0; | 447 | return 0; |
448 | } | 448 | } |
449 | 449 | ||
450 | static char *dvb_nodename(struct device *dev) | 450 | static char *dvb_devnode(struct device *dev, mode_t *mode) |
451 | { | 451 | { |
452 | struct dvb_device *dvbdev = dev_get_drvdata(dev); | 452 | struct dvb_device *dvbdev = dev_get_drvdata(dev); |
453 | 453 | ||
@@ -478,7 +478,7 @@ static int __init init_dvbdev(void) | |||
478 | goto error; | 478 | goto error; |
479 | } | 479 | } |
480 | dvb_class->dev_uevent = dvb_uevent; | 480 | dvb_class->dev_uevent = dvb_uevent; |
481 | dvb_class->nodename = dvb_nodename; | 481 | dvb_class->devnode = dvb_devnode; |
482 | return 0; | 482 | return 0; |
483 | 483 | ||
484 | error: | 484 | error: |
diff --git a/drivers/net/tun.c b/drivers/net/tun.c index 3f5d28851aa2..d3ee1994b02f 100644 --- a/drivers/net/tun.c +++ b/drivers/net/tun.c | |||
@@ -1370,7 +1370,7 @@ static const struct file_operations tun_fops = { | |||
1370 | static struct miscdevice tun_miscdev = { | 1370 | static struct miscdevice tun_miscdev = { |
1371 | .minor = TUN_MINOR, | 1371 | .minor = TUN_MINOR, |
1372 | .name = "tun", | 1372 | .name = "tun", |
1373 | .devnode = "net/tun", | 1373 | .nodename = "net/tun", |
1374 | .fops = &tun_fops, | 1374 | .fops = &tun_fops, |
1375 | }; | 1375 | }; |
1376 | 1376 | ||
diff --git a/drivers/usb/class/usblp.c b/drivers/usb/class/usblp.c index 26c09f0257db..9bc112ee7803 100644 --- a/drivers/usb/class/usblp.c +++ b/drivers/usb/class/usblp.c | |||
@@ -1057,14 +1057,14 @@ static const struct file_operations usblp_fops = { | |||
1057 | .release = usblp_release, | 1057 | .release = usblp_release, |
1058 | }; | 1058 | }; |
1059 | 1059 | ||
1060 | static char *usblp_nodename(struct device *dev) | 1060 | static char *usblp_devnode(struct device *dev, mode_t *mode) |
1061 | { | 1061 | { |
1062 | return kasprintf(GFP_KERNEL, "usb/%s", dev_name(dev)); | 1062 | return kasprintf(GFP_KERNEL, "usb/%s", dev_name(dev)); |
1063 | } | 1063 | } |
1064 | 1064 | ||
1065 | static struct usb_class_driver usblp_class = { | 1065 | static struct usb_class_driver usblp_class = { |
1066 | .name = "lp%d", | 1066 | .name = "lp%d", |
1067 | .nodename = usblp_nodename, | 1067 | .devnode = usblp_devnode, |
1068 | .fops = &usblp_fops, | 1068 | .fops = &usblp_fops, |
1069 | .minor_base = USBLP_MINOR_BASE, | 1069 | .minor_base = USBLP_MINOR_BASE, |
1070 | }; | 1070 | }; |
diff --git a/drivers/usb/core/file.c b/drivers/usb/core/file.c index 5cef88929b3e..222ee07ea680 100644 --- a/drivers/usb/core/file.c +++ b/drivers/usb/core/file.c | |||
@@ -67,14 +67,14 @@ static struct usb_class { | |||
67 | struct class *class; | 67 | struct class *class; |
68 | } *usb_class; | 68 | } *usb_class; |
69 | 69 | ||
70 | static char *usb_nodename(struct device *dev) | 70 | static char *usb_devnode(struct device *dev, mode_t *mode) |
71 | { | 71 | { |
72 | struct usb_class_driver *drv; | 72 | struct usb_class_driver *drv; |
73 | 73 | ||
74 | drv = dev_get_drvdata(dev); | 74 | drv = dev_get_drvdata(dev); |
75 | if (!drv || !drv->nodename) | 75 | if (!drv || !drv->devnode) |
76 | return NULL; | 76 | return NULL; |
77 | return drv->nodename(dev); | 77 | return drv->devnode(dev, mode); |
78 | } | 78 | } |
79 | 79 | ||
80 | static int init_usb_class(void) | 80 | static int init_usb_class(void) |
@@ -100,7 +100,7 @@ static int init_usb_class(void) | |||
100 | kfree(usb_class); | 100 | kfree(usb_class); |
101 | usb_class = NULL; | 101 | usb_class = NULL; |
102 | } | 102 | } |
103 | usb_class->class->nodename = usb_nodename; | 103 | usb_class->class->devnode = usb_devnode; |
104 | 104 | ||
105 | exit: | 105 | exit: |
106 | return result; | 106 | return result; |
diff --git a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c index a26f73880c32..43ee943d757a 100644 --- a/drivers/usb/core/usb.c +++ b/drivers/usb/core/usb.c | |||
@@ -311,7 +311,7 @@ static struct dev_pm_ops usb_device_pm_ops = { | |||
311 | #endif /* CONFIG_PM */ | 311 | #endif /* CONFIG_PM */ |
312 | 312 | ||
313 | 313 | ||
314 | static char *usb_nodename(struct device *dev) | 314 | static char *usb_devnode(struct device *dev, mode_t *mode) |
315 | { | 315 | { |
316 | struct usb_device *usb_dev; | 316 | struct usb_device *usb_dev; |
317 | 317 | ||
@@ -324,7 +324,7 @@ struct device_type usb_device_type = { | |||
324 | .name = "usb_device", | 324 | .name = "usb_device", |
325 | .release = usb_release_dev, | 325 | .release = usb_release_dev, |
326 | .uevent = usb_dev_uevent, | 326 | .uevent = usb_dev_uevent, |
327 | .nodename = usb_nodename, | 327 | .devnode = usb_devnode, |
328 | .pm = &usb_device_pm_ops, | 328 | .pm = &usb_device_pm_ops, |
329 | }; | 329 | }; |
330 | 330 | ||
diff --git a/drivers/usb/misc/iowarrior.c b/drivers/usb/misc/iowarrior.c index 90e1a8dedfa9..e75bb87ee92b 100644 --- a/drivers/usb/misc/iowarrior.c +++ b/drivers/usb/misc/iowarrior.c | |||
@@ -727,7 +727,7 @@ static const struct file_operations iowarrior_fops = { | |||
727 | .poll = iowarrior_poll, | 727 | .poll = iowarrior_poll, |
728 | }; | 728 | }; |
729 | 729 | ||
730 | static char *iowarrior_nodename(struct device *dev) | 730 | static char *iowarrior_devnode(struct device *dev, mode_t *mode) |
731 | { | 731 | { |
732 | return kasprintf(GFP_KERNEL, "usb/%s", dev_name(dev)); | 732 | return kasprintf(GFP_KERNEL, "usb/%s", dev_name(dev)); |
733 | } | 733 | } |
@@ -738,7 +738,7 @@ static char *iowarrior_nodename(struct device *dev) | |||
738 | */ | 738 | */ |
739 | static struct usb_class_driver iowarrior_class = { | 739 | static struct usb_class_driver iowarrior_class = { |
740 | .name = "iowarrior%d", | 740 | .name = "iowarrior%d", |
741 | .nodename = iowarrior_nodename, | 741 | .devnode = iowarrior_devnode, |
742 | .fops = &iowarrior_fops, | 742 | .fops = &iowarrior_fops, |
743 | .minor_base = IOWARRIOR_MINOR_BASE, | 743 | .minor_base = IOWARRIOR_MINOR_BASE, |
744 | }; | 744 | }; |
diff --git a/drivers/usb/misc/legousbtower.c b/drivers/usb/misc/legousbtower.c index c1e2433f640d..97efeaec4d52 100644 --- a/drivers/usb/misc/legousbtower.c +++ b/drivers/usb/misc/legousbtower.c | |||
@@ -266,7 +266,7 @@ static const struct file_operations tower_fops = { | |||
266 | .llseek = tower_llseek, | 266 | .llseek = tower_llseek, |
267 | }; | 267 | }; |
268 | 268 | ||
269 | static char *legousbtower_nodename(struct device *dev) | 269 | static char *legousbtower_devnode(struct device *dev, mode_t *mode) |
270 | { | 270 | { |
271 | return kasprintf(GFP_KERNEL, "usb/%s", dev_name(dev)); | 271 | return kasprintf(GFP_KERNEL, "usb/%s", dev_name(dev)); |
272 | } | 272 | } |
@@ -277,7 +277,7 @@ static char *legousbtower_nodename(struct device *dev) | |||
277 | */ | 277 | */ |
278 | static struct usb_class_driver tower_class = { | 278 | static struct usb_class_driver tower_class = { |
279 | .name = "legousbtower%d", | 279 | .name = "legousbtower%d", |
280 | .nodename = legousbtower_nodename, | 280 | .devnode = legousbtower_devnode, |
281 | .fops = &tower_fops, | 281 | .fops = &tower_fops, |
282 | .minor_base = LEGO_USB_TOWER_MINOR_BASE, | 282 | .minor_base = LEGO_USB_TOWER_MINOR_BASE, |
283 | }; | 283 | }; |