ASoC: pcm: Make ioctl ops optional
authorTakashi Iwai <tiwai@suse.de>
Thu, 21 Nov 2019 19:07:08 +0000 (20:07 +0100)
committerTakashi Iwai <tiwai@suse.de>
Fri, 22 Nov 2019 13:37:50 +0000 (14:37 +0100)
Now PCM core accepts the NULL ioctl ops as default, and passing a proper
ioctl ops is no longer mandatory.  Adjust soc_new_pcm() to allow also
the NULL for component ioctl ops, too.

Acked-by: Mark Brown <broonie@kernel.org>
Link: https://lore.kernel.org/r/20191121190709.29121-2-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/soc/soc-pcm.c

index 493a2e80e8936ffa0d073543e7e9dd79993ddbf6..4dd13c9249abe15aa64067797f68154040f1c141 100644 (file)
@@ -3005,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.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;
        } else {
                rtd->ops.open           = soc_pcm_open;
                rtd->ops.hw_params      = soc_pcm_hw_params;
@@ -3014,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.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;
 
        }
 
        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)
                if (drv->copy_user)
                        rtd->ops.copy_user      = snd_soc_pcm_component_copy_user;
                if (drv->page)