aboutsummaryrefslogtreecommitdiffstats
path: root/include/sound/core.h
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2014-01-29 09:53:35 -0500
committerTakashi Iwai <tiwai@suse.de>2014-02-25 06:12:51 -0500
commit289ca025ee1d78223e3368801fc2b984e5efbfc7 (patch)
tree0fbd1be93a83c459e7c053d4959fe149ec3f1785 /include/sound/core.h
parent71e2e1c147e653ee4e861b8b5dc0ae5c394870d2 (diff)
ALSA: Use priority list for managing device list
Basically, the device type specifies the priority of the device to be registered / freed, too. However, the priority value isn't well utilized but only it's checked as a group. This results in inconsistent register and free order (where each of them should be in reversed direction). This patch simplifies the device list management code by simply inserting a list entry at creation time in an incremental order for the priority value. Since we can just follow the link for register, disconnect and free calls, we don't have to specify the group; so the whole enum definitions are also simplified as well. The visible change to outside is that the priorities of some object types are revisited. For example, now the SNDRV_DEV_LOWLEVEL object is registered before others (control, PCM, etc) and, in return, released after others. Similarly, SNDRV_DEV_CODEC is in a lower priority than SNDRV_DEV_BUS for ensuring the dependency. Also, the unused SNDRV_DEV_TOPLEVEL, SNDRV_DEV_LOWLEVEL_PRE and SNDRV_DEV_LOWLEVEL_NORMAL are removed as a cleanup. Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'include/sound/core.h')
-rw-r--r--include/sound/core.h28
1 files changed, 10 insertions, 18 deletions
diff --git a/include/sound/core.h b/include/sound/core.h
index 9c1187334195..f1e41f4b067f 100644
--- a/include/sound/core.h
+++ b/include/sound/core.h
@@ -46,24 +46,22 @@ struct completion;
46 46
47/* device allocation stuff */ 47/* device allocation stuff */
48 48
49#define SNDRV_DEV_TYPE_RANGE_SIZE 0x1000 49/* type of the object used in snd_device_*()
50 50 * this also defines the calling order
51 */
51enum snd_device_type { 52enum snd_device_type {
52 SNDRV_DEV_TOPLEVEL = 0, 53 SNDRV_DEV_LOWLEVEL,
53 SNDRV_DEV_CONTROL = 1, 54 SNDRV_DEV_CONTROL,
54 SNDRV_DEV_LOWLEVEL_PRE = 2, 55 SNDRV_DEV_INFO,
55 SNDRV_DEV_LOWLEVEL_NORMAL = 0x1000, 56 SNDRV_DEV_BUS,
57 SNDRV_DEV_CODEC,
56 SNDRV_DEV_PCM, 58 SNDRV_DEV_PCM,
59 SNDRV_DEV_COMPRESS,
57 SNDRV_DEV_RAWMIDI, 60 SNDRV_DEV_RAWMIDI,
58 SNDRV_DEV_TIMER, 61 SNDRV_DEV_TIMER,
59 SNDRV_DEV_SEQUENCER, 62 SNDRV_DEV_SEQUENCER,
60 SNDRV_DEV_HWDEP, 63 SNDRV_DEV_HWDEP,
61 SNDRV_DEV_INFO,
62 SNDRV_DEV_BUS,
63 SNDRV_DEV_CODEC,
64 SNDRV_DEV_JACK, 64 SNDRV_DEV_JACK,
65 SNDRV_DEV_COMPRESS,
66 SNDRV_DEV_LOWLEVEL = 0x2000,
67}; 65};
68 66
69enum snd_device_state { 67enum snd_device_state {
@@ -72,12 +70,6 @@ enum snd_device_state {
72 SNDRV_DEV_DISCONNECTED, 70 SNDRV_DEV_DISCONNECTED,
73}; 71};
74 72
75enum snd_device_cmd {
76 SNDRV_DEV_CMD_PRE,
77 SNDRV_DEV_CMD_NORMAL,
78 SNDRV_DEV_CMD_POST,
79};
80
81struct snd_device; 73struct snd_device;
82 74
83struct snd_device_ops { 75struct snd_device_ops {
@@ -320,7 +312,7 @@ int snd_device_register_all(struct snd_card *card);
320int snd_device_disconnect(struct snd_card *card, void *device_data); 312int snd_device_disconnect(struct snd_card *card, void *device_data);
321int snd_device_disconnect_all(struct snd_card *card); 313int snd_device_disconnect_all(struct snd_card *card);
322int snd_device_free(struct snd_card *card, void *device_data); 314int snd_device_free(struct snd_card *card, void *device_data);
323int snd_device_free_all(struct snd_card *card, enum snd_device_cmd cmd); 315int snd_device_free_all(struct snd_card *card);
324 316
325/* isadma.c */ 317/* isadma.c */
326 318