ALSA: line6: Make common PCM pointer callback
authorTakashi Iwai <tiwai@suse.de>
Tue, 27 Jan 2015 14:41:27 +0000 (15:41 +0100)
committerTakashi Iwai <tiwai@suse.de>
Wed, 28 Jan 2015 06:22:45 +0000 (07:22 +0100)
Both playback and capture callbacks are identical, so let's merge
them.

Tested-by: Chris Rorvick <chris@rorvick.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/usb/line6/capture.c
sound/usb/line6/pcm.c
sound/usb/line6/pcm.h
sound/usb/line6/playback.c

index 7b8186b6c0e42f34200da610fa15c41729828701..4183c5f5edc25653583aa0723922c616c0edb11c 100644 (file)
@@ -231,15 +231,6 @@ static int snd_line6_capture_close(struct snd_pcm_substream *substream)
        return 0;
 }
 
-/* capture pointer callback */
-static snd_pcm_uframes_t
-snd_line6_capture_pointer(struct snd_pcm_substream *substream)
-{
-       struct snd_line6_pcm *line6pcm = snd_pcm_substream_chip(substream);
-
-       return line6pcm->in.pos_done;
-}
-
 /* capture operators */
 struct snd_pcm_ops snd_line6_capture_ops = {
        .open = snd_line6_capture_open,
@@ -249,7 +240,7 @@ struct snd_pcm_ops snd_line6_capture_ops = {
        .hw_free = snd_line6_hw_free,
        .prepare = snd_line6_prepare,
        .trigger = snd_line6_trigger,
-       .pointer = snd_line6_capture_pointer,
+       .pointer = snd_line6_pointer,
 };
 
 int line6_create_audio_in_urbs(struct snd_line6_pcm *line6pcm)
index 470fc1049d54e36180a302188c6d71f6b87bea33..73c87467d2e0202c59be15b843367fe57d221d0c 100644 (file)
@@ -266,6 +266,15 @@ int snd_line6_trigger(struct snd_pcm_substream *substream, int cmd)
        return 0;
 }
 
+/* common PCM pointer callback */
+snd_pcm_uframes_t snd_line6_pointer(struct snd_pcm_substream *substream)
+{
+       struct snd_line6_pcm *line6pcm = snd_pcm_substream_chip(substream);
+       struct line6_pcm_stream *pstr = get_stream(line6pcm, substream->stream);
+
+       return pstr->pos_done;
+}
+
 /* Acquire and start duplex streams:
  * type is either LINE6_STREAM_IMPULSE or LINE6_STREAM_MONITOR
  */
index 66f603dfa34e9ad8cb3d82c2e2511ccc6e382a23..42d3e6fc2c61d7a05d79fc420761f87e407f4583 100644 (file)
@@ -214,6 +214,7 @@ extern int snd_line6_prepare(struct snd_pcm_substream *substream);
 extern int snd_line6_hw_params(struct snd_pcm_substream *substream,
                               struct snd_pcm_hw_params *hw_params);
 extern int snd_line6_hw_free(struct snd_pcm_substream *substream);
+extern snd_pcm_uframes_t snd_line6_pointer(struct snd_pcm_substream *substream);
 extern void line6_pcm_disconnect(struct snd_line6_pcm *line6pcm);
 extern int line6_pcm_acquire(struct snd_line6_pcm *line6pcm, int type);
 extern void line6_pcm_release(struct snd_line6_pcm *line6pcm, int type);
index f8b04e2d36b3d71c5c4baea261ff6f64298ed12d..1708c05f14dbeff506bef82d463782dce375955c 100644 (file)
@@ -380,15 +380,6 @@ static int snd_line6_playback_close(struct snd_pcm_substream *substream)
        return 0;
 }
 
-/* playback pointer callback */
-static snd_pcm_uframes_t
-snd_line6_playback_pointer(struct snd_pcm_substream *substream)
-{
-       struct snd_line6_pcm *line6pcm = snd_pcm_substream_chip(substream);
-
-       return line6pcm->out.pos_done;
-}
-
 /* playback operators */
 struct snd_pcm_ops snd_line6_playback_ops = {
        .open = snd_line6_playback_open,
@@ -398,7 +389,7 @@ struct snd_pcm_ops snd_line6_playback_ops = {
        .hw_free = snd_line6_hw_free,
        .prepare = snd_line6_prepare,
        .trigger = snd_line6_trigger,
-       .pointer = snd_line6_playback_pointer,
+       .pointer = snd_line6_pointer,
 };
 
 int line6_create_audio_out_urbs(struct snd_line6_pcm *line6pcm)