diff options
Diffstat (limited to 'include/sound/seq_device.h')
-rw-r--r-- | include/sound/seq_device.h | 46 |
1 files changed, 29 insertions, 17 deletions
diff --git a/include/sound/seq_device.h b/include/sound/seq_device.h index 2b5f24cc7548..ddc0d504cf39 100644 --- a/include/sound/seq_device.h +++ b/include/sound/seq_device.h | |||
@@ -25,29 +25,26 @@ | |||
25 | * registered device information | 25 | * registered device information |
26 | */ | 26 | */ |
27 | 27 | ||
28 | #define ID_LEN 32 | ||
29 | |||
30 | /* status flag */ | ||
31 | #define SNDRV_SEQ_DEVICE_FREE 0 | ||
32 | #define SNDRV_SEQ_DEVICE_REGISTERED 1 | ||
33 | |||
34 | struct snd_seq_device { | 28 | struct snd_seq_device { |
35 | /* device info */ | 29 | /* device info */ |
36 | struct snd_card *card; /* sound card */ | 30 | struct snd_card *card; /* sound card */ |
37 | int device; /* device number */ | 31 | int device; /* device number */ |
38 | char id[ID_LEN]; /* driver id */ | 32 | const char *id; /* driver id */ |
39 | char name[80]; /* device name */ | 33 | char name[80]; /* device name */ |
40 | int argsize; /* size of the argument */ | 34 | int argsize; /* size of the argument */ |
41 | void *driver_data; /* private data for driver */ | 35 | void *driver_data; /* private data for driver */ |
42 | int status; /* flag - read only */ | ||
43 | void *private_data; /* private data for the caller */ | 36 | void *private_data; /* private data for the caller */ |
44 | void (*private_free)(struct snd_seq_device *device); | 37 | void (*private_free)(struct snd_seq_device *device); |
45 | struct list_head list; /* link to next device */ | 38 | struct device dev; |
46 | }; | 39 | }; |
47 | 40 | ||
41 | #define to_seq_dev(_dev) \ | ||
42 | container_of(_dev, struct snd_seq_device, dev) | ||
43 | |||
44 | /* sequencer driver */ | ||
48 | 45 | ||
49 | /* driver operators | 46 | /* driver operators |
50 | * init_device: | 47 | * probe: |
51 | * Initialize the device with given parameters. | 48 | * Initialize the device with given parameters. |
52 | * Typically, | 49 | * Typically, |
53 | * 1. call snd_hwdep_new | 50 | * 1. call snd_hwdep_new |
@@ -55,25 +52,40 @@ struct snd_seq_device { | |||
55 | * 3. call snd_hwdep_register | 52 | * 3. call snd_hwdep_register |
56 | * 4. store the instance to dev->driver_data pointer. | 53 | * 4. store the instance to dev->driver_data pointer. |
57 | * | 54 | * |
58 | * free_device: | 55 | * remove: |
59 | * Release the private data. | 56 | * Release the private data. |
60 | * Typically, call snd_device_free(dev->card, dev->driver_data) | 57 | * Typically, call snd_device_free(dev->card, dev->driver_data) |
61 | */ | 58 | */ |
62 | struct snd_seq_dev_ops { | 59 | struct snd_seq_driver { |
63 | int (*init_device)(struct snd_seq_device *dev); | 60 | struct device_driver driver; |
64 | int (*free_device)(struct snd_seq_device *dev); | 61 | char *id; |
62 | int argsize; | ||
65 | }; | 63 | }; |
66 | 64 | ||
65 | #define to_seq_drv(_drv) \ | ||
66 | container_of(_drv, struct snd_seq_driver, driver) | ||
67 | |||
67 | /* | 68 | /* |
68 | * prototypes | 69 | * prototypes |
69 | */ | 70 | */ |
71 | #ifdef CONFIG_MODULES | ||
70 | void snd_seq_device_load_drivers(void); | 72 | void snd_seq_device_load_drivers(void); |
71 | int snd_seq_device_new(struct snd_card *card, int device, char *id, int argsize, struct snd_seq_device **result); | 73 | #else |
72 | int snd_seq_device_register_driver(char *id, struct snd_seq_dev_ops *entry, int argsize); | 74 | #define snd_seq_device_load_drivers() |
73 | int snd_seq_device_unregister_driver(char *id); | 75 | #endif |
76 | int snd_seq_device_new(struct snd_card *card, int device, const char *id, | ||
77 | int argsize, struct snd_seq_device **result); | ||
74 | 78 | ||
75 | #define SNDRV_SEQ_DEVICE_ARGPTR(dev) (void *)((char *)(dev) + sizeof(struct snd_seq_device)) | 79 | #define SNDRV_SEQ_DEVICE_ARGPTR(dev) (void *)((char *)(dev) + sizeof(struct snd_seq_device)) |
76 | 80 | ||
81 | int __must_check __snd_seq_driver_register(struct snd_seq_driver *drv, | ||
82 | struct module *mod); | ||
83 | #define snd_seq_driver_register(drv) \ | ||
84 | __snd_seq_driver_register(drv, THIS_MODULE) | ||
85 | void snd_seq_driver_unregister(struct snd_seq_driver *drv); | ||
86 | |||
87 | #define module_snd_seq_driver(drv) \ | ||
88 | module_driver(drv, snd_seq_driver_register, snd_seq_driver_unregister) | ||
77 | 89 | ||
78 | /* | 90 | /* |
79 | * id strings for generic devices | 91 | * id strings for generic devices |