Commit 45af4977 authored by Shawn Bohrer's avatar Shawn Bohrer Committed by Greg Kroah-Hartman

staging: line6: Lindent and fix checkpatch warnings in playback.c

Signed-off-by: default avatarShawn Bohrer <shawn.bohrer@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 034f5857
...@@ -20,7 +20,6 @@ ...@@ -20,7 +20,6 @@
#include "pod.h" #include "pod.h"
#include "playback.h" #include "playback.h"
/* /*
Software stereo volume control. Software stereo volume control.
*/ */
...@@ -68,13 +67,17 @@ static int submit_audio_out_urb(struct snd_pcm_substream *substream) ...@@ -68,13 +67,17 @@ static int submit_audio_out_urb(struct snd_pcm_substream *substream)
int i, urb_size, urb_frames; int i, urb_size, urb_frames;
struct snd_line6_pcm *line6pcm = snd_pcm_substream_chip(substream); struct snd_line6_pcm *line6pcm = snd_pcm_substream_chip(substream);
const int bytes_per_frame = line6pcm->properties->bytes_per_frame; const int bytes_per_frame = line6pcm->properties->bytes_per_frame;
const int frame_increment = line6pcm->properties->snd_line6_rates.rats[0].num_min; const int frame_increment =
const int frame_factor = line6pcm->properties->snd_line6_rates.rats[0].den * (USB_INTERVALS_PER_SECOND / LINE6_ISO_INTERVAL); line6pcm->properties->snd_line6_rates.rats[0].num_min;
const int frame_factor =
line6pcm->properties->snd_line6_rates.rats[0].den *
(USB_INTERVALS_PER_SECOND / LINE6_ISO_INTERVAL);
struct snd_pcm_runtime *runtime = substream->runtime; struct snd_pcm_runtime *runtime = substream->runtime;
struct urb *urb_out; struct urb *urb_out;
spin_lock_irqsave(&line6pcm->lock_audio_out, flags); spin_lock_irqsave(&line6pcm->lock_audio_out, flags);
index = find_first_zero_bit(&line6pcm->active_urb_out, LINE6_ISO_BUFFERS); index =
find_first_zero_bit(&line6pcm->active_urb_out, LINE6_ISO_BUFFERS);
if (index < 0 || index >= LINE6_ISO_BUFFERS) { if (index < 0 || index >= LINE6_ISO_BUFFERS) {
spin_unlock_irqrestore(&line6pcm->lock_audio_out, flags); spin_unlock_irqrestore(&line6pcm->lock_audio_out, flags);
...@@ -88,7 +91,8 @@ static int submit_audio_out_urb(struct snd_pcm_substream *substream) ...@@ -88,7 +91,8 @@ static int submit_audio_out_urb(struct snd_pcm_substream *substream)
for (i = 0; i < LINE6_ISO_PACKETS; ++i) { for (i = 0; i < LINE6_ISO_PACKETS; ++i) {
/* compute frame size for given sampling rate */ /* compute frame size for given sampling rate */
int n, fs; int n, fs;
struct usb_iso_packet_descriptor *fout = &urb_out->iso_frame_desc[i]; struct usb_iso_packet_descriptor *fout =
&urb_out->iso_frame_desc[i];
line6pcm->count_out += frame_increment; line6pcm->count_out += frame_increment;
n = line6pcm->count_out / frame_factor; n = line6pcm->count_out / frame_factor;
line6pcm->count_out -= n * frame_factor; line6pcm->count_out -= n * frame_factor;
...@@ -114,13 +118,23 @@ static int submit_audio_out_urb(struct snd_pcm_substream *substream) ...@@ -114,13 +118,23 @@ static int submit_audio_out_urb(struct snd_pcm_substream *substream)
urb_out->transfer_buffer = line6pcm->wrap_out; urb_out->transfer_buffer = line6pcm->wrap_out;
if (len > 0) { if (len > 0) {
memcpy(line6pcm->wrap_out, runtime->dma_area + line6pcm->pos_out * bytes_per_frame, len * bytes_per_frame); memcpy(line6pcm->wrap_out,
memcpy(line6pcm->wrap_out + len * bytes_per_frame, runtime->dma_area, (urb_frames - len) * bytes_per_frame); runtime->dma_area +
} else line6pcm->pos_out * bytes_per_frame,
dev_err(s2m(substream), "driver bug: len = %d\n", len); /* this is somewhat paranoid */ len * bytes_per_frame);
memcpy(line6pcm->wrap_out +
len * bytes_per_frame, runtime->dma_area,
(urb_frames - len) * bytes_per_frame);
} else {
/* this is somewhat paranoid */
dev_err(s2m(substream),
"driver bug: len = %d\n", len);
}
} else { } else {
/* set the buffer pointer */ /* set the buffer pointer */
urb_out->transfer_buffer = runtime->dma_area + line6pcm->pos_out * bytes_per_frame; urb_out->transfer_buffer =
runtime->dma_area +
line6pcm->pos_out * bytes_per_frame;
} }
} }
...@@ -133,15 +147,19 @@ static int submit_audio_out_urb(struct snd_pcm_substream *substream) ...@@ -133,15 +147,19 @@ static int submit_audio_out_urb(struct snd_pcm_substream *substream)
#if DO_DUMP_PCM_SEND #if DO_DUMP_PCM_SEND
for (i = 0; i < LINE6_ISO_PACKETS; ++i) { for (i = 0; i < LINE6_ISO_PACKETS; ++i) {
struct usb_iso_packet_descriptor *fout = &urb_out->iso_frame_desc[i]; struct usb_iso_packet_descriptor *fout =
line6_write_hexdump(line6pcm->line6, 'P', urb_out->transfer_buffer + fout->offset, fout->length); &urb_out->iso_frame_desc[i];
line6_write_hexdump(line6pcm->line6, 'P',
urb_out->transfer_buffer + fout->offset,
fout->length);
} }
#endif #endif
if (usb_submit_urb(urb_out, GFP_ATOMIC) == 0) if (usb_submit_urb(urb_out, GFP_ATOMIC) == 0)
set_bit(index, &line6pcm->active_urb_out); set_bit(index, &line6pcm->active_urb_out);
else else
dev_err(s2m(substream), "URB out #%d submission failed\n", index); dev_err(s2m(substream), "URB out #%d submission failed\n",
index);
spin_unlock_irqrestore(&line6pcm->lock_audio_out, flags); spin_unlock_irqrestore(&line6pcm->lock_audio_out, flags);
return 0; return 0;
...@@ -224,7 +242,8 @@ static void audio_out_callback(struct urb *urb) ...@@ -224,7 +242,8 @@ static void audio_out_callback(struct urb *urb)
int i, index, length = 0, shutdown = 0; int i, index, length = 0, shutdown = 0;
unsigned long flags; unsigned long flags;
struct snd_pcm_substream *substream = (struct snd_pcm_substream *)urb->context; struct snd_pcm_substream *substream =
(struct snd_pcm_substream *)urb->context;
struct snd_line6_pcm *line6pcm = snd_pcm_substream_chip(substream); struct snd_line6_pcm *line6pcm = snd_pcm_substream_chip(substream);
struct snd_pcm_runtime *runtime = substream->runtime; struct snd_pcm_runtime *runtime = substream->runtime;
...@@ -240,7 +259,8 @@ static void audio_out_callback(struct urb *urb) ...@@ -240,7 +259,8 @@ static void audio_out_callback(struct urb *urb)
length += urb->iso_frame_desc[i].length; length += urb->iso_frame_desc[i].length;
spin_lock_irqsave(&line6pcm->lock_audio_out, flags); spin_lock_irqsave(&line6pcm->lock_audio_out, flags);
line6pcm->pos_out_done += length / line6pcm->properties->bytes_per_frame; line6pcm->pos_out_done +=
length / line6pcm->properties->bytes_per_frame;
if (line6pcm->pos_out_done >= runtime->buffer_size) if (line6pcm->pos_out_done >= runtime->buffer_size)
line6pcm->pos_out_done -= runtime->buffer_size; line6pcm->pos_out_done -= runtime->buffer_size;
...@@ -276,7 +296,8 @@ static int snd_line6_playback_open(struct snd_pcm_substream *substream) ...@@ -276,7 +296,8 @@ static int snd_line6_playback_open(struct snd_pcm_substream *substream)
struct snd_line6_pcm *line6pcm = snd_pcm_substream_chip(substream); struct snd_line6_pcm *line6pcm = snd_pcm_substream_chip(substream);
err = snd_pcm_hw_constraint_ratdens(runtime, 0, SNDRV_PCM_HW_PARAM_RATE, err = snd_pcm_hw_constraint_ratdens(runtime, 0, SNDRV_PCM_HW_PARAM_RATE,
(&line6pcm->properties->snd_line6_rates)); (&line6pcm->properties->
snd_line6_rates));
if (err < 0) if (err < 0)
return err; return err;
...@@ -291,7 +312,8 @@ static int snd_line6_playback_close(struct snd_pcm_substream *substream) ...@@ -291,7 +312,8 @@ static int snd_line6_playback_close(struct snd_pcm_substream *substream)
} }
/* hw_params playback callback */ /* hw_params playback callback */
static int snd_line6_playback_hw_params(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *hw_params) static int snd_line6_playback_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *hw_params)
{ {
int ret; int ret;
struct snd_line6_pcm *line6pcm = snd_pcm_substream_chip(substream); struct snd_line6_pcm *line6pcm = snd_pcm_substream_chip(substream);
...@@ -349,7 +371,8 @@ int snd_line6_playback_trigger(struct snd_pcm_substream *substream, int cmd) ...@@ -349,7 +371,8 @@ int snd_line6_playback_trigger(struct snd_pcm_substream *substream, int cmd)
err = submit_audio_out_all_urbs(substream); err = submit_audio_out_all_urbs(substream);
if (err < 0) { if (err < 0) {
clear_bit(BIT_RUNNING_PLAYBACK, &line6pcm->flags); clear_bit(BIT_RUNNING_PLAYBACK,
&line6pcm->flags);
return err; return err;
} }
} }
...@@ -406,7 +429,8 @@ int create_audio_out_urbs(struct snd_line6_pcm *line6pcm) ...@@ -406,7 +429,8 @@ int create_audio_out_urbs(struct snd_line6_pcm *line6pcm)
struct urb *urb; struct urb *urb;
/* URB for audio out: */ /* URB for audio out: */
urb = line6pcm->urb_audio_out[i] = usb_alloc_urb(LINE6_ISO_PACKETS, GFP_KERNEL); urb = line6pcm->urb_audio_out[i] =
usb_alloc_urb(LINE6_ISO_PACKETS, GFP_KERNEL);
if (urb == NULL) { if (urb == NULL) {
dev_err(line6pcm->line6->ifcdev, "Out of memory\n"); dev_err(line6pcm->line6->ifcdev, "Out of memory\n");
...@@ -414,7 +438,10 @@ int create_audio_out_urbs(struct snd_line6_pcm *line6pcm) ...@@ -414,7 +438,10 @@ int create_audio_out_urbs(struct snd_line6_pcm *line6pcm)
} }
urb->dev = line6pcm->line6->usbdev; urb->dev = line6pcm->line6->usbdev;
urb->pipe = usb_sndisocpipe(line6pcm->line6->usbdev, line6pcm->ep_audio_write & USB_ENDPOINT_NUMBER_MASK); urb->pipe =
usb_sndisocpipe(line6pcm->line6->usbdev,
line6pcm->
ep_audio_write & USB_ENDPOINT_NUMBER_MASK);
urb->transfer_flags = URB_ISO_ASAP; urb->transfer_flags = URB_ISO_ASAP;
urb->start_frame = -1; urb->start_frame = -1;
urb->number_of_packets = LINE6_ISO_PACKETS; urb->number_of_packets = LINE6_ISO_PACKETS;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment