Commit a90f3620 authored by Tomas Winkler's avatar Tomas Winkler Committed by Greg Kroah-Hartman

staging/easycap: more style fixing in easycap_main.c

mostly indentation fixes and some line over 80 characters fixes

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 817368f1
...@@ -1147,17 +1147,14 @@ int easycap_dqbuf(struct easycap *peasycap, int mode) ...@@ -1147,17 +1147,14 @@ int easycap_dqbuf(struct easycap *peasycap, int mode)
if (mode) if (mode)
return -EAGAIN; return -EAGAIN;
JOM(8, "first wait on wq_video, " JOM(8, "first wait on wq_video, %i=field_read %i=field_fill\n",
"%i=field_read %i=field_fill\n",
peasycap->field_read, peasycap->field_fill); peasycap->field_read, peasycap->field_fill);
if (0 != (wait_event_interruptible(peasycap->wq_video, if (0 != (wait_event_interruptible(peasycap->wq_video,
(peasycap->video_idle || peasycap->video_eof || (peasycap->video_idle || peasycap->video_eof ||
((peasycap->field_read != peasycap->field_fill) && ((peasycap->field_read != peasycap->field_fill) &&
(0 == (0xFF00 & peasycap->field_buffer (0 == (0xFF00 & peasycap->field_buffer[peasycap->field_read][0].kount)) &&
[peasycap->field_read][0].kount)) && (ifield == (0x00FF & peasycap->field_buffer[peasycap->field_read][0].kount))))))) {
(ifield == (0x00FF & peasycap->field_buffer
[peasycap->field_read][0].kount))))))) {
SAM("aborted by signal\n"); SAM("aborted by signal\n");
return -EIO; return -EIO;
} }
...@@ -1209,10 +1206,8 @@ int easycap_dqbuf(struct easycap *peasycap, int mode) ...@@ -1209,10 +1206,8 @@ int easycap_dqbuf(struct easycap *peasycap, int mode)
ifield = 1; ifield = 1;
miss = 0; miss = 0;
while ((peasycap->field_read == peasycap->field_fill) || while ((peasycap->field_read == peasycap->field_fill) ||
(0 != (0xFF00 & peasycap->field_buffer (0 != (0xFF00 & peasycap->field_buffer[peasycap->field_read][0].kount)) ||
[peasycap->field_read][0].kount)) || (ifield != (0x00FF & peasycap->field_buffer[peasycap->field_read][0].kount))) {
(ifield != (0x00FF & peasycap->field_buffer
[peasycap->field_read][0].kount))) {
if (mode) if (mode)
return -EAGAIN; return -EAGAIN;
...@@ -1221,11 +1216,8 @@ int easycap_dqbuf(struct easycap *peasycap, int mode) ...@@ -1221,11 +1216,8 @@ int easycap_dqbuf(struct easycap *peasycap, int mode)
if (0 != (wait_event_interruptible(peasycap->wq_video, if (0 != (wait_event_interruptible(peasycap->wq_video,
(peasycap->video_idle || peasycap->video_eof || (peasycap->video_idle || peasycap->video_eof ||
((peasycap->field_read != peasycap->field_fill) && ((peasycap->field_read != peasycap->field_fill) &&
(0 == (0xFF00 & peasycap->field_buffer (0 == (0xFF00 & peasycap->field_buffer[peasycap->field_read][0].kount)) &&
[peasycap->field_read][0].kount)) && (ifield == (0x00FF & peasycap->field_buffer[peasycap->field_read][0].kount))))))) {
(ifield == (0x00FF & peasycap->field_buffer
[peasycap->field_read][0].
kount))))))) {
SAM("aborted by signal\n"); SAM("aborted by signal\n");
return -EIO; return -EIO;
} }
...@@ -1236,7 +1228,7 @@ int easycap_dqbuf(struct easycap *peasycap, int mode) ...@@ -1236,7 +1228,7 @@ int easycap_dqbuf(struct easycap *peasycap, int mode)
} }
if (peasycap->video_eof) { if (peasycap->video_eof) {
JOM(8, "%i=peasycap->video_eof\n", peasycap->video_eof); JOM(8, "%i=peasycap->video_eof\n", peasycap->video_eof);
#if defined(PERSEVERE) #if defined(PERSEVERE)
if (1 == peasycap->status) { if (1 == peasycap->status) {
JOM(8, "persevering ...\n"); JOM(8, "persevering ...\n");
peasycap->video_eof = 0; peasycap->video_eof = 0;
...@@ -1252,7 +1244,7 @@ int easycap_dqbuf(struct easycap *peasycap, int mode) ...@@ -1252,7 +1244,7 @@ int easycap_dqbuf(struct easycap *peasycap, int mode)
JOM(8, " ... OK ... returning -EAGAIN\n"); JOM(8, " ... OK ... returning -EAGAIN\n");
return -EAGAIN; return -EAGAIN;
} }
#endif /*PERSEVERE*/ #endif /*PERSEVERE*/
peasycap->video_eof = 1; peasycap->video_eof = 1;
peasycap->audio_eof = 1; peasycap->audio_eof = 1;
kill_video_urbs(peasycap); kill_video_urbs(peasycap);
...@@ -1271,10 +1263,11 @@ int easycap_dqbuf(struct easycap *peasycap, int mode) ...@@ -1271,10 +1263,11 @@ int easycap_dqbuf(struct easycap *peasycap, int mode)
* WASTE THIS FRAME * WASTE THIS FRAME
*/ */
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
if (0 != peasycap->skip) { if (peasycap->skip) {
peasycap->skipped++; peasycap->skipped++;
if (peasycap->skip != peasycap->skipped) if (peasycap->skip != peasycap->skipped)
return peasycap->skip - peasycap->skipped; return peasycap->skip - peasycap->skipped;
else
peasycap->skipped = 0; peasycap->skipped = 0;
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
...@@ -1432,22 +1425,17 @@ field2frame(struct easycap *peasycap) ...@@ -1432,22 +1425,17 @@ field2frame(struct easycap *peasycap)
* CAUSE BREAKAGE. BEWARE. * CAUSE BREAKAGE. BEWARE.
*/ */
rad2 = rad + bytesperpixel - 1; rad2 = rad + bytesperpixel - 1;
much = ((((2 * much = ((((2 * rad2)/bytesperpixel)/2) * 2);
rad2)/bytesperpixel)/2) * 2); rump = ((bytesperpixel * much) / 2) - rad;
rump = ((bytesperpixel *
much) / 2) - rad;
more = rad; more = rad;
} }
mask = (u8)rump; mask = (u8)rump;
margin = 0; margin = 0;
if (much == rex) { if (much == rex) {
mask |= 0x04; mask |= 0x04;
if ((mex + 1) < FIELD_BUFFER_SIZE/ if ((mex + 1) < FIELD_BUFFER_SIZE / PAGE_SIZE)
PAGE_SIZE) { margin = *((u8 *)(peasycap->field_buffer[kex][mex + 1].pgo));
margin = *((u8 *)(peasycap-> else
field_buffer
[kex][mex + 1].pgo));
} else
mask |= 0x08; mask |= 0x08;
} }
} else { } else {
...@@ -1471,20 +1459,16 @@ field2frame(struct easycap *peasycap) ...@@ -1471,20 +1459,16 @@ field2frame(struct easycap *peasycap)
SAM("ERROR: redaub() failed\n"); SAM("ERROR: redaub() failed\n");
return -EFAULT; return -EFAULT;
} }
if (much % 4) { if (much % 4)
if (isuy) isuy = !isuy;
isuy = false;
else
isuy = true;
}
over -= much; cz += much; over -= much; cz += much;
pex += much; rex -= much; pex += much; rex -= much;
if (!rex) { if (!rex) {
mex++; mex++;
pex = peasycap->field_buffer[kex][mex].pgo; pex = peasycap->field_buffer[kex][mex].pgo;
rex = PAGE_SIZE; rex = PAGE_SIZE;
if (peasycap->field_buffer[kex][mex].input != if (peasycap->field_buffer[kex][mex].input != (0x08|peasycap->input))
(0x08|peasycap->input))
badinput = true; badinput = true;
} }
pad += more; pad += more;
...@@ -1554,22 +1538,17 @@ field2frame(struct easycap *peasycap) ...@@ -1554,22 +1538,17 @@ field2frame(struct easycap *peasycap)
* BEWARE. * BEWARE.
*/ */
rad2 = rad + bytesperpixel - 1; rad2 = rad + bytesperpixel - 1;
much = ((((2 * rad2)/bytesperpixel)/2) much = ((((2 * rad2) / bytesperpixel) / 2) * 4);
* 4); rump = ((bytesperpixel * much) / 4) - rad;
rump = ((bytesperpixel *
much) / 4) - rad;
more = rad; more = rad;
} }
mask = (u8)rump; mask = (u8)rump;
margin = 0; margin = 0;
if (much == rex) { if (much == rex) {
mask |= 0x04; mask |= 0x04;
if ((mex + 1) < FIELD_BUFFER_SIZE/ if ((mex + 1) < FIELD_BUFFER_SIZE / PAGE_SIZE)
PAGE_SIZE) { margin = *((u8 *)(peasycap->field_buffer[kex][mex + 1].pgo));
margin = *((u8 *)(peasycap-> else
field_buffer
[kex][mex + 1].pgo));
} else
mask |= 0x08; mask |= 0x08;
} }
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
...@@ -3815,18 +3794,19 @@ static int easycap_usb_probe(struct usb_interface *pusb_interface, ...@@ -3815,18 +3794,19 @@ static int easycap_usb_probe(struct usb_interface *pusb_interface,
JOM(4, ".... each occupying contiguous memory pages\n"); JOM(4, ".... each occupying contiguous memory pages\n");
for (k = 0; k < VIDEO_ISOC_BUFFER_MANY; k++) { for (k = 0; k < VIDEO_ISOC_BUFFER_MANY; k++) {
pbuf = (void *)__get_free_pages(GFP_KERNEL, VIDEO_ISOC_ORDER); pbuf = (void *)__get_free_pages(GFP_KERNEL,
VIDEO_ISOC_ORDER);
if (NULL == pbuf) { if (NULL == pbuf) {
SAM("ERROR: Could not allocate isoc video buffer " SAM("ERROR: Could not allocate isoc video buffer "
"%i\n", k); "%i\n", k);
return -ENOMEM; return -ENOMEM;
} else } else
peasycap->allocation_video_page += peasycap->allocation_video_page +=
((unsigned int)(0x01 << VIDEO_ISOC_ORDER)); BIT(VIDEO_ISOC_ORDER);
peasycap->video_isoc_buffer[k].pgo = pbuf; peasycap->video_isoc_buffer[k].pgo = pbuf;
peasycap->video_isoc_buffer[k].pto = pbuf + peasycap->video_isoc_buffer[k].pto =
peasycap->video_isoc_buffer_size; pbuf + peasycap->video_isoc_buffer_size;
peasycap->video_isoc_buffer[k].kount = k; peasycap->video_isoc_buffer[k].kount = k;
} }
JOM(4, "allocation of isoc video buffers done: %i pages\n", JOM(4, "allocation of isoc video buffers done: %i pages\n",
...@@ -4052,12 +4032,14 @@ static int easycap_usb_probe(struct usb_interface *pusb_interface, ...@@ -4052,12 +4032,14 @@ static int easycap_usb_probe(struct usb_interface *pusb_interface,
peasycap->ilk |= 0x02; peasycap->ilk |= 0x02;
SAM("audio hardware is microphone\n"); SAM("audio hardware is microphone\n");
peasycap->microphone = true; peasycap->microphone = true;
peasycap->audio_pages_per_fragment = PAGES_PER_AUDIO_FRAGMENT; peasycap->audio_pages_per_fragment =
PAGES_PER_AUDIO_FRAGMENT;
} else if (256 == peasycap->audio_isoc_maxframesize) { } else if (256 == peasycap->audio_isoc_maxframesize) {
peasycap->ilk &= ~0x02; peasycap->ilk &= ~0x02;
SAM("audio hardware is AC'97\n"); SAM("audio hardware is AC'97\n");
peasycap->microphone = false; peasycap->microphone = false;
peasycap->audio_pages_per_fragment = PAGES_PER_AUDIO_FRAGMENT; peasycap->audio_pages_per_fragment =
PAGES_PER_AUDIO_FRAGMENT;
} else { } else {
SAM("hardware is unidentified:\n"); SAM("hardware is unidentified:\n");
SAM("%i=audio_isoc_maxframesize\n", SAM("%i=audio_isoc_maxframesize\n",
...@@ -4066,8 +4048,7 @@ static int easycap_usb_probe(struct usb_interface *pusb_interface, ...@@ -4066,8 +4048,7 @@ static int easycap_usb_probe(struct usb_interface *pusb_interface,
} }
peasycap->audio_bytes_per_fragment = peasycap->audio_bytes_per_fragment =
peasycap->audio_pages_per_fragment * peasycap->audio_pages_per_fragment * PAGE_SIZE;
PAGE_SIZE ;
peasycap->audio_buffer_page_many = (AUDIO_FRAGMENT_MANY * peasycap->audio_buffer_page_many = (AUDIO_FRAGMENT_MANY *
peasycap->audio_pages_per_fragment); peasycap->audio_pages_per_fragment);
...@@ -4159,18 +4140,20 @@ static int easycap_usb_probe(struct usb_interface *pusb_interface, ...@@ -4159,18 +4140,20 @@ static int easycap_usb_probe(struct usb_interface *pusb_interface,
#endif /* CONFIG_EASYCAP_OSS */ #endif /* CONFIG_EASYCAP_OSS */
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
JOM(4, "allocating %i isoc audio buffers of size %i\n", JOM(4, "allocating %i isoc audio buffers of size %i\n",
AUDIO_ISOC_BUFFER_MANY, peasycap->audio_isoc_buffer_size); AUDIO_ISOC_BUFFER_MANY,
peasycap->audio_isoc_buffer_size);
JOM(4, ".... each occupying contiguous memory pages\n"); JOM(4, ".... each occupying contiguous memory pages\n");
for (k = 0; k < AUDIO_ISOC_BUFFER_MANY; k++) { for (k = 0; k < AUDIO_ISOC_BUFFER_MANY; k++) {
pbuf = (void *)__get_free_pages(GFP_KERNEL, AUDIO_ISOC_ORDER); pbuf = (void *)__get_free_pages(GFP_KERNEL,
AUDIO_ISOC_ORDER);
if (NULL == pbuf) { if (NULL == pbuf) {
SAM("ERROR: Could not allocate isoc audio buffer " SAM("ERROR: Could not allocate isoc audio buffer "
"%i\n", k); "%i\n", k);
return -ENOMEM; return -ENOMEM;
} else } else
peasycap->allocation_audio_page += peasycap->allocation_audio_page +=
((unsigned int)(0x01 << AUDIO_ISOC_ORDER)); BIT(AUDIO_ISOC_ORDER);
peasycap->audio_isoc_buffer[k].pgo = pbuf; peasycap->audio_isoc_buffer[k].pgo = pbuf;
peasycap->audio_isoc_buffer[k].pto = pbuf + peasycap->audio_isoc_buffer[k].pto = pbuf +
...@@ -4418,8 +4401,7 @@ static void easycap_usb_disconnect(struct usb_interface *pusb_interface) ...@@ -4418,8 +4401,7 @@ static void easycap_usb_disconnect(struct usb_interface *pusb_interface)
if (NULL != peasycap->purb_video_head) { if (NULL != peasycap->purb_video_head) {
JOM(4, "killing video urbs\n"); JOM(4, "killing video urbs\n");
m = 0; m = 0;
list_for_each(plist_head, (peasycap->purb_video_head)) list_for_each(plist_head, peasycap->purb_video_head) {
{
pdata_urb = list_entry(plist_head, pdata_urb = list_entry(plist_head,
struct data_urb, list_head); struct data_urb, list_head);
if (NULL != pdata_urb) { if (NULL != pdata_urb) {
...@@ -4438,8 +4420,7 @@ static void easycap_usb_disconnect(struct usb_interface *pusb_interface) ...@@ -4438,8 +4420,7 @@ static void easycap_usb_disconnect(struct usb_interface *pusb_interface)
if (NULL != peasycap->purb_audio_head) { if (NULL != peasycap->purb_audio_head) {
JOM(4, "killing audio urbs\n"); JOM(4, "killing audio urbs\n");
m = 0; m = 0;
list_for_each(plist_head, list_for_each(plist_head, peasycap->purb_audio_head) {
(peasycap->purb_audio_head)) {
pdata_urb = list_entry(plist_head, pdata_urb = list_entry(plist_head,
struct data_urb, list_head); struct data_urb, list_head);
if (NULL != pdata_urb) { if (NULL != pdata_urb) {
......
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