@@ -342,5 +342,9 @@ int snd_soc_component_pointer(struct snd_soc_component *component,
int snd_soc_component_ioctl(struct snd_soc_component *component,
struct snd_pcm_substream *substream,
unsigned int cmd, void *arg);
+int snd_soc_component_copy_user(struct snd_soc_component *component,
+ struct snd_pcm_substream *substream,
+ int channel, unsigned long pos,
+ void __user *buf, unsigned long bytes);
#endif /* __SOC_COMPONENT_H */
@@ -368,3 +368,16 @@ int snd_soc_component_ioctl(struct snd_soc_component *component,
return -ENOTSUPP;
}
+
+int snd_soc_component_copy_user(struct snd_soc_component *component,
+ struct snd_pcm_substream *substream,
+ int channel, unsigned long pos,
+ void __user *buf, unsigned long bytes)
+{
+ if (component->driver->ops &&
+ component->driver->ops->copy_user)
+ return component->driver->ops->copy_user(substream, channel,
+ pos, buf, bytes);
+
+ return -ENOTSUPP;
+}
@@ -2862,17 +2862,16 @@ static int soc_rtdcom_copy_user(struct snd_pcm_substream *substream, int channel
struct snd_soc_pcm_runtime *rtd = substream->private_data;
struct snd_soc_rtdcom_list *rtdcom;
struct snd_soc_component *component;
+ int ret;
for_each_rtdcom(rtd, rtdcom) {
component = rtdcom->component;
- if (!component->driver->ops ||
- !component->driver->ops->copy_user)
- continue;
-
+ ret = snd_soc_component_copy_user(component, substream, channel,
+ pos, buf, bytes);
/* FIXME. it returns 1st copy now */
- return component->driver->ops->copy_user(substream, channel,
- pos, buf, bytes);
+ if (ret != -ENOTSUPP)
+ return ret;
}
return -EINVAL;