40 #include <linux/module.h>
47 #include <linux/slab.h>
55 #define DRIVER_EMPTY 0
56 #define DRIVER_LOADED (1<<0)
57 #define DRIVER_REQUESTED (1<<1)
58 #define DRIVER_LOCKED (1<<2)
96 static struct ops_list *find_driver(
char *
id,
int create_if_empty);
97 static struct ops_list *create_driver(
char *
id);
99 static void remove_drivers(
void);
105 #ifdef CONFIG_PROC_FS
113 snd_iprintf(buffer,
"snd-%s%s%s%s,%d\n",
128 #ifdef CONFIG_MODULES
130 static int snd_seq_in_init;
144 #ifdef CONFIG_MODULES
160 request_module(
"snd-%s", ops->
id);
183 .
dev_free = snd_seq_device_dev_free,
184 .dev_register = snd_seq_device_dev_register,
185 .dev_disconnect = snd_seq_device_dev_disconnect,
194 ops = find_driver(
id, 1);
198 dev = kzalloc(
sizeof(*dev)*2 + argsize,
GFP_KERNEL);
220 snd_seq_device_free(dev);
240 ops = find_driver(dev->
id, 0);
250 free_device(dev, ops);
263 return snd_seq_device_free(dev);
274 ops = find_driver(dev->
id, 0);
282 init_device(dev, ops);
291 static int snd_seq_device_dev_disconnect(
struct snd_device *device)
296 ops = find_driver(dev->
id, 0);
300 free_device(dev, ops);
322 ops = find_driver(
id, 1);
342 init_device(dev, ops);
356 static struct ops_list * create_driver(
char *
id)
396 ops = find_driver(
id, 0);
411 free_device(dev, ops);
432 static void remove_drivers(
void)
438 while (head != &opslist) {
466 if (ops->
ops.init_device(dev) >= 0) {
493 if ((result = ops->
ops.free_device(dev)) >= 0 || result == -
ENXIO) {
508 static struct ops_list * find_driver(
char *
id,
int create_if_empty)
522 return create_driver(
id);
526 static void unlock_driver(
struct ops_list *ops)
538 static int __init alsa_seq_device_init(
void)
540 #ifdef CONFIG_PROC_FS
541 info_entry = snd_info_create_module_entry(
THIS_MODULE,
"drivers",
543 if (info_entry ==
NULL)
546 info_entry->
c.
text.read = snd_seq_device_info;
547 if (snd_info_register(info_entry) < 0) {
548 snd_info_free_entry(info_entry);
555 static void __exit alsa_seq_device_exit(
void)
558 #ifdef CONFIG_PROC_FS
559 snd_info_free_entry(info_entry);
572 #ifdef CONFIG_MODULES