Commit e631dac6 authored by Gerd Knorr's avatar Gerd Knorr Committed by Linus Torvalds

[PATCH] v4l: pwc webcam update

This patch adapts the philips webcam driver to the videodev changes.
Also has the unplug race fix.
parent 8721ad19
...@@ -1084,62 +1084,52 @@ int pwc_ioctl(struct pwc_device *pdev, unsigned int cmd, void *arg) ...@@ -1084,62 +1084,52 @@ int pwc_ioctl(struct pwc_device *pdev, unsigned int cmd, void *arg)
case VIDIOCPWCSCQUAL: case VIDIOCPWCSCQUAL:
{ {
int qual, ret; int *qual = arg;
int ret;
if (copy_from_user(&qual, arg, sizeof(int)))
return -EFAULT;
if (qual < 0 || qual > 3) if (*qual < 0 || *qual > 3)
return -EINVAL; return -EINVAL;
ret = pwc_try_video_mode(pdev, pdev->view.x, pdev->view.y, pdev->vframes, qual, pdev->vsnapshot); ret = pwc_try_video_mode(pdev, pdev->view.x, pdev->view.y, pdev->vframes, *qual, pdev->vsnapshot);
if (ret < 0) if (ret < 0)
return ret; return ret;
pdev->vcompression = qual; pdev->vcompression = *qual;
break; break;
} }
case VIDIOCPWCGCQUAL: case VIDIOCPWCGCQUAL:
{ {
if (copy_to_user(arg, &pdev->vcompression, sizeof(int))) int *qual = arg;
return -EFAULT;
*qual = pdev->vcompression;
break; break;
} }
case VIDIOCPWCSAGC: case VIDIOCPWCSAGC:
{ {
int agc; int *agc = arg;
if (copy_from_user(&agc, arg, sizeof(agc))) if (pwc_set_agc(pdev, *agc < 0 ? 1 : 0, *agc))
return -EFAULT;
else {
if (pwc_set_agc(pdev, agc < 0 ? 1 : 0, agc))
return -EINVAL; return -EINVAL;
}
break; break;
} }
case VIDIOCPWCGAGC: case VIDIOCPWCGAGC:
{ {
int agc; int *agc = arg;
if (pwc_get_agc(pdev, &agc)) if (pwc_get_agc(pdev, agc))
return -EINVAL; return -EINVAL;
if (copy_to_user(arg, &agc, sizeof(agc)))
return -EFAULT;
break; break;
} }
case VIDIOCPWCSSHUTTER: case VIDIOCPWCSSHUTTER:
{ {
int shutter_speed, ret; int *shutter_speed = arg;
int ret;
if (copy_from_user(&shutter_speed, arg, sizeof(shutter_speed))) ret = pwc_set_shutter_speed(pdev, *shutter_speed < 0 ? 1 : 0, *shutter_speed);
return -EFAULT;
else {
ret = pwc_set_shutter_speed(pdev, shutter_speed < 0 ? 1 : 0, shutter_speed);
if (ret < 0) if (ret < 0)
return ret; return ret;
}
break; break;
} }
...@@ -1149,48 +1139,40 @@ int pwc_ioctl(struct pwc_device *pdev, unsigned int cmd, void *arg) ...@@ -1149,48 +1139,40 @@ int pwc_ioctl(struct pwc_device *pdev, unsigned int cmd, void *arg)
case VIDIOCPWCSAWB: case VIDIOCPWCSAWB:
{ {
struct pwc_whitebalance wb; struct pwc_whitebalance *wb = arg;
int ret; int ret;
if (copy_from_user(&wb, arg, sizeof(wb))) ret = pwc_set_awb(pdev, wb->mode);
return -EFAULT; if (ret >= 0 && wb->mode == PWC_WB_MANUAL) {
pwc_set_red_gain(pdev, wb->manual_red);
ret = pwc_set_awb(pdev, wb.mode); pwc_set_blue_gain(pdev, wb->manual_blue);
if (ret >= 0 && wb.mode == PWC_WB_MANUAL) {
pwc_set_red_gain(pdev, wb.manual_red);
pwc_set_blue_gain(pdev, wb.manual_blue);
} }
break; break;
} }
case VIDIOCPWCGAWB: case VIDIOCPWCGAWB:
{ {
struct pwc_whitebalance wb; struct pwc_whitebalance *wb = arg;
memset(&wb, 0, sizeof(wb)); memset(wb, 0, sizeof(*wb));
wb.mode = pwc_get_awb(pdev); wb->mode = pwc_get_awb(pdev);
if (wb.mode < 0) if (wb->mode < 0)
return -EINVAL; return -EINVAL;
wb.manual_red = pwc_get_red_gain(pdev); wb->manual_red = pwc_get_red_gain(pdev);
wb.manual_blue = pwc_get_blue_gain(pdev); wb->manual_blue = pwc_get_blue_gain(pdev);
if (wb.mode == PWC_WB_AUTO) { if (wb->mode == PWC_WB_AUTO) {
wb.read_red = pwc_read_red_gain(pdev); wb->read_red = pwc_read_red_gain(pdev);
wb.read_blue = pwc_read_blue_gain(pdev); wb->read_blue = pwc_read_blue_gain(pdev);
} }
if (copy_to_user(arg, &wb, sizeof(wb)))
return -EFAULT;
break; break;
} }
case VIDIOCPWCSLED: case VIDIOCPWCSLED:
{ {
int ret; int ret;
struct pwc_leds leds; struct pwc_leds *leds = arg;
if (copy_from_user(&leds, arg, sizeof(leds)))
return -EFAULT;
ret = pwc_set_leds(pdev, leds.led_on, leds.led_off); ret = pwc_set_leds(pdev, leds->led_on, leds->led_off);
if (ret<0) if (ret<0)
return ret; return ret;
break; break;
...@@ -1201,13 +1183,11 @@ int pwc_ioctl(struct pwc_device *pdev, unsigned int cmd, void *arg) ...@@ -1201,13 +1183,11 @@ int pwc_ioctl(struct pwc_device *pdev, unsigned int cmd, void *arg)
case VIDIOCPWCGLED: case VIDIOCPWCGLED:
{ {
int led; int led;
struct pwc_leds leds; struct pwc_leds *leds = arg;
led = pwc_get_leds(pdev, &leds.led_on, &leds.led_off); led = pwc_get_leds(pdev, &leds->led_on, &leds->led_off);
if (led < 0) if (led < 0)
return -EINVAL; return -EINVAL;
if (copy_to_user(arg, &leds, sizeof(leds)))
return -EFAULT;
break; break;
} }
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment