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

Commit a75af077 authored by Tomas Winkler's avatar Tomas Winkler Committed by Greg Kroah-Hartman
Browse files

staging/easycap: add first level indentation to easycap_sound.c



Add the first level indentation to easycap_sound.c with astyle -t8.
41 lines over 80 characters were left out for further fix

Cc: Mike Thomas <rmthomas@sciolus.org>
Signed-off-by: default avatarTomas Winkler <tomas.winkler@intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent c7506658
Loading
Loading
Loading
Loading
+572 −592
Original line number Diff line number Diff line
@@ -47,7 +47,8 @@ static const struct snd_pcm_hardware alsa_hardware = {
	.rate_max = 48000,
	.channels_min = 2,
	.channels_max = 2,
	.buffer_bytes_max = PAGE_SIZE * PAGES_PER_AUDIO_FRAGMENT *
	.buffer_bytes_max = PAGE_SIZE *
			    PAGES_PER_AUDIO_FRAGMENT *
			    AUDIO_FRAGMENT_MANY,
	.period_bytes_min = PAGE_SIZE * PAGES_PER_AUDIO_FRAGMENT,
	.period_bytes_max = PAGE_SIZE * PAGES_PER_AUDIO_FRAGMENT * 2,
@@ -155,12 +156,12 @@ for (i = 0; i < purb->number_of_packets; i++) {
				p1 = (u8 *)(purb->transfer_buffer +
					purb->iso_frame_desc[i].offset);

/*---------------------------------------------------------------------------*/
				/*
 *  COPY more BYTES FROM ISOC BUFFER TO THE DMA BUFFER,
 *  CONVERTING 8-BIT MONO TO 16-BIT SIGNED LITTLE-ENDIAN SAMPLES IF NECESSARY
				 *  COPY more BYTES FROM ISOC BUFFER
				 *  TO THE DMA BUFFER, CONVERTING
				 *  8-BIT MONO TO 16-BIT SIGNED
				 *  LITTLE-ENDIAN SAMPLES IF NECESSARY
				 */
/*---------------------------------------------------------------------------*/
				while (more) {
					if (0 > more) {
						SAM("MISTAKE: more is negative\n");
@@ -189,30 +190,24 @@ for (i = 0; i < purb->number_of_packets; i++) {
						if (much % 16)
							JOM(8, "MISTAKE? much"
							    " is not divisible by 16\n");
					if (much > (16 *
							more))
						if (much > (16 * more))
							much = 16 *
							       more;
					p2 = (u8 *)(prt->dma_area +
						peasycap->dma_fill);
						p2 = (u8 *)(prt->dma_area + peasycap->dma_fill);

						for (j = 0;  j < (much/16);  j++) {
							newaudio =  ((int) *p1) - 128;
						newaudio = 128 *
								newaudio;
							newaudio = 128 * newaudio;

						delta = (newaudio - oldaudio)
									/ 4;
							delta = (newaudio - oldaudio) / 4;
							tmp = oldaudio + delta;

							for (k = 0;  k < 4;  k++) {
								*p2 = (0x00FF & tmp);
							*(p2 + 1) = (0xFF00 &
								tmp) >> 8;
								*(p2 + 1) = (0xFF00 & tmp) >> 8;
								p2 += 2;
								*p2 = (0x00FF & tmp);
							*(p2 + 1) = (0xFF00 &
								tmp) >> 8;
								*(p2 + 1) = (0xFF00 & tmp) >> 8;
								p2 += 2;
								tmp += delta;
							}
@@ -223,37 +218,32 @@ for (i = 0; i < purb->number_of_packets; i++) {
#else /*!UPSAMPLE*/
						if (much > (2 * more))
							much = 2 * more;
					p2 = (u8 *)(prt->dma_area +
						peasycap->dma_fill);
						p2 = (u8 *)(prt->dma_area + peasycap->dma_fill);

						for (j = 0;  j < (much / 2);  j++) {
							tmp = ((int) *p1) - 128;
							tmp = 128 * tmp;
							*p2 = (0x00FF & tmp);
						*(p2 + 1) = (0xFF00 & tmp) >>
									8;
						p1++;  p2 += 2;
							*(p2 + 1) = (0xFF00 & tmp) >> 8;
							p1++;
							p2 += 2;
							more--;
						}
#endif /*UPSAMPLE*/
					}
					peasycap->dma_fill += much;
					if (peasycap->dma_fill >= peasycap->dma_next) {
					isfragment = peasycap->dma_fill /
						fragment_bytes;
						isfragment = peasycap->dma_fill / fragment_bytes;
						if (0 > isfragment) {
							SAM("MISTAKE: isfragment is "
							    "negative\n");
							return;
						}
					peasycap->dma_read = (isfragment
						- 1) * fragment_bytes;
					peasycap->dma_next = (isfragment
						+ 1) * fragment_bytes;
					if (dma_bytes < peasycap->dma_next) {
						peasycap->dma_next =
								fragment_bytes;
					}
						peasycap->dma_read = (isfragment - 1) * fragment_bytes;
						peasycap->dma_next = (isfragment + 1) * fragment_bytes;
						if (dma_bytes < peasycap->dma_next)
							peasycap->dma_next = fragment_bytes;

						if (0 <= peasycap->dma_read) {
							JOM(8, "snd_pcm_period_elap"
							    "sed(), %i="
@@ -460,19 +450,20 @@ if (memcmp(&peasycap->telltale[0], TELLTALE, strlen(TELLTALE))) {
		return -EFAULT;
	}

JOM(16, "ALSA decides %8i Hz=rate\n", (int)pss->runtime->rate);
JOM(16, "ALSA decides %8i   =period_size\n", (int)pss->runtime->period_size);
JOM(16, "ALSA decides %8i   =periods\n", (int)pss->runtime->periods);
JOM(16, "ALSA decides %8i   =buffer_size\n", (int)pss->runtime->buffer_size);
JOM(16, "ALSA decides %8i   =dma_bytes\n", (int)pss->runtime->dma_bytes);
JOM(16, "ALSA decides %8i   =boundary\n", (int)pss->runtime->boundary);
JOM(16, "ALSA decides %8i   =period_step\n", (int)pss->runtime->period_step);
JOM(16, "ALSA decides %8i   =sample_bits\n", (int)pss->runtime->sample_bits);
JOM(16, "ALSA decides %8i   =frame_bits\n", (int)pss->runtime->frame_bits);
JOM(16, "ALSA decides %8i   =min_align\n", (int)pss->runtime->min_align);
JOM(12, "ALSA decides %8i   =hw_ptr_base\n", (int)pss->runtime->hw_ptr_base);
JOM(12, "ALSA decides %8i   =hw_ptr_interrupt\n",
					(int)pss->runtime->hw_ptr_interrupt);
	JOM(16, "ALSA decides %8i Hz=rate\n", pss->runtime->rate);
	JOM(16, "ALSA decides %8ld =period_size\n", pss->runtime->period_size);
	JOM(16, "ALSA decides %8i =periods\n", pss->runtime->periods);
	JOM(16, "ALSA decides %8ld =buffer_size\n", pss->runtime->buffer_size);
	JOM(16, "ALSA decides %8zd =dma_bytes\n", pss->runtime->dma_bytes);
	JOM(16, "ALSA decides %8ld =boundary\n", pss->runtime->boundary);
	JOM(16, "ALSA decides %8i =period_step\n", pss->runtime->period_step);
	JOM(16, "ALSA decides %8i =sample_bits\n", pss->runtime->sample_bits);
	JOM(16, "ALSA decides %8i =frame_bits\n", pss->runtime->frame_bits);
	JOM(16, "ALSA decides %8ld =min_align\n", pss->runtime->min_align);
	JOM(12, "ALSA decides %8ld =hw_ptr_base\n", pss->runtime->hw_ptr_base);
	JOM(12, "ALSA decides %8ld =hw_ptr_interrupt\n",
		pss->runtime->hw_ptr_interrupt);

	if (prt->dma_bytes != 4 * ((int)prt->period_size) * ((int)prt->periods)) {
		SAY("MISTAKE:  unexpected ALSA parameters\n");
		return -ENOENT;
@@ -560,8 +551,8 @@ JOM(8, "%7i=offset %7i=dma_read %7i=dma_next\n",
	return offset;
}
/*****************************************************************************/
static struct page *easycap_alsa_page(struct snd_pcm_substream *pss,
				unsigned long offset)
static struct page *
easycap_alsa_page(struct snd_pcm_substream *pss, unsigned long offset)
{
	return vmalloc_to_page(pss->runtime->dma_area + offset);
}
@@ -618,8 +609,7 @@ if (true == peasycap->microphone) {
	}

	if (0 != snd_card_create(SNDRV_DEFAULT_IDX1, "easycap_alsa",
					THIS_MODULE, 0,
					&psnd_card)) {
				THIS_MODULE, 0, &psnd_card)) {
		SAY("ERROR: Cannot do ALSA snd_card_create()\n");
		return -EFAULT;
	}
@@ -756,7 +746,9 @@ if (!peasycap->audio_isoc_streaming) {
		    peasycap->audio_interface,
		    peasycap->audio_altsetting_on, rc);

	isbad = 0;  nospc = 0;  m = 0;
		isbad = 0;
		nospc = 0;
		m = 0;
		list_for_each(plist_head, (peasycap->purb_audio_head)) {
			pdata_urb = list_entry(plist_head, struct data_urb, list_head);
			if (NULL != pdata_urb) {
@@ -766,14 +758,11 @@ if (!peasycap->audio_isoc_streaming) {

					purb->interval = 1;
					purb->dev = peasycap->pusb_device;
				purb->pipe =
					usb_rcvisocpipe(peasycap->pusb_device,
					purb->pipe = usb_rcvisocpipe(peasycap->pusb_device,
							peasycap->audio_endpointnumber);
					purb->transfer_flags = URB_ISO_ASAP;
				purb->transfer_buffer =
					peasycap->audio_isoc_buffer[isbuf].pgo;
				purb->transfer_buffer_length =
					peasycap->audio_isoc_buffer_size;
					purb->transfer_buffer = peasycap->audio_isoc_buffer[isbuf].pgo;
					purb->transfer_buffer_length = peasycap->audio_isoc_buffer_size;
#ifdef CONFIG_EASYCAP_OSS
					purb->complete = easyoss_complete;
#else /* CONFIG_EASYCAP_OSS */
@@ -781,17 +770,10 @@ if (!peasycap->audio_isoc_streaming) {
#endif /* CONFIG_EASYCAP_OSS */
					purb->context = peasycap;
					purb->start_frame = 0;
				purb->number_of_packets =
					peasycap->audio_isoc_framesperdesc;
				for (j = 0;  j < peasycap->
						audio_isoc_framesperdesc;
									j++) {
					purb->iso_frame_desc[j].offset = j *
						peasycap->
						audio_isoc_maxframesize;
					purb->iso_frame_desc[j].length =
						peasycap->
						audio_isoc_maxframesize;
					purb->number_of_packets = peasycap->audio_isoc_framesperdesc;
					for (j = 0;  j < peasycap->audio_isoc_framesperdesc; j++) {
						purb->iso_frame_desc[j].offset = j * peasycap->audio_isoc_maxframesize;
						purb->iso_frame_desc[j].length = peasycap->audio_isoc_maxframesize;
					}

					rc = usb_submit_urb(purb, GFP_KERNEL);
@@ -818,8 +800,7 @@ if (!peasycap->audio_isoc_streaming) {
		if (isbad) {
			JOM(4, "attempting cleanup instead of submitting\n");
			list_for_each(plist_head, (peasycap->purb_audio_head)) {
			pdata_urb = list_entry(plist_head, struct data_urb,
								list_head);
				pdata_urb = list_entry(plist_head, struct data_urb, list_head);
				if (NULL != pdata_urb) {
					purb = pdata_urb->purb;
					if (NULL != purb)
@@ -859,8 +840,7 @@ if (peasycap->audio_isoc_streaming) {
			JOM(4, "killing audio urbs\n");
			m = 0;
			list_for_each(plist_head, (peasycap->purb_audio_head)) {
			pdata_urb = list_entry(plist_head, struct data_urb,
								list_head);
				pdata_urb = list_entry(plist_head, struct data_urb, list_head);
				if (NULL != pdata_urb) {
					if (NULL != pdata_urb->purb) {
						usb_kill_urb(pdata_urb->purb);