From 3fc0dae888ee216036ae1898fc9186f1dd04f185 Mon Sep 17 00:00:00 2001 From: Tomas Winkler Date: Thu, 3 Feb 2011 13:42:40 +0200 Subject: [PATCH] staging/easycap: repace #if defined with simpler #ifdef for sake of readability replace #if defined with #ifdef and #if (!defined with #ifndef Signed-off-by: Tomas Winkler Signed-off-by: Greg Kroah-Hartman --- drivers/staging/easycap/easycap.h | 18 +++---- drivers/staging/easycap/easycap_ioctl.c | 8 ++-- drivers/staging/easycap/easycap_low.c | 6 +-- drivers/staging/easycap/easycap_main.c | 53 ++++++++++----------- drivers/staging/easycap/easycap_sound.c | 8 ++-- drivers/staging/easycap/easycap_sound_oss.c | 30 ++++++------ drivers/staging/easycap/easycap_testcard.c | 2 +- 7 files changed, 61 insertions(+), 64 deletions(-) diff --git a/drivers/staging/easycap/easycap.h b/drivers/staging/easycap/easycap.h index 47467d5fdd2c..1276cbf52fe3 100644 --- a/drivers/staging/easycap/easycap.h +++ b/drivers/staging/easycap/easycap.h @@ -90,22 +90,22 @@ #include #endif /* !CONFIG_EASYCAP_OSS */ /*vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ -#if defined(EASYCAP_IS_VIDEODEV_CLIENT) +#ifdef EASYCAP_IS_VIDEODEV_CLIENT #include -#if defined(EASYCAP_NEEDS_V4L2_DEVICE_H) +#ifdef EASYCAP_NEEDS_V4L2_DEVICE_H #include #endif /*EASYCAP_NEEDS_V4L2_DEVICE_H*/ #endif /*EASYCAP_IS_VIDEODEV_CLIENT*/ /*^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ #include #include -#if defined(EASYCAP_NEEDS_USBVIDEO_H) +#ifdef EASYCAP_NEEDS_USBVIDEO_H #include #endif /*EASYCAP_NEEDS_USBVIDEO_H*/ -#if (!defined(PAGE_SIZE)) +#ifndef PAGE_SIZE #error "PAGE_SIZE not defined" -#endif +#endif /* PAGE_SIZE */ /*---------------------------------------------------------------------------*/ /* VENDOR, PRODUCT: Syntek Semiconductor Co., Ltd @@ -309,9 +309,9 @@ struct easycap { int minor; /*vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ -#if defined(EASYCAP_IS_VIDEODEV_CLIENT) +#ifdef EASYCAP_IS_VIDEODEV_CLIENT struct video_device video_device; -#if defined(EASYCAP_NEEDS_V4L2_DEVICE_H) +#ifdef EASYCAP_NEEDS_V4L2_DEVICE_H struct v4l2_device v4l2_device; #endif /*EASYCAP_NEEDS_V4L2_DEVICE_H*/ #endif /*EASYCAP_IS_VIDEODEV_CLIENT*/ @@ -322,8 +322,8 @@ struct easycap { unsigned int audio_buffer_page_many; #define UPSAMPLE -#if defined(UPSAMPLE) -__s16 oldaudio; +#ifdef UPSAMPLE + __s16 oldaudio; #endif /*UPSAMPLE*/ int ilk; diff --git a/drivers/staging/easycap/easycap_ioctl.c b/drivers/staging/easycap/easycap_ioctl.c index ee581c4f8037..4754f2ffc8ef 100644 --- a/drivers/staging/easycap/easycap_ioctl.c +++ b/drivers/staging/easycap/easycap_ioctl.c @@ -1387,7 +1387,7 @@ case VIDIOC_G_CTRL: { break; } /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ -#if defined(VIDIOC_S_CTRL_OLD) +#ifdef VIDIOC_S_CTRL_OLD case VIDIOC_S_CTRL_OLD: { JOM(8, "VIDIOC_S_CTRL_OLD required at least for xawtv\n"); } @@ -2156,7 +2156,7 @@ case VIDIOC_QBUF: { /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ case VIDIOC_DQBUF: { -#if defined(AUDIOTIME) +#ifdef AUDIOTIME struct signed_div_result sdr; long long int above, below, dnbydt, fudge, sll; unsigned long long int ull; @@ -2269,7 +2269,7 @@ case VIDIOC_DQBUF: do_gettimeofday(&timeval); timeval2 = timeval; -#if defined(AUDIOTIME) +#ifdef AUDIOTIME if (!peasycap->timeval0.tv_sec) { timeval8 = timeval; timeval1 = timeval; @@ -2389,7 +2389,7 @@ case VIDIOC_STREAMOFF: { /*---------------------------------------------------------------------------*/ JOM(8, "calling wake_up on wq_video and wq_audio\n"); wake_up_interruptible(&(peasycap->wq_video)); -#if defined(EASYCAP_NEEDS_ALSA) +#ifdef EASYCAP_NEEDS_ALSA if (NULL != peasycap->psubstream) snd_pcm_period_elapsed(peasycap->psubstream); #else diff --git a/drivers/staging/easycap/easycap_low.c b/drivers/staging/easycap/easycap_low.c index 48e3cb4a7197..15eef6a5200d 100644 --- a/drivers/staging/easycap/easycap_low.c +++ b/drivers/staging/easycap/easycap_low.c @@ -133,7 +133,7 @@ static const struct saa7113config{ int set; } saa7113configPAL[256] = { {0x01, 0x08}, -#if defined(ANTIALIAS) +#ifdef ANTIALIAS {0x02, 0xC0}, #else {0x02, 0x80}, @@ -191,7 +191,7 @@ static const struct saa7113config{ /*--------------------------------------------------------------------------*/ static const struct saa7113config saa7113configNTSC[256] = { {0x01, 0x08}, -#if defined(ANTIALIAS) +#ifdef ANTIALIAS {0x02, 0xC0}, #else {0x02, 0x80}, @@ -929,7 +929,7 @@ rc0 = usb_control_msg(pusb_device, usb_sndctrlpipe(pusb_device, 0), (__u16)0, (int)500); -#if defined(NOREADBACK) +#ifdef NOREADBACK # #else rc1 = usb_control_msg(pusb_device, usb_rcvctrlpipe(pusb_device, 0), diff --git a/drivers/staging/easycap/easycap_main.c b/drivers/staging/easycap/easycap_main.c index dce9bd6e47ef..fcfa11d8dd5c 100644 --- a/drivers/staging/easycap/easycap_main.c +++ b/drivers/staging/easycap/easycap_main.c @@ -133,7 +133,7 @@ return -1; /*^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ static int easycap_open(struct inode *inode, struct file *file) { -#if (!defined(EASYCAP_IS_VIDEODEV_CLIENT)) +#ifndef EASYCAP_IS_VIDEODEV_CLIENT struct usb_interface *pusb_interface; #else struct video_device *pvideo_device; @@ -146,7 +146,7 @@ SAY("==========OPEN=========\n"); peasycap = NULL; /*---------------------------------------------------------------------------*/ -#if (!defined(EASYCAP_IS_VIDEODEV_CLIENT)) +#ifndef EASYCAP_IS_VIDEODEV_CLIENT if (NULL == inode) { SAY("ERROR: inode is NULL.\n"); return -EFAULT; @@ -728,7 +728,7 @@ return 0; /*--------------------------------------------------------------------------*/ static int easycap_release(struct inode *inode, struct file *file) { -#if (!defined(EASYCAP_IS_VIDEODEV_CLIENT)) +#ifndef EASYCAP_IS_VIDEODEV_CLIENT struct easycap *peasycap; JOT(4, "\n"); @@ -756,7 +756,7 @@ JOM(4, "ending successfully\n"); return 0; } -#if defined(EASYCAP_IS_VIDEODEV_CLIENT) +#ifdef EASYCAP_IS_VIDEODEV_CLIENT static int easycap_open_noinode(struct file *file) { return easycap_open(NULL, file); @@ -1375,7 +1375,7 @@ if (peasycap->field_read == peasycap->field_fill) { peasycap->field_read); return 0; } -#if defined(EASYCAP_TESTCARD) +#ifdef EASYCAP_TESTCARD easycap_testcard(peasycap, peasycap->field_read); #else if (0 <= input && INPUT_MANY > input) { @@ -3128,8 +3128,8 @@ static const struct usb_class_driver easycap_class = { .minor_base = USB_SKEL_MINOR_BASE, }; /*vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ -#if defined(EASYCAP_IS_VIDEODEV_CLIENT) -#if defined(EASYCAP_NEEDS_V4L2_FOPS) +#ifdef EASYCAP_IS_VIDEODEV_CLIENT +#ifdef EASYCAP_NEEDS_V4L2_FOPS static const struct v4l2_file_operations v4l2_fops = { .owner = THIS_MODULE, .open = easycap_open_noinode, @@ -3180,8 +3180,8 @@ __u16 mask; __s32 value; struct easycap_format *peasycap_format; /*vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ -#if defined(EASYCAP_IS_VIDEODEV_CLIENT) -#if defined(EASYCAP_NEEDS_V4L2_DEVICE_H) +#ifdef EASYCAP_IS_VIDEODEV_CLIENT +#ifdef EASYCAP_NEEDS_V4L2_DEVICE_H struct v4l2_device *pv4l2_device; #endif /*EASYCAP_NEEDS_V4L2_DEVICE_H*/ #endif /*EASYCAP_IS_VIDEODEV_CLIENT*/ @@ -3303,10 +3303,10 @@ if (0 == bInterfaceNumber) { } SAM("allocated 0x%08lX=peasycap\n", (unsigned long int) peasycap); /*vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ -#if defined(EASYCAP_IS_VIDEODEV_CLIENT) +#ifdef EASYCAP_IS_VIDEODEV_CLIENT SAM("where 0x%08lX=&peasycap->video_device\n", (unsigned long int) &peasycap->video_device); -#if defined(EASYCAP_NEEDS_V4L2_DEVICE_H) +#ifdef EASYCAP_NEEDS_V4L2_DEVICE_H SAM("and 0x%08lX=&peasycap->v4l2_device\n", (unsigned long int) &peasycap->v4l2_device); #endif /*EASYCAP_NEEDS_V4L2_DEVICE_H*/ @@ -3559,11 +3559,11 @@ if (0 == bInterfaceNumber) { bInterfaceNumber); return -ENODEV; } -#if (!defined(EASYCAP_IS_VIDEODEV_CLIENT)) +#ifndef EASYCAP_IS_VIDEODEV_CLIENT # /*vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ #else -#if defined(EASYCAP_NEEDS_V4L2_DEVICE_H) +#ifdef EASYCAP_NEEDS_V4L2_DEVICE_H /*---------------------------------------------------------------------------*/ /* * SOME VERSIONS OF THE videodev MODULE OVERWRITE THE DATA WHICH HAS @@ -4128,7 +4128,7 @@ case 0: { * BEWARE. */ /*---------------------------------------------------------------------------*/ -#if defined(PREFER_NTSC) +#ifdef PREFER_NTSC peasycap->ntsc = true; JOM(8, "defaulting initially to NTSC\n"); #else @@ -4145,7 +4145,7 @@ case 0: { * THE VIDEO DEVICE CAN BE REGISTERED NOW, AS IT IS READY. */ /*--------------------------------------------------------------------------*/ -#if (!defined(EASYCAP_IS_VIDEODEV_CLIENT)) +#ifndef EASYCAP_IS_VIDEODEV_CLIENT if (0 != (usb_register_dev(pusb_interface, &easycap_class))) { err("Not able to get a minor for this device"); usb_set_intfdata(pusb_interface, NULL); @@ -4158,7 +4158,7 @@ case 0: { } /*vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ #else -#if defined(EASYCAP_NEEDS_V4L2_DEVICE_H) +#ifdef EASYCAP_NEEDS_V4L2_DEVICE_H if (0 != (v4l2_device_register(&(pusb_interface->dev), &(peasycap->v4l2_device)))) { SAM("v4l2_device_register() failed\n"); @@ -4181,7 +4181,7 @@ case 0: { #endif /*EASYCAP_NEEDS_V4L2_DEVICE_H*/ strcpy(&peasycap->video_device.name[0], "easycapdc60"); -#if defined(EASYCAP_NEEDS_V4L2_FOPS) +#ifdef EASYCAP_NEEDS_V4L2_FOPS peasycap->video_device.fops = &v4l2_fops; #else peasycap->video_device.fops = &easycap_fops; @@ -4214,7 +4214,7 @@ case 0: { */ /*--------------------------------------------------------------------------*/ case 1: { -#if defined(EASYCAP_SILENT) +#ifdef EASYCAP_SILENT return -ENOENT; #endif /*EASYCAP_SILENT*/ if (!peasycap) { @@ -4233,7 +4233,7 @@ case 1: { } /*--------------------------------------------------------------------------*/ case 2: { -#if defined(EASYCAP_SILENT) +#ifdef EASYCAP_SILENT return -ENOENT; #endif /*EASYCAP_SILENT*/ if (!peasycap) { @@ -4566,8 +4566,8 @@ struct list_head *plist_head; struct data_urb *pdata_urb; int minor, m, kd; /*vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ -#if defined(EASYCAP_IS_VIDEODEV_CLIENT) -#if defined(EASYCAP_NEEDS_V4L2_DEVICE_H) +#ifdef EASYCAP_IS_VIDEODEV_CLIENT +#ifdef EASYCAP_NEEDS_V4L2_DEVICE_H struct v4l2_device *pv4l2_device; #endif /*EASYCAP_NEEDS_V4L2_DEVICE_H*/ #endif /*EASYCAP_IS_VIDEODEV_CLIENT*/ @@ -4602,11 +4602,8 @@ if (NULL == peasycap) { return; } /*---------------------------------------------------------------------------*/ -#if (!defined(EASYCAP_IS_VIDEODEV_CLIENT)) -# -/*vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ -#else -#if defined(EASYCAP_NEEDS_V4L2_DEVICE_H) +#ifdef EASYCAP_IS_VIDEODEV_CLIENT +#ifdef EASYCAP_NEEDS_V4L2_DEVICE_H /*---------------------------------------------------------------------------*/ /* * SOME VERSIONS OF THE videodev MODULE OVERWRITE THE DATA WHICH HAS @@ -4715,7 +4712,7 @@ case 0: { } else SAY("ERROR: %i=kd is bad: cannot lock dongle\n", kd); /*---------------------------------------------------------------------------*/ -#if (!defined(EASYCAP_IS_VIDEODEV_CLIENT)) +#ifndef EASYCAP_IS_VIDEODEV_CLIENT if (NULL == peasycap) { SAM("ERROR: peasycap has become NULL\n"); } else { @@ -4726,7 +4723,7 @@ case 0: { } /*vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ #else -#if defined(EASYCAP_NEEDS_V4L2_DEVICE_H) +#ifdef EASYCAP_NEEDS_V4L2_DEVICE_H if (!peasycap->v4l2_device.name[0]) { SAM("ERROR: peasycap->v4l2_device.name is empty\n"); if (0 <= kd && DONGLE_MANY > kd) diff --git a/drivers/staging/easycap/easycap_sound.c b/drivers/staging/easycap/easycap_sound.c index 2b4ef4eba0c5..7c07dbc1edc3 100644 --- a/drivers/staging/easycap/easycap_sound.c +++ b/drivers/staging/easycap/easycap_sound.c @@ -75,7 +75,7 @@ int isfragment; __u8 *p1, *p2; __s16 s16; int i, j, more, much, rc; -#if defined(UPSAMPLE) +#ifdef UPSAMPLE int k; __s16 oldaudio, newaudio, delta; #endif /*UPSAMPLE*/ @@ -131,7 +131,7 @@ if (purb->status) { */ /*---------------------------------------------------------------------------*/ -#if defined(UPSAMPLE) +#ifdef UPSAMPLE oldaudio = peasycap->oldaudio; #endif /*UPSAMPLE*/ @@ -185,7 +185,7 @@ for (i = 0; i < purb->number_of_packets; i++) { p1 += much; more -= much; } else { -#if defined(UPSAMPLE) +#ifdef UPSAMPLE if (much % 16) JOM(8, "MISTAKE? much" " is not divisible by 16\n"); @@ -271,7 +271,7 @@ for (i = 0; i < purb->number_of_packets; i++) { purb->iso_frame_desc[i].status); } -#if defined(UPSAMPLE) +#ifdef UPSAMPLE peasycap->oldaudio = oldaudio; #endif /*UPSAMPLE*/ diff --git a/drivers/staging/easycap/easycap_sound_oss.c b/drivers/staging/easycap/easycap_sound_oss.c index 7c98261bbf22..adf803199cc6 100644 --- a/drivers/staging/easycap/easycap_sound_oss.c +++ b/drivers/staging/easycap/easycap_sound_oss.c @@ -56,7 +56,7 @@ struct data_buffer *paudio_buffer; __u8 *p1, *p2; __s16 s16; int i, j, more, much, leap, rc; -#if defined(UPSAMPLE) +#ifdef UPSAMPLE int k; __s16 oldaudio, newaudio, delta; #endif /*UPSAMPLE*/ @@ -108,7 +108,7 @@ if (purb->status) { * PROCEED HERE WHEN NO ERROR */ /*---------------------------------------------------------------------------*/ -#if defined(UPSAMPLE) +#ifdef UPSAMPLE oldaudio = peasycap->oldaudio; #endif /*UPSAMPLE*/ @@ -119,7 +119,7 @@ for (i = 0; i < purb->number_of_packets; i++) { more = purb->iso_frame_desc[i].actual_length; -#if defined(TESTTONE) +#ifdef TESTTONE if (!more) more = purb->iso_frame_desc[i].length; #endif @@ -167,7 +167,7 @@ for (i = 0; i < purb->number_of_packets; i++) { if (PAGE_SIZE == (paudio_buffer->pto - paudio_buffer->pgo)) { -#if defined(TESTTONE) +#ifdef TESTTONE easyoss_testtone(peasycap, peasycap->audio_fill); #endif /*TESTTONE*/ @@ -218,7 +218,7 @@ for (i = 0; i < purb->number_of_packets; i++) { p1 += much; more -= much; } else { -#if defined(UPSAMPLE) +#ifdef UPSAMPLE if (much % 16) JOM(8, "MISTAKE? much" " is not divisible by 16\n"); @@ -279,7 +279,7 @@ for (i = 0; i < purb->number_of_packets; i++) { purb->iso_frame_desc[i].status); } -#if defined(UPSAMPLE) +#ifdef UPSAMPLE peasycap->oldaudio = oldaudio; #endif /*UPSAMPLE*/ @@ -317,8 +317,8 @@ struct usb_interface *pusb_interface; struct easycap *peasycap; int subminor; /*vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ -#if defined(EASYCAP_IS_VIDEODEV_CLIENT) -#if defined(EASYCAP_NEEDS_V4L2_DEVICE_H) +#ifdef EASYCAP_IS_VIDEODEV_CLIENT +#ifdef EASYCAP_NEEDS_V4L2_DEVICE_H struct v4l2_device *pv4l2_device; #endif /*EASYCAP_NEEDS_V4L2_DEVICE_H*/ #endif /*EASYCAP_IS_VIDEODEV_CLIENT*/ @@ -341,11 +341,11 @@ if (NULL == peasycap) { return -1; } /*---------------------------------------------------------------------------*/ -#if (!defined(EASYCAP_IS_VIDEODEV_CLIENT)) +#ifndef EASYCAP_IS_VIDEODEV_CLIENT # /*vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv*/ #else -#if defined(EASYCAP_NEEDS_V4L2_DEVICE_H) +#ifdef EASYCAP_NEEDS_V4L2_DEVICE_H /*---------------------------------------------------------------------------*/ /* * SOME VERSIONS OF THE videodev MODULE OVERWRITE THE DATA WHICH HAS @@ -787,7 +787,7 @@ case SNDCTL_DSP_GETCAPS: { int caps; JOM(8, "SNDCTL_DSP_GETCAPS\n"); -#if defined(UPSAMPLE) +#ifdef UPSAMPLE if (true == peasycap->microphone) caps = 0x04400000; else @@ -809,7 +809,7 @@ case SNDCTL_DSP_GETFMTS: { int incoming; JOM(8, "SNDCTL_DSP_GETFMTS\n"); -#if defined(UPSAMPLE) +#ifdef UPSAMPLE if (true == peasycap->microphone) incoming = AFMT_S16_LE; else @@ -836,7 +836,7 @@ case SNDCTL_DSP_SETFMT: { } JOM(8, "........... %i=incoming\n", incoming); -#if defined(UPSAMPLE) +#ifdef UPSAMPLE if (true == peasycap->microphone) outgoing = AFMT_S16_LE; else @@ -871,7 +871,7 @@ case SNDCTL_DSP_STEREO: { } JOM(8, "........... %i=incoming\n", incoming); -#if defined(UPSAMPLE) +#ifdef UPSAMPLE if (true == peasycap->microphone) incoming = 1; else @@ -898,7 +898,7 @@ case SNDCTL_DSP_SPEED: { } JOM(8, "........... %i=incoming\n", incoming); -#if defined(UPSAMPLE) +#ifdef UPSAMPLE if (true == peasycap->microphone) incoming = 32000; else diff --git a/drivers/staging/easycap/easycap_testcard.c b/drivers/staging/easycap/easycap_testcard.c index 0f8336b6510f..9f21fc8c1390 100644 --- a/drivers/staging/easycap/easycap_testcard.c +++ b/drivers/staging/easycap/easycap_testcard.c @@ -151,7 +151,7 @@ for (line = 0; line < (barheight / 2); line++) { return; } /*****************************************************************************/ -#if defined(EASYCAP_TESTTONE) +#ifdef EASYCAP_TESTTONE /*----------------------------------------------------------------------------- THE tones[] ARRAY BELOW IS THE OUTPUT OF THIS PROGRAM, COMPILED gcc -o prog -lm prog.c -- 2.39.5