ASoC: pcm: Make ioctl ops optional
[linux-2.6-block.git] / sound / soc / soc-pcm.c
index 1c00119b72e37bfa41ab31e72040485d1f154318..4dd13c9249abe15aa64067797f68154040f1c141 100644 (file)
@@ -1182,6 +1182,7 @@ static int dpcm_be_connect(struct snd_soc_pcm_runtime *fe,
 {
        struct snd_soc_dpcm *dpcm;
        unsigned long flags;
+       char *name;
 
        /* only add new dpcms */
        for_each_dpcm_be(fe, stream, dpcm) {
@@ -1207,9 +1208,15 @@ static int dpcm_be_connect(struct snd_soc_pcm_runtime *fe,
                        stream ? "<-" : "->", be->dai_link->name);
 
 #ifdef CONFIG_DEBUG_FS
-       dpcm->debugfs_state = debugfs_create_dir(be->dai_link->name,
-                                                fe->debugfs_dpcm_root);
-       debugfs_create_u32("state", 0644, dpcm->debugfs_state, &dpcm->state);
+       name = kasprintf(GFP_KERNEL, "%s:%s", be->dai_link->name,
+                        stream ? "capture" : "playback");
+       if (name) {
+               dpcm->debugfs_state = debugfs_create_dir(name,
+                                                        fe->debugfs_dpcm_root);
+               debugfs_create_u32("state", 0644, dpcm->debugfs_state,
+                                  &dpcm->state);
+               kfree(name);
+       }
 #endif
        return 1;
 }
@@ -2998,7 +3005,6 @@ int soc_new_pcm(struct snd_soc_pcm_runtime *rtd, int num)
                rtd->ops.hw_free        = dpcm_fe_dai_hw_free;
                rtd->ops.close          = dpcm_fe_dai_close;
                rtd->ops.pointer        = soc_pcm_pointer;
-               rtd->ops.ioctl          = snd_soc_pcm_component_ioctl;
        } else {
                rtd->ops.open           = soc_pcm_open;
                rtd->ops.hw_params      = soc_pcm_hw_params;
@@ -3007,12 +3013,13 @@ int soc_new_pcm(struct snd_soc_pcm_runtime *rtd, int num)
                rtd->ops.hw_free        = soc_pcm_hw_free;
                rtd->ops.close          = soc_pcm_close;
                rtd->ops.pointer        = soc_pcm_pointer;
-               rtd->ops.ioctl          = snd_soc_pcm_component_ioctl;
        }
 
        for_each_rtd_components(rtd, rtdcom, component) {
                const struct snd_soc_component_driver *drv = component->driver;
 
+               if (drv->ioctl)
+                       rtd->ops.ioctl          = snd_soc_pcm_component_ioctl;
                if (drv->copy_user)
                        rtd->ops.copy_user      = snd_soc_pcm_component_copy_user;
                if (drv->page)