Staging: line6: fix checkpatch errors in playback.c

2 errors left, but they are minor.
Lots of warnings also fixed up.

Cc: Markus Grabner <grabner@icg.tugraz.at>
Cc: Mariusz Kozlowski <m.kozlowski@tuxland.pl>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
Greg Kroah-Hartman 2009-02-27 22:41:12 -08:00
Родитель 9a92fadcc6
Коммит 010f378e8c
1 изменённых файлов: 57 добавлений и 56 удалений

Просмотреть файл

@ -24,7 +24,8 @@
/* /*
Software stereo volume control. Software stereo volume control.
*/ */
static void change_volume(struct urb *urb_out, int volume[], int bytes_per_frame) static void change_volume(struct urb *urb_out, int volume[],
int bytes_per_frame)
{ {
int chn = 0; int chn = 0;
@ -40,14 +41,14 @@ static void change_volume(struct urb *urb_out, int volume[], int bytes_per_frame
*p = (*p * volume[chn & 1]) >> 8; *p = (*p * volume[chn & 1]) >> 8;
++chn; ++chn;
} }
} } else if (bytes_per_frame == 6) {
else if(bytes_per_frame == 6) {
unsigned char *p, *buf_end; unsigned char *p, *buf_end;
p = (unsigned char *)urb_out->transfer_buffer; p = (unsigned char *)urb_out->transfer_buffer;
buf_end = p + urb_out->transfer_buffer_length; buf_end = p + urb_out->transfer_buffer_length;
for (; p < buf_end; p += 3) { for (; p < buf_end; p += 3) {
int val = p[0] + (p[1] << 8) + ((signed char)p[2] << 16); int val;
val = p[0] + (p[1] << 8) + ((signed char)p[2] << 16);
val = (val * volume[chn & 1]) >> 8; val = (val * volume[chn & 1]) >> 8;
p[0] = val; p[0] = val;
p[1] = val >> 8; p[1] = val >> 8;
@ -102,8 +103,7 @@ static int submit_audio_out_urb(struct snd_pcm_substream *substream)
if (test_bit(BIT_PAUSE_PLAYBACK, &line6pcm->flags)) { if (test_bit(BIT_PAUSE_PLAYBACK, &line6pcm->flags)) {
urb_out->transfer_buffer = line6pcm->wrap_out; urb_out->transfer_buffer = line6pcm->wrap_out;
memset(line6pcm->wrap_out, 0, urb_size); memset(line6pcm->wrap_out, 0, urb_size);
} } else {
else {
if (line6pcm->pos_out + urb_frames > runtime->buffer_size) { if (line6pcm->pos_out + urb_frames > runtime->buffer_size) {
/* /*
The transferred area goes over buffer boundary, The transferred area goes over buffer boundary,
@ -116,11 +116,9 @@ static int submit_audio_out_urb(struct snd_pcm_substream *substream)
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, runtime->dma_area + line6pcm->pos_out * bytes_per_frame, len * bytes_per_frame);
memcpy(line6pcm->wrap_out + len * bytes_per_frame, runtime->dma_area, (urb_frames - len) * bytes_per_frame); memcpy(line6pcm->wrap_out + len * bytes_per_frame, runtime->dma_area, (urb_frames - len) * bytes_per_frame);
} } else
else
dev_err(s2m(substream), "driver bug: len = %d\n", len); /* this is somewhat paranoid */ dev_err(s2m(substream), "driver bug: len = %d\n", len); /* this is somewhat paranoid */
} } 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;
} }
@ -156,9 +154,11 @@ static int submit_audio_out_all_urbs(struct snd_pcm_substream *substream)
{ {
int ret, i; int ret, i;
for(i = 0; i < LINE6_ISO_BUFFERS; ++i) for (i = 0; i < LINE6_ISO_BUFFERS; ++i) {
if((ret = submit_audio_out_urb(substream)) < 0) ret = submit_audio_out_urb(substream);
if (ret < 0)
return ret; return ret;
}
return 0; return 0;
} }
@ -275,8 +275,9 @@ static int snd_line6_playback_open(struct snd_pcm_substream *substream)
struct snd_pcm_runtime *runtime = substream->runtime; struct snd_pcm_runtime *runtime = substream->runtime;
struct snd_line6_pcm *line6pcm = snd_pcm_substream_chip(substream); struct snd_line6_pcm *line6pcm = snd_pcm_substream_chip(substream);
if((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))) < 0) (&line6pcm->properties->snd_line6_rates));
if (err < 0)
return err; return err;
runtime->hw = line6pcm->properties->snd_line6_playback_hw; runtime->hw = line6pcm->properties->snd_line6_playback_hw;
@ -307,7 +308,9 @@ static int snd_line6_playback_hw_params(struct snd_pcm_substream *substream, str
} }
/* -- [FD] end */ /* -- [FD] end */
if((ret = snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(hw_params))) < 0) ret = snd_pcm_lib_malloc_pages(substream,
params_buffer_bytes(hw_params));
if (ret < 0)
return ret; return ret;
line6pcm->period_out = params_period_bytes(hw_params); line6pcm->period_out = params_period_bytes(hw_params);
@ -327,10 +330,8 @@ static int snd_line6_playback_hw_free(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);
unlink_wait_clear_audio_out_urbs(line6pcm); unlink_wait_clear_audio_out_urbs(line6pcm);
if(line6pcm->wrap_out) {
kfree(line6pcm->wrap_out); kfree(line6pcm->wrap_out);
line6pcm->wrap_out = NULL; line6pcm->wrap_out = NULL;
}
return snd_pcm_lib_free_pages(substream); return snd_pcm_lib_free_pages(substream);
} }