Lines Matching refs:misc
3 * linux/drivers/char/misc.c
5 * Generic misc open routine by Johan Myreen
15 * of the misc drivers, as they are now completely independent. Linus.
24 * Renamed to misc and miscdevice to be more accurate. Alan Cox 26-Mar-96
157 * @misc: device structure
173 int misc_register(struct miscdevice *misc)
177 bool is_dynamic = (misc->minor == MISC_DYNAMIC_MINOR);
179 INIT_LIST_HEAD(&misc->list);
190 misc->minor = DYNAMIC_MINORS - i - 1;
196 if (c->minor == misc->minor) {
203 dev = MKDEV(MISC_MAJOR, misc->minor);
205 misc->this_device =
206 device_create_with_groups(misc_class, misc->parent, dev,
207 misc, misc->groups, "%s", misc->name);
208 if (IS_ERR(misc->this_device)) {
210 int i = DYNAMIC_MINORS - misc->minor - 1;
214 misc->minor = MISC_DYNAMIC_MINOR;
216 err = PTR_ERR(misc->this_device);
224 list_add(&misc->list, &misc_list);
233 * @misc: device to unregister
239 void misc_deregister(struct miscdevice *misc)
241 int i = DYNAMIC_MINORS - misc->minor - 1;
243 if (WARN_ON(list_empty(&misc->list)))
247 list_del(&misc->list);
248 device_destroy(misc_class, MKDEV(MISC_MAJOR, misc->minor));
271 ret = proc_create_seq("misc", 0, NULL, &misc_seq_ops);
272 misc_class = class_create(THIS_MODULE, "misc");
278 if (register_chrdev(MISC_MAJOR, "misc", &misc_fops))
284 pr_err("unable to get major %d for misc devices\n", MISC_MAJOR);
288 remove_proc_entry("misc", NULL);