aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/misc.c
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2015-02-02 09:44:54 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2015-03-25 06:44:52 -0400
commitbd735995308b553cc3c7f6a975aa284b270c7e2c (patch)
tree599cbb2f030ab78d8a136b7f00fd16bda2e2f799 /drivers/char/misc.c
parent2f9763190dd6356eec95548f4cfa8a36a71f767c (diff)
misc: Add attribute groups
Add groups field to struct miscdevice for passing the attribute groups at device creation. In this way, the driver can avoid the manual call of device_create_file() after the device registration, which is basically a racy operation, in addition to the reduction of manual device_remove_file() calls. Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/char/misc.c')
-rw-r--r--drivers/char/misc.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/char/misc.c b/drivers/char/misc.c
index c892c296a4de..5bb3a2109ab7 100644
--- a/drivers/char/misc.c
+++ b/drivers/char/misc.c
@@ -207,8 +207,9 @@ int misc_register(struct miscdevice * misc)
207 207
208 dev = MKDEV(MISC_MAJOR, misc->minor); 208 dev = MKDEV(MISC_MAJOR, misc->minor);
209 209
210 misc->this_device = device_create(misc_class, misc->parent, dev, 210 misc->this_device =
211 misc, "%s", misc->name); 211 device_create_with_groups(misc_class, misc->parent, dev,
212 misc, misc->groups, "%s", misc->name);
212 if (IS_ERR(misc->this_device)) { 213 if (IS_ERR(misc->this_device)) {
213 int i = DYNAMIC_MINORS - misc->minor - 1; 214 int i = DYNAMIC_MINORS - misc->minor - 1;
214 if (i < DYNAMIC_MINORS && i >= 0) 215 if (i < DYNAMIC_MINORS && i >= 0)