#include <linux/kernel.h> #include <linux/slab.h> #include <linux/module.h> #include <linux/err.h> #include <linux/usb/composite.h> static LIST_HEAD(func_list); static DEFINE_MUTEX(func_lock);
static struct usb_function_instance *try_get_usb_function_instance(const char *name) { struct usb_function_driver *fd; struct usb_function_instance *fi; fi = ERR_PTR(-ENOENT); mutex_lock(&func_lock); list_for_each_entry(fd, &func_list, list) { if (strcmp(name, fd->name)) continue; if (!try_module_get(fd->mod)) { fi = ERR_PTR(-EBUSY); break; } fi = fd->alloc_inst(); if (IS_ERR(fi)) module_put(fd->mod); else fi->fd = fd; break; } mutex_unlock(&func_lock); return fi; }Contributors
Person | Tokens | Prop | Commits | CommitProp |
Sebastian Andrzej Siewior | 118 | 100.00% | 1 | 100.00% |
Total | 118 | 100.00% | 1 | 100.00% |
Person | Tokens | Prop | Commits | CommitProp |
Sebastian Andrzej Siewior | 82 | 100.00% | 1 | 100.00% |
Total | 82 | 100.00% | 1 | 100.00% |
Person | Tokens | Prop | Commits | CommitProp |
Sebastian Andrzej Siewior | 47 | 100.00% | 1 | 100.00% |
Total | 47 | 100.00% | 1 | 100.00% |
Person | Tokens | Prop | Commits | CommitProp |
Sebastian Andrzej Siewior | 41 | 100.00% | 1 | 100.00% |
Total | 41 | 100.00% | 1 | 100.00% |
Person | Tokens | Prop | Commits | CommitProp |
Sebastian Andrzej Siewior | 23 | 100.00% | 1 | 100.00% |
Total | 23 | 100.00% | 1 | 100.00% |
Person | Tokens | Prop | Commits | CommitProp |
Sebastian Andrzej Siewior | 82 | 100.00% | 1 | 100.00% |
Total | 82 | 100.00% | 1 | 100.00% |
Person | Tokens | Prop | Commits | CommitProp |
Sebastian Andrzej Siewior | 30 | 100.00% | 1 | 100.00% |
Total | 30 | 100.00% | 1 | 100.00% |
Person | Tokens | Prop | Commits | CommitProp |
Sebastian Andrzej Siewior | 480 | 100.00% | 1 | 100.00% |
Total | 480 | 100.00% | 1 | 100.00% |