aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/radio
diff options
context:
space:
mode:
authorDavid Ellingsworth <david@identd.dyndns.org>2009-09-23 17:28:02 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2009-12-05 15:40:12 -0500
commit16a72f41bb82573d7fe1dfea1cb8356dee307db4 (patch)
tree81b1970c3f266576b514693dac2cc9ad79050a1b /drivers/media/radio
parentd8970e5fd9eace437bc2f1aaff1c2a05fb3448ea (diff)
V4L/DVB (13072): radio-mr800: simplify device warnings
Simplify device warnings. Signed-off-by: David Ellingsworth <david@identd.dyndns.org> Acked-by: Alexey Klimov <klimov.linux@gmail.com> Signed-off-by: Douglas Schilling Landgraf <dougsland@redhat.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/radio')
-rw-r--r--drivers/media/radio/radio-mr800.c78
1 files changed, 26 insertions, 52 deletions
diff --git a/drivers/media/radio/radio-mr800.c b/drivers/media/radio/radio-mr800.c
index ac2107378942..5506fac5fd49 100644
--- a/drivers/media/radio/radio-mr800.c
+++ b/drivers/media/radio/radio-mr800.c
@@ -186,8 +186,10 @@ static int amradio_set_mute(struct amradio_device *radio, char argument)
186 retval = usb_bulk_msg(radio->usbdev, usb_sndintpipe(radio->usbdev, 2), 186 retval = usb_bulk_msg(radio->usbdev, usb_sndintpipe(radio->usbdev, 2),
187 (void *) (radio->buffer), BUFFER_LENGTH, &size, USB_TIMEOUT); 187 (void *) (radio->buffer), BUFFER_LENGTH, &size, USB_TIMEOUT);
188 188
189 if (retval < 0 || size != BUFFER_LENGTH) 189 if (retval < 0 || size != BUFFER_LENGTH) {
190 amradio_dev_warn(&radio->videodev.dev, "set mute failed\n");
190 return retval; 191 return retval;
192 }
191 193
192 radio->muted = argument; 194 radio->muted = argument;
193 195
@@ -216,7 +218,7 @@ static int amradio_setfreq(struct amradio_device *radio, int freq)
216 (void *) (radio->buffer), BUFFER_LENGTH, &size, USB_TIMEOUT); 218 (void *) (radio->buffer), BUFFER_LENGTH, &size, USB_TIMEOUT);
217 219
218 if (retval < 0 || size != BUFFER_LENGTH) 220 if (retval < 0 || size != BUFFER_LENGTH)
219 return retval; 221 goto out_err;
220 222
221 /* frequency is calculated from freq_send and placed in first 2 bytes */ 223 /* frequency is calculated from freq_send and placed in first 2 bytes */
222 radio->buffer[0] = (freq_send >> 8) & 0xff; 224 radio->buffer[0] = (freq_send >> 8) & 0xff;
@@ -230,6 +232,14 @@ static int amradio_setfreq(struct amradio_device *radio, int freq)
230 retval = usb_bulk_msg(radio->usbdev, usb_sndintpipe(radio->usbdev, 2), 232 retval = usb_bulk_msg(radio->usbdev, usb_sndintpipe(radio->usbdev, 2),
231 (void *) (radio->buffer), BUFFER_LENGTH, &size, USB_TIMEOUT); 233 (void *) (radio->buffer), BUFFER_LENGTH, &size, USB_TIMEOUT);
232 234
235 if (retval < 0 || size != BUFFER_LENGTH)
236 goto out_err;
237
238 goto out;
239
240out_err:
241 amradio_dev_warn(&radio->videodev.dev, "set frequency failed\n");
242out:
233 return retval; 243 return retval;
234} 244}
235 245
@@ -252,8 +262,10 @@ static int amradio_set_stereo(struct amradio_device *radio, char argument)
252 retval = usb_bulk_msg(radio->usbdev, usb_sndintpipe(radio->usbdev, 2), 262 retval = usb_bulk_msg(radio->usbdev, usb_sndintpipe(radio->usbdev, 2),
253 (void *) (radio->buffer), BUFFER_LENGTH, &size, USB_TIMEOUT); 263 (void *) (radio->buffer), BUFFER_LENGTH, &size, USB_TIMEOUT);
254 264
255 if (retval < 0 || size != BUFFER_LENGTH) 265 if (retval < 0 || size != BUFFER_LENGTH) {
266 amradio_dev_warn(&radio->videodev.dev, "set stereo failed\n");
256 return retval; 267 return retval;
268 }
257 269
258 if (argument == WANT_STEREO) 270 if (argument == WANT_STEREO)
259 radio->stereo = 1; 271 radio->stereo = 1;
@@ -314,9 +326,6 @@ static int vidioc_g_tuner(struct file *file, void *priv,
314 * amradio_set_stereo shouldn't be here 326 * amradio_set_stereo shouldn't be here
315 */ 327 */
316 retval = amradio_set_stereo(radio, WANT_STEREO); 328 retval = amradio_set_stereo(radio, WANT_STEREO);
317 if (retval < 0)
318 amradio_dev_warn(&radio->videodev.dev,
319 "set stereo failed\n");
320 329
321 strcpy(v->name, "FM"); 330 strcpy(v->name, "FM");
322 v->type = V4L2_TUNER_RADIO; 331 v->type = V4L2_TUNER_RADIO;
@@ -348,15 +357,9 @@ static int vidioc_s_tuner(struct file *file, void *priv,
348 switch (v->audmode) { 357 switch (v->audmode) {
349 case V4L2_TUNER_MODE_MONO: 358 case V4L2_TUNER_MODE_MONO:
350 retval = amradio_set_stereo(radio, WANT_MONO); 359 retval = amradio_set_stereo(radio, WANT_MONO);
351 if (retval < 0)
352 amradio_dev_warn(&radio->videodev.dev,
353 "set mono failed\n");
354 break; 360 break;
355 case V4L2_TUNER_MODE_STEREO: 361 case V4L2_TUNER_MODE_STEREO:
356 retval = amradio_set_stereo(radio, WANT_STEREO); 362 retval = amradio_set_stereo(radio, WANT_STEREO);
357 if (retval < 0)
358 amradio_dev_warn(&radio->videodev.dev,
359 "set stereo failed\n");
360 break; 363 break;
361 } 364 }
362 365
@@ -373,9 +376,6 @@ static int vidioc_s_frequency(struct file *file, void *priv,
373 radio->curfreq = f->frequency; 376 radio->curfreq = f->frequency;
374 377
375 retval = amradio_setfreq(radio, radio->curfreq); 378 retval = amradio_setfreq(radio, radio->curfreq);
376 if (retval < 0)
377 amradio_dev_warn(&radio->videodev.dev,
378 "set frequency failed\n");
379 379
380 return retval; 380 return retval;
381} 381}
@@ -428,19 +428,11 @@ static int vidioc_s_ctrl(struct file *file, void *priv,
428 428
429 switch (ctrl->id) { 429 switch (ctrl->id) {
430 case V4L2_CID_AUDIO_MUTE: 430 case V4L2_CID_AUDIO_MUTE:
431 if (ctrl->value) { 431 if (ctrl->value)
432 retval = amradio_set_mute(radio, AMRADIO_STOP); 432 retval = amradio_set_mute(radio, AMRADIO_STOP);
433 if (retval < 0) { 433 else
434 amradio_dev_warn(&radio->videodev.dev,
435 "amradio_stop failed\n");
436 }
437 } else {
438 retval = amradio_set_mute(radio, AMRADIO_START); 434 retval = amradio_set_mute(radio, AMRADIO_START);
439 if (retval < 0) { 435
440 amradio_dev_warn(&radio->videodev.dev,
441 "amradio_start failed\n");
442 }
443 }
444 break; 436 break;
445 } 437 }
446 438
@@ -488,16 +480,12 @@ static int usb_amradio_init(struct amradio_device *radio)
488 int retval; 480 int retval;
489 481
490 retval = amradio_set_mute(radio, AMRADIO_STOP); 482 retval = amradio_set_mute(radio, AMRADIO_STOP);
491 if (retval < 0) { 483 if (retval)
492 amradio_dev_warn(&radio->videodev.dev, "amradio_stop failed\n");
493 goto out_err; 484 goto out_err;
494 }
495 485
496 retval = amradio_set_stereo(radio, WANT_STEREO); 486 retval = amradio_set_stereo(radio, WANT_STEREO);
497 if (retval < 0) { 487 if (retval)
498 amradio_dev_warn(&radio->videodev.dev, "set stereo failed\n");
499 goto out_err; 488 goto out_err;
500 }
501 489
502 radio->initialized = 1; 490 radio->initialized = 1;
503 goto out; 491 goto out;
@@ -570,14 +558,11 @@ unlock:
570static int usb_amradio_suspend(struct usb_interface *intf, pm_message_t message) 558static int usb_amradio_suspend(struct usb_interface *intf, pm_message_t message)
571{ 559{
572 struct amradio_device *radio = usb_get_intfdata(intf); 560 struct amradio_device *radio = usb_get_intfdata(intf);
573 int retval;
574 561
575 mutex_lock(&radio->lock); 562 mutex_lock(&radio->lock);
576 563
577 if (!radio->muted && radio->initialized) { 564 if (!radio->muted && radio->initialized) {
578 retval = amradio_set_mute(radio, AMRADIO_STOP); 565 amradio_set_mute(radio, AMRADIO_STOP);
579 if (retval < 0)
580 dev_warn(&intf->dev, "amradio_stop failed\n");
581 radio->muted = 0; 566 radio->muted = 0;
582 } 567 }
583 568
@@ -591,7 +576,6 @@ static int usb_amradio_suspend(struct usb_interface *intf, pm_message_t message)
591static int usb_amradio_resume(struct usb_interface *intf) 576static int usb_amradio_resume(struct usb_interface *intf)
592{ 577{
593 struct amradio_device *radio = usb_get_intfdata(intf); 578 struct amradio_device *radio = usb_get_intfdata(intf);
594 int retval;
595 579
596 mutex_lock(&radio->lock); 580 mutex_lock(&radio->lock);
597 581
@@ -599,24 +583,14 @@ static int usb_amradio_resume(struct usb_interface *intf)
599 goto unlock; 583 goto unlock;
600 584
601 if (radio->stereo) 585 if (radio->stereo)
602 retval = amradio_set_stereo(radio, WANT_STEREO); 586 amradio_set_stereo(radio, WANT_STEREO);
603 else 587 else
604 retval = amradio_set_stereo(radio, WANT_MONO); 588 amradio_set_stereo(radio, WANT_MONO);
605 589
606 if (retval < 0) 590 amradio_setfreq(radio, radio->curfreq);
607 amradio_dev_warn(&radio->videodev.dev, "set stereo failed\n");
608 591
609 retval = amradio_setfreq(radio, radio->curfreq); 592 if (!radio->muted)
610 if (retval < 0) 593 amradio_set_mute(radio, AMRADIO_START);
611 amradio_dev_warn(&radio->videodev.dev,
612 "set frequency failed\n");
613
614 if (!radio->muted) {
615 retval = amradio_set_mute(radio, AMRADIO_START);
616 if (retval < 0)
617 dev_warn(&radio->videodev.dev,
618 "amradio_start failed\n");
619 }
620 594
621unlock: 595unlock:
622 dev_info(&intf->dev, "coming out of suspend..\n"); 596 dev_info(&intf->dev, "coming out of suspend..\n");