Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 010f378e authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman
Browse files

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: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 9a92fadc
Loading
Loading
Loading
Loading
+57 −56
Original line number Diff line number Diff line
@@ -24,7 +24,8 @@
/*
	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;

@@ -40,14 +41,14 @@ static void change_volume(struct urb *urb_out, int volume[], int bytes_per_frame
			*p = (*p * volume[chn & 1]) >> 8;
			++chn;
		}
	}
	else if(bytes_per_frame == 6) {
	} else if (bytes_per_frame == 6) {
		unsigned char *p, *buf_end;
		p = (unsigned char *)urb_out->transfer_buffer;
		buf_end = p + urb_out->transfer_buffer_length;

		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;
			p[0] = val;
			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)) {
		urb_out->transfer_buffer = line6pcm->wrap_out;
		memset(line6pcm->wrap_out, 0, urb_size);
	}
	else {
	} else {
		if (line6pcm->pos_out + urb_frames > runtime->buffer_size) {
			/*
				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) {
				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);
			}
			else
			} else
				dev_err(s2m(substream), "driver bug: len = %d\n", len);  /* this is somewhat paranoid */
		}
		else {
		} else {
			/* set the buffer pointer */
			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;

	for(i = 0; i < LINE6_ISO_BUFFERS; ++i)
		if((ret = submit_audio_out_urb(substream)) < 0)
	for (i = 0; i < LINE6_ISO_BUFFERS; ++i) {
		ret = submit_audio_out_urb(substream);
		if (ret < 0)
			return ret;
	}

	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_line6_pcm *line6pcm = snd_pcm_substream_chip(substream);

	if((err = snd_pcm_hw_constraint_ratdens(runtime, 0, SNDRV_PCM_HW_PARAM_RATE,
																					(&line6pcm->properties->snd_line6_rates))) < 0)
	err = snd_pcm_hw_constraint_ratdens(runtime, 0, SNDRV_PCM_HW_PARAM_RATE,
					    (&line6pcm->properties->snd_line6_rates));
	if (err < 0)
		return err;

	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 */

	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;

	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);
	unlink_wait_clear_audio_out_urbs(line6pcm);

	if(line6pcm->wrap_out) {
	kfree(line6pcm->wrap_out);
	line6pcm->wrap_out = NULL;
	}

	return snd_pcm_lib_free_pages(substream);
}