aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/sound/pcm.h1
-rw-r--r--sound/core/pcm.c18
2 files changed, 14 insertions, 5 deletions
diff --git a/include/sound/pcm.h b/include/sound/pcm.h
index 2f645dfd7f70..016c41893b06 100644
--- a/include/sound/pcm.h
+++ b/include/sound/pcm.h
@@ -427,6 +427,7 @@ struct snd_pcm {
427 wait_queue_head_t open_wait; 427 wait_queue_head_t open_wait;
428 void *private_data; 428 void *private_data;
429 void (*private_free) (struct snd_pcm *pcm); 429 void (*private_free) (struct snd_pcm *pcm);
430 struct device *dev; /* actual hw device this belongs to */
430#if defined(CONFIG_SND_PCM_OSS) || defined(CONFIG_SND_PCM_OSS_MODULE) 431#if defined(CONFIG_SND_PCM_OSS) || defined(CONFIG_SND_PCM_OSS_MODULE)
431 struct snd_pcm_oss oss; 432 struct snd_pcm_oss oss;
432#endif 433#endif
diff --git a/sound/core/pcm.c b/sound/core/pcm.c
index 8e0189885516..4701f07ee0ae 100644
--- a/sound/core/pcm.c
+++ b/sound/core/pcm.c
@@ -944,6 +944,7 @@ static int snd_pcm_dev_register(struct snd_device *device)
944 struct list_head *list; 944 struct list_head *list;
945 char str[16]; 945 char str[16];
946 struct snd_pcm *pcm = device->device_data; 946 struct snd_pcm *pcm = device->device_data;
947 struct device *dev;
947 948
948 snd_assert(pcm != NULL && device != NULL, return -ENXIO); 949 snd_assert(pcm != NULL && device != NULL, return -ENXIO);
949 mutex_lock(&register_mutex); 950 mutex_lock(&register_mutex);
@@ -966,11 +967,18 @@ static int snd_pcm_dev_register(struct snd_device *device)
966 devtype = SNDRV_DEVICE_TYPE_PCM_CAPTURE; 967 devtype = SNDRV_DEVICE_TYPE_PCM_CAPTURE;
967 break; 968 break;
968 } 969 }
969 if ((err = snd_register_device(devtype, pcm->card, 970 /* device pointer to use, pcm->dev takes precedence if
970 pcm->device, 971 * it is assigned, otherwise fall back to card's device
971 &snd_pcm_f_ops[cidx], 972 * if possible */
972 pcm, str)) < 0) 973 dev = pcm->dev;
973 { 974 if (!dev)
975 dev = pcm->card ? pcm->card->dev : NULL;
976 /* register pcm */
977 err = snd_register_device_for_dev(devtype, pcm->card,
978 pcm->device,
979 &snd_pcm_f_ops[cidx],
980 pcm, str, dev);
981 if (err < 0) {
974 list_del(&pcm->list); 982 list_del(&pcm->list);
975 mutex_unlock(&register_mutex); 983 mutex_unlock(&register_mutex);
976 return err; 984 return err;