aboutsummaryrefslogtreecommitdiffstats
path: root/sound/core/init.c
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 /sound/core/init.c
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 'sound/core/init.c')
-rw-r--r--sound/core/init.c14
1 files changed, 3 insertions, 11 deletions
diff --git a/sound/core/init.c b/sound/core/init.c
index b7085eb19079..9e7f17b72fb6 100644
--- a/sound/core/init.c
+++ b/sound/core/init.c
@@ -266,7 +266,7 @@ int snd_card_new(struct device *parent, int idx, const char *xid,
266 return 0; 266 return 0;
267 267
268 __error_ctl: 268 __error_ctl:
269 snd_device_free_all(card, SNDRV_DEV_CMD_PRE); 269 snd_device_free_all(card);
270 __error: 270 __error:
271 put_device(&card->card_dev); 271 put_device(&card->card_dev);
272 return err; 272 return err;
@@ -454,16 +454,8 @@ static int snd_card_do_free(struct snd_card *card)
454 if (snd_mixer_oss_notify_callback) 454 if (snd_mixer_oss_notify_callback)
455 snd_mixer_oss_notify_callback(card, SND_MIXER_OSS_NOTIFY_FREE); 455 snd_mixer_oss_notify_callback(card, SND_MIXER_OSS_NOTIFY_FREE);
456#endif 456#endif
457 if (snd_device_free_all(card, SNDRV_DEV_CMD_PRE) < 0) { 457 if (snd_device_free_all(card) < 0) {
458 dev_err(card->dev, "unable to free all devices (pre)\n"); 458 dev_err(card->dev, "unable to free all devices\n");
459 /* Fatal, but this situation should never occur */
460 }
461 if (snd_device_free_all(card, SNDRV_DEV_CMD_NORMAL) < 0) {
462 dev_err(card->dev, "unable to free all devices (normal)\n");
463 /* Fatal, but this situation should never occur */
464 }
465 if (snd_device_free_all(card, SNDRV_DEV_CMD_POST) < 0) {
466 dev_err(card->dev, "unable to free all devices (post)\n");
467 /* Fatal, but this situation should never occur */ 459 /* Fatal, but this situation should never occur */
468 } 460 }
469 if (card->private_free) 461 if (card->private_free)