diff options
-rw-r--r-- | drivers/media/video/pwc/pwc-v4l.c | 31 |
1 files changed, 23 insertions, 8 deletions
diff --git a/drivers/media/video/pwc/pwc-v4l.c b/drivers/media/video/pwc/pwc-v4l.c index 97e8d629582..566b09c7980 100644 --- a/drivers/media/video/pwc/pwc-v4l.c +++ b/drivers/media/video/pwc/pwc-v4l.c | |||
@@ -575,18 +575,14 @@ static int pwc_s_input(struct file *file, void *fh, unsigned int i) | |||
575 | return i ? -EINVAL : 0; | 575 | return i ? -EINVAL : 0; |
576 | } | 576 | } |
577 | 577 | ||
578 | static int pwc_g_volatile_ctrl(struct v4l2_ctrl *ctrl) | 578 | static int pwc_g_volatile_ctrl_unlocked(struct v4l2_ctrl *ctrl) |
579 | { | 579 | { |
580 | struct pwc_device *pdev = | 580 | struct pwc_device *pdev = |
581 | container_of(ctrl->handler, struct pwc_device, ctrl_handler); | 581 | container_of(ctrl->handler, struct pwc_device, ctrl_handler); |
582 | int ret = 0; | 582 | int ret = 0; |
583 | 583 | ||
584 | mutex_lock(&pdev->udevlock); | 584 | if (!pdev->udev) |
585 | 585 | return -ENODEV; | |
586 | if (!pdev->udev) { | ||
587 | ret = -ENODEV; | ||
588 | goto leave; | ||
589 | } | ||
590 | 586 | ||
591 | switch (ctrl->id) { | 587 | switch (ctrl->id) { |
592 | case V4L2_CID_AUTO_WHITE_BALANCE: | 588 | case V4L2_CID_AUTO_WHITE_BALANCE: |
@@ -651,7 +647,17 @@ static int pwc_g_volatile_ctrl(struct v4l2_ctrl *ctrl) | |||
651 | if (ret) | 647 | if (ret) |
652 | PWC_ERROR("g_ctrl %s error %d\n", ctrl->name, ret); | 648 | PWC_ERROR("g_ctrl %s error %d\n", ctrl->name, ret); |
653 | 649 | ||
654 | leave: | 650 | return ret; |
651 | } | ||
652 | |||
653 | static int pwc_g_volatile_ctrl(struct v4l2_ctrl *ctrl) | ||
654 | { | ||
655 | struct pwc_device *pdev = | ||
656 | container_of(ctrl->handler, struct pwc_device, ctrl_handler); | ||
657 | int ret; | ||
658 | |||
659 | mutex_lock(&pdev->udevlock); | ||
660 | ret = pwc_g_volatile_ctrl_unlocked(ctrl); | ||
655 | mutex_unlock(&pdev->udevlock); | 661 | mutex_unlock(&pdev->udevlock); |
656 | return ret; | 662 | return ret; |
657 | } | 663 | } |
@@ -669,6 +675,15 @@ static int pwc_set_awb(struct pwc_device *pdev) | |||
669 | 675 | ||
670 | if (pdev->auto_white_balance->val != awb_manual) | 676 | if (pdev->auto_white_balance->val != awb_manual) |
671 | pdev->color_bal_valid = false; /* Force cache update */ | 677 | pdev->color_bal_valid = false; /* Force cache update */ |
678 | |||
679 | /* | ||
680 | * If this is a preset, update our red / blue balance values | ||
681 | * so that events get generated for the new preset values | ||
682 | */ | ||
683 | if (pdev->auto_white_balance->val == awb_indoor || | ||
684 | pdev->auto_white_balance->val == awb_outdoor || | ||
685 | pdev->auto_white_balance->val == awb_fl) | ||
686 | pwc_g_volatile_ctrl_unlocked(pdev->auto_white_balance); | ||
672 | } | 687 | } |
673 | if (pdev->auto_white_balance->val != awb_manual) | 688 | if (pdev->auto_white_balance->val != awb_manual) |
674 | return 0; | 689 | return 0; |