summaryrefslogtreecommitdiffstats
path: root/sound/core/init.c
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2014-01-29 15:53:35 +0100
committerTakashi Iwai <tiwai@suse.de>2014-02-25 12:12:51 +0100
commit289ca025ee1d78223e3368801fc2b984e5efbfc7 (patch)
tree0fbd1be93a83c459e7c053d4959fe149ec3f1785 /sound/core/init.c
parent71e2e1c147e653ee4e861b8b5dc0ae5c394870d2 (diff)
downloadop-kernel-dev-289ca025ee1d78223e3368801fc2b984e5efbfc7.zip
op-kernel-dev-289ca025ee1d78223e3368801fc2b984e5efbfc7.tar.gz
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 b7085eb..9e7f17b 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,
return 0;
__error_ctl:
- snd_device_free_all(card, SNDRV_DEV_CMD_PRE);
+ snd_device_free_all(card);
__error:
put_device(&card->card_dev);
return err;
@@ -454,16 +454,8 @@ static int snd_card_do_free(struct snd_card *card)
if (snd_mixer_oss_notify_callback)
snd_mixer_oss_notify_callback(card, SND_MIXER_OSS_NOTIFY_FREE);
#endif
- if (snd_device_free_all(card, SNDRV_DEV_CMD_PRE) < 0) {
- dev_err(card->dev, "unable to free all devices (pre)\n");
- /* Fatal, but this situation should never occur */
- }
- if (snd_device_free_all(card, SNDRV_DEV_CMD_NORMAL) < 0) {
- dev_err(card->dev, "unable to free all devices (normal)\n");
- /* Fatal, but this situation should never occur */
- }
- if (snd_device_free_all(card, SNDRV_DEV_CMD_POST) < 0) {
- dev_err(card->dev, "unable to free all devices (post)\n");
+ if (snd_device_free_all(card) < 0) {
+ dev_err(card->dev, "unable to free all devices\n");
/* Fatal, but this situation should never occur */
}
if (card->private_free)
OpenPOWER on IntegriCloud