diff options
author | Alexey Klimov <klimov.linux@gmail.com> | 2009-02-05 06:48:43 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2009-03-30 11:42:39 -0400 |
commit | a5d6947515cc489001938339a8de9c000b2f8aba (patch) | |
tree | 9362486fc9b9948ff4e6a402cc7c6f42277db097 /drivers/media/radio | |
parent | d563399859bcc984aa2df38df62851163b1690b3 (diff) |
V4L/DVB (10455): radio-mr800: codingstyle cleanups
Cleanups of many if-check constructions.
Signed-off-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.c | 36 |
1 files changed, 25 insertions, 11 deletions
diff --git a/drivers/media/radio/radio-mr800.c b/drivers/media/radio/radio-mr800.c index 624e98b575cf..6ffb72717623 100644 --- a/drivers/media/radio/radio-mr800.c +++ b/drivers/media/radio/radio-mr800.c | |||
@@ -375,13 +375,15 @@ static int vidioc_s_frequency(struct file *file, void *priv, | |||
375 | struct v4l2_frequency *f) | 375 | struct v4l2_frequency *f) |
376 | { | 376 | { |
377 | struct amradio_device *radio = video_get_drvdata(video_devdata(file)); | 377 | struct amradio_device *radio = video_get_drvdata(video_devdata(file)); |
378 | int retval; | ||
378 | 379 | ||
379 | /* safety check */ | 380 | /* safety check */ |
380 | if (radio->removed) | 381 | if (radio->removed) |
381 | return -EIO; | 382 | return -EIO; |
382 | 383 | ||
383 | radio->curfreq = f->frequency; | 384 | radio->curfreq = f->frequency; |
384 | if (amradio_setfreq(radio, radio->curfreq) < 0) | 385 | retval = amradio_setfreq(radio, radio->curfreq); |
386 | if (retval < 0) | ||
385 | amradio_dev_warn(&radio->videodev->dev, | 387 | amradio_dev_warn(&radio->videodev->dev, |
386 | "set frequency failed\n"); | 388 | "set frequency failed\n"); |
387 | return 0; | 389 | return 0; |
@@ -440,6 +442,7 @@ static int vidioc_s_ctrl(struct file *file, void *priv, | |||
440 | struct v4l2_control *ctrl) | 442 | struct v4l2_control *ctrl) |
441 | { | 443 | { |
442 | struct amradio_device *radio = video_get_drvdata(video_devdata(file)); | 444 | struct amradio_device *radio = video_get_drvdata(video_devdata(file)); |
445 | int retval; | ||
443 | 446 | ||
444 | /* safety check */ | 447 | /* safety check */ |
445 | if (radio->removed) | 448 | if (radio->removed) |
@@ -448,13 +451,15 @@ static int vidioc_s_ctrl(struct file *file, void *priv, | |||
448 | switch (ctrl->id) { | 451 | switch (ctrl->id) { |
449 | case V4L2_CID_AUDIO_MUTE: | 452 | case V4L2_CID_AUDIO_MUTE: |
450 | if (ctrl->value) { | 453 | if (ctrl->value) { |
451 | if (amradio_stop(radio) < 0) { | 454 | retval = amradio_stop(radio); |
455 | if (retval < 0) { | ||
452 | amradio_dev_warn(&radio->videodev->dev, | 456 | amradio_dev_warn(&radio->videodev->dev, |
453 | "amradio_stop failed\n"); | 457 | "amradio_stop failed\n"); |
454 | return -1; | 458 | return -1; |
455 | } | 459 | } |
456 | } else { | 460 | } else { |
457 | if (amradio_start(radio) < 0) { | 461 | retval = amradio_start(radio); |
462 | if (retval < 0) { | ||
458 | amradio_dev_warn(&radio->videodev->dev, | 463 | amradio_dev_warn(&radio->videodev->dev, |
459 | "amradio_start failed\n"); | 464 | "amradio_start failed\n"); |
460 | return -1; | 465 | return -1; |
@@ -505,20 +510,24 @@ static int vidioc_s_input(struct file *filp, void *priv, unsigned int i) | |||
505 | static int usb_amradio_open(struct file *file) | 510 | static int usb_amradio_open(struct file *file) |
506 | { | 511 | { |
507 | struct amradio_device *radio = video_get_drvdata(video_devdata(file)); | 512 | struct amradio_device *radio = video_get_drvdata(video_devdata(file)); |
513 | int retval; | ||
508 | 514 | ||
509 | lock_kernel(); | 515 | lock_kernel(); |
510 | 516 | ||
511 | radio->users = 1; | 517 | radio->users = 1; |
512 | radio->muted = 1; | 518 | radio->muted = 1; |
513 | 519 | ||
514 | if (amradio_start(radio) < 0) { | 520 | retval = amradio_start(radio); |
521 | if (retval < 0) { | ||
515 | amradio_dev_warn(&radio->videodev->dev, | 522 | amradio_dev_warn(&radio->videodev->dev, |
516 | "radio did not start up properly\n"); | 523 | "radio did not start up properly\n"); |
517 | radio->users = 0; | 524 | radio->users = 0; |
518 | unlock_kernel(); | 525 | unlock_kernel(); |
519 | return -EIO; | 526 | return -EIO; |
520 | } | 527 | } |
521 | if (amradio_setfreq(radio, radio->curfreq) < 0) | 528 | |
529 | retval = amradio_setfreq(radio, radio->curfreq); | ||
530 | if (retval < 0) | ||
522 | amradio_dev_warn(&radio->videodev->dev, | 531 | amradio_dev_warn(&radio->videodev->dev, |
523 | "set frequency failed\n"); | 532 | "set frequency failed\n"); |
524 | 533 | ||
@@ -551,8 +560,10 @@ static int usb_amradio_close(struct file *file) | |||
551 | static int usb_amradio_suspend(struct usb_interface *intf, pm_message_t message) | 560 | static int usb_amradio_suspend(struct usb_interface *intf, pm_message_t message) |
552 | { | 561 | { |
553 | struct amradio_device *radio = usb_get_intfdata(intf); | 562 | struct amradio_device *radio = usb_get_intfdata(intf); |
563 | int retval; | ||
554 | 564 | ||
555 | if (amradio_stop(radio) < 0) | 565 | retval = amradio_stop(radio); |
566 | if (retval < 0) | ||
556 | dev_warn(&intf->dev, "amradio_stop failed\n"); | 567 | dev_warn(&intf->dev, "amradio_stop failed\n"); |
557 | 568 | ||
558 | dev_info(&intf->dev, "going into suspend..\n"); | 569 | dev_info(&intf->dev, "going into suspend..\n"); |
@@ -564,8 +575,10 @@ static int usb_amradio_suspend(struct usb_interface *intf, pm_message_t message) | |||
564 | static int usb_amradio_resume(struct usb_interface *intf) | 575 | static int usb_amradio_resume(struct usb_interface *intf) |
565 | { | 576 | { |
566 | struct amradio_device *radio = usb_get_intfdata(intf); | 577 | struct amradio_device *radio = usb_get_intfdata(intf); |
578 | int retval; | ||
567 | 579 | ||
568 | if (amradio_start(radio) < 0) | 580 | retval = amradio_start(radio); |
581 | if (retval < 0) | ||
569 | dev_warn(&intf->dev, "amradio_start failed\n"); | 582 | dev_warn(&intf->dev, "amradio_start failed\n"); |
570 | 583 | ||
571 | dev_info(&intf->dev, "coming out of suspend..\n"); | 584 | dev_info(&intf->dev, "coming out of suspend..\n"); |
@@ -616,16 +629,16 @@ static struct video_device amradio_videodev_template = { | |||
616 | .release = usb_amradio_device_release, | 629 | .release = usb_amradio_device_release, |
617 | }; | 630 | }; |
618 | 631 | ||
619 | /* check if the device is present and register with v4l and | 632 | /* check if the device is present and register with v4l and usb if it is */ |
620 | usb if it is */ | ||
621 | static int usb_amradio_probe(struct usb_interface *intf, | 633 | static int usb_amradio_probe(struct usb_interface *intf, |
622 | const struct usb_device_id *id) | 634 | const struct usb_device_id *id) |
623 | { | 635 | { |
624 | struct amradio_device *radio; | 636 | struct amradio_device *radio; |
637 | int retval; | ||
625 | 638 | ||
626 | radio = kmalloc(sizeof(struct amradio_device), GFP_KERNEL); | 639 | radio = kmalloc(sizeof(struct amradio_device), GFP_KERNEL); |
627 | 640 | ||
628 | if (!(radio)) | 641 | if (!radio) |
629 | return -ENOMEM; | 642 | return -ENOMEM; |
630 | 643 | ||
631 | radio->buffer = kmalloc(BUFFER_LENGTH, GFP_KERNEL); | 644 | radio->buffer = kmalloc(BUFFER_LENGTH, GFP_KERNEL); |
@@ -654,7 +667,8 @@ static int usb_amradio_probe(struct usb_interface *intf, | |||
654 | mutex_init(&radio->lock); | 667 | mutex_init(&radio->lock); |
655 | 668 | ||
656 | video_set_drvdata(radio->videodev, radio); | 669 | video_set_drvdata(radio->videodev, radio); |
657 | if (video_register_device(radio->videodev, VFL_TYPE_RADIO, radio_nr)) { | 670 | retval = video_register_device(radio->videodev, VFL_TYPE_RADIO, radio_nr); |
671 | if (retval < 0) { | ||
658 | dev_warn(&intf->dev, "could not register video device\n"); | 672 | dev_warn(&intf->dev, "could not register video device\n"); |
659 | video_device_release(radio->videodev); | 673 | video_device_release(radio->videodev); |
660 | kfree(radio->buffer); | 674 | kfree(radio->buffer); |