aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/radio/dsbr100.c
diff options
context:
space:
mode:
authorAlexey Klimov <klimov.linux@gmail.com>2008-10-19 22:50:27 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2008-10-21 12:28:42 -0400
commit223377e76d68c8015f1c809d3c831423de7b1fb6 (patch)
tree4c3b804cfe13712a870100071c0f1a451511d34f /drivers/media/radio/dsbr100.c
parent448441cf2f97da478c51852fac153ae6bb3430d8 (diff)
V4L/DVB (9304): dsbr100: CodingStyle issue
Fixed few coding style issues in dsbr100 Signed-off-by: Alexey Klimov <klimov.linux@gmail.com> Signed-off-by: Douglas Schilling Landgraf <dougsland@linuxtv.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/radio/dsbr100.c')
-rw-r--r--drivers/media/radio/dsbr100.c52
1 files changed, 29 insertions, 23 deletions
diff --git a/drivers/media/radio/dsbr100.c b/drivers/media/radio/dsbr100.c
index 8ddc8bfcb2cf..e88c58ea1b76 100644
--- a/drivers/media/radio/dsbr100.c
+++ b/drivers/media/radio/dsbr100.c
@@ -171,11 +171,11 @@ static int dsbr100_start(struct dsbr100_device *radio)
171 if (usb_control_msg(radio->usbdev, usb_rcvctrlpipe(radio->usbdev, 0), 171 if (usb_control_msg(radio->usbdev, usb_rcvctrlpipe(radio->usbdev, 0),
172 USB_REQ_GET_STATUS, 172 USB_REQ_GET_STATUS,
173 USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN, 173 USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN,
174 0x00, 0xC7, radio->transfer_buffer, 8, 300)<0 || 174 0x00, 0xC7, radio->transfer_buffer, 8, 300) < 0 ||
175 usb_control_msg(radio->usbdev, usb_rcvctrlpipe(radio->usbdev, 0), 175 usb_control_msg(radio->usbdev, usb_rcvctrlpipe(radio->usbdev, 0),
176 DSB100_ONOFF, 176 DSB100_ONOFF,
177 USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN, 177 USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN,
178 0x01, 0x00, radio->transfer_buffer, 8, 300)<0) 178 0x01, 0x00, radio->transfer_buffer, 8, 300) < 0)
179 return -1; 179 return -1;
180 radio->muted=0; 180 radio->muted=0;
181 return (radio->transfer_buffer)[0]; 181 return (radio->transfer_buffer)[0];
@@ -188,11 +188,11 @@ static int dsbr100_stop(struct dsbr100_device *radio)
188 if (usb_control_msg(radio->usbdev, usb_rcvctrlpipe(radio->usbdev, 0), 188 if (usb_control_msg(radio->usbdev, usb_rcvctrlpipe(radio->usbdev, 0),
189 USB_REQ_GET_STATUS, 189 USB_REQ_GET_STATUS,
190 USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN, 190 USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN,
191 0x16, 0x1C, radio->transfer_buffer, 8, 300)<0 || 191 0x16, 0x1C, radio->transfer_buffer, 8, 300) < 0 ||
192 usb_control_msg(radio->usbdev, usb_rcvctrlpipe(radio->usbdev, 0), 192 usb_control_msg(radio->usbdev, usb_rcvctrlpipe(radio->usbdev, 0),
193 DSB100_ONOFF, 193 DSB100_ONOFF,
194 USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN, 194 USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN,
195 0x00, 0x00, radio->transfer_buffer, 8, 300)<0) 195 0x00, 0x00, radio->transfer_buffer, 8, 300) < 0)
196 return -1; 196 return -1;
197 radio->muted=1; 197 radio->muted=1;
198 return (radio->transfer_buffer)[0]; 198 return (radio->transfer_buffer)[0];
@@ -201,24 +201,24 @@ static int dsbr100_stop(struct dsbr100_device *radio)
201/* set a frequency, freq is defined by v4l's TUNER_LOW, i.e. 1/16th kHz */ 201/* set a frequency, freq is defined by v4l's TUNER_LOW, i.e. 1/16th kHz */
202static int dsbr100_setfreq(struct dsbr100_device *radio, int freq) 202static int dsbr100_setfreq(struct dsbr100_device *radio, int freq)
203{ 203{
204 freq = (freq/16*80)/1000+856; 204 freq = (freq / 16 * 80) / 1000 + 856;
205 if (usb_control_msg(radio->usbdev, usb_rcvctrlpipe(radio->usbdev, 0), 205 if (usb_control_msg(radio->usbdev, usb_rcvctrlpipe(radio->usbdev, 0),
206 DSB100_TUNE, 206 DSB100_TUNE,
207 USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN, 207 USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN,
208 (freq>>8)&0x00ff, freq&0xff, 208 (freq >> 8) & 0x00ff, freq & 0xff,
209 radio->transfer_buffer, 8, 300)<0 || 209 radio->transfer_buffer, 8, 300) < 0 ||
210 usb_control_msg(radio->usbdev, usb_rcvctrlpipe(radio->usbdev, 0), 210 usb_control_msg(radio->usbdev, usb_rcvctrlpipe(radio->usbdev, 0),
211 USB_REQ_GET_STATUS, 211 USB_REQ_GET_STATUS,
212 USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN, 212 USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN,
213 0x96, 0xB7, radio->transfer_buffer, 8, 300)<0 || 213 0x96, 0xB7, radio->transfer_buffer, 8, 300) < 0 ||
214 usb_control_msg(radio->usbdev, usb_rcvctrlpipe(radio->usbdev, 0), 214 usb_control_msg(radio->usbdev, usb_rcvctrlpipe(radio->usbdev, 0),
215 USB_REQ_GET_STATUS, 215 USB_REQ_GET_STATUS,
216 USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN, 216 USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN,
217 0x00, 0x24, radio->transfer_buffer, 8, 300)<0) { 217 0x00, 0x24, radio->transfer_buffer, 8, 300) < 0) {
218 radio->stereo = -1; 218 radio->stereo = -1;
219 return -1; 219 return -1;
220 } 220 }
221 radio->stereo = ! ((radio->transfer_buffer)[0]&0x01); 221 radio->stereo = !((radio->transfer_buffer)[0] & 0x01);
222 return (radio->transfer_buffer)[0]; 222 return (radio->transfer_buffer)[0];
223} 223}
224 224
@@ -229,10 +229,10 @@ static void dsbr100_getstat(struct dsbr100_device *radio)
229 if (usb_control_msg(radio->usbdev, usb_rcvctrlpipe(radio->usbdev, 0), 229 if (usb_control_msg(radio->usbdev, usb_rcvctrlpipe(radio->usbdev, 0),
230 USB_REQ_GET_STATUS, 230 USB_REQ_GET_STATUS,
231 USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN, 231 USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN,
232 0x00 , 0x24, radio->transfer_buffer, 8, 300)<0) 232 0x00 , 0x24, radio->transfer_buffer, 8, 300) < 0)
233 radio->stereo = -1; 233 radio->stereo = -1;
234 else 234 else
235 radio->stereo = ! (radio->transfer_buffer[0]&0x01); 235 radio->stereo = !(radio->transfer_buffer[0] & 0x01);
236} 236}
237 237
238 238
@@ -282,9 +282,9 @@ static int vidioc_g_tuner(struct file *file, void *priv,
282 dsbr100_getstat(radio); 282 dsbr100_getstat(radio);
283 strcpy(v->name, "FM"); 283 strcpy(v->name, "FM");
284 v->type = V4L2_TUNER_RADIO; 284 v->type = V4L2_TUNER_RADIO;
285 v->rangelow = FREQ_MIN*FREQ_MUL; 285 v->rangelow = FREQ_MIN * FREQ_MUL;
286 v->rangehigh = FREQ_MAX*FREQ_MUL; 286 v->rangehigh = FREQ_MAX * FREQ_MUL;
287 v->rxsubchans = V4L2_TUNER_SUB_MONO|V4L2_TUNER_SUB_STEREO; 287 v->rxsubchans = V4L2_TUNER_SUB_MONO | V4L2_TUNER_SUB_STEREO;
288 v->capability = V4L2_TUNER_CAP_LOW; 288 v->capability = V4L2_TUNER_CAP_LOW;
289 if(radio->stereo) 289 if(radio->stereo)
290 v->audmode = V4L2_TUNER_MODE_STEREO; 290 v->audmode = V4L2_TUNER_MODE_STEREO;
@@ -309,7 +309,7 @@ static int vidioc_s_frequency(struct file *file, void *priv,
309 struct dsbr100_device *radio = video_drvdata(file); 309 struct dsbr100_device *radio = video_drvdata(file);
310 310
311 radio->curfreq = f->frequency; 311 radio->curfreq = f->frequency;
312 if (dsbr100_setfreq(radio, radio->curfreq)==-1) 312 if (dsbr100_setfreq(radio, radio->curfreq) == -1)
313 dev_warn(&radio->usbdev->dev, "Set frequency failed\n"); 313 dev_warn(&radio->usbdev->dev, "Set frequency failed\n");
314 return 0; 314 return 0;
315} 315}
@@ -331,8 +331,7 @@ static int vidioc_queryctrl(struct file *file, void *priv,
331 331
332 for (i = 0; i < ARRAY_SIZE(radio_qctrl); i++) { 332 for (i = 0; i < ARRAY_SIZE(radio_qctrl); i++) {
333 if (qc->id && qc->id == radio_qctrl[i].id) { 333 if (qc->id && qc->id == radio_qctrl[i].id) {
334 memcpy(qc, &(radio_qctrl[i]), 334 memcpy(qc, &(radio_qctrl[i]), sizeof(*qc));
335 sizeof(*qc));
336 return 0; 335 return 0;
337 } 336 }
338 } 337 }
@@ -417,7 +416,7 @@ static int usb_dsbr100_open(struct inode *inode, struct file *file)
417 radio->users = 1; 416 radio->users = 1;
418 radio->muted = 1; 417 radio->muted = 1;
419 418
420 if (dsbr100_start(radio)<0) { 419 if (dsbr100_start(radio) < 0) {
421 dev_warn(&radio->usbdev->dev, 420 dev_warn(&radio->usbdev->dev,
422 "Radio did not start up properly\n"); 421 "Radio did not start up properly\n");
423 radio->users = 0; 422 radio->users = 0;
@@ -485,13 +484,20 @@ static int usb_dsbr100_probe(struct usb_interface *intf,
485{ 484{
486 struct dsbr100_device *radio; 485 struct dsbr100_device *radio;
487 486
488 if (!(radio = kmalloc(sizeof(struct dsbr100_device), GFP_KERNEL))) 487 radio = kmalloc(sizeof(struct dsbr100_device), GFP_KERNEL);
488
489 if (!radio)
489 return -ENOMEM; 490 return -ENOMEM;
490 if (!(radio->transfer_buffer = kmalloc(TB_LEN, GFP_KERNEL))) { 491
492 radio->transfer_buffer = kmalloc(TB_LEN, GFP_KERNEL);
493
494 if (!(radio->transfer_buffer)) {
491 kfree(radio); 495 kfree(radio);
492 return -ENOMEM; 496 return -ENOMEM;
493 } 497 }
494 if (!(radio->videodev = video_device_alloc())) { 498 radio->videodev = video_device_alloc();
499
500 if (!(radio->videodev)) {
495 kfree(radio->transfer_buffer); 501 kfree(radio->transfer_buffer);
496 kfree(radio); 502 kfree(radio);
497 return -ENOMEM; 503 return -ENOMEM;
@@ -501,7 +507,7 @@ static int usb_dsbr100_probe(struct usb_interface *intf,
501 radio->removed = 0; 507 radio->removed = 0;
502 radio->users = 0; 508 radio->users = 0;
503 radio->usbdev = interface_to_usbdev(intf); 509 radio->usbdev = interface_to_usbdev(intf);
504 radio->curfreq = FREQ_MIN*FREQ_MUL; 510 radio->curfreq = FREQ_MIN * FREQ_MUL;
505 video_set_drvdata(radio->videodev, radio); 511 video_set_drvdata(radio->videodev, radio);
506 if (video_register_device(radio->videodev, VFL_TYPE_RADIO, radio_nr) < 0) { 512 if (video_register_device(radio->videodev, VFL_TYPE_RADIO, radio_nr) < 0) {
507 dev_warn(&intf->dev, "Could not register video device\n"); 513 dev_warn(&intf->dev, "Could not register video device\n");