vserver 1.9.5.x5
[linux-2.6.git] / drivers / usb / media / konicawc.c
index 311138c..7ff1468 100644 (file)
@@ -68,7 +68,7 @@ static const int debug = 0;
 /* Some default values for initial camera settings,
    can be set by modprobe */
 
-static enum frame_sizes size;  
+static int size;       
 static int speed = 6;          /* Speed (fps) 0 (slowest) to 6 (fastest) */
 static int brightness =        MAX_BRIGHTNESS/2;
 static int contrast =  MAX_CONTRAST/2;
@@ -324,7 +324,7 @@ static void resubmit_urb(struct uvd *uvd, struct urb *urb)
         }
         urb->dev = uvd->dev;
         urb->status = 0;
-        ret = usb_submit_urb(urb, GFP_KERNEL);
+       ret = usb_submit_urb(urb, GFP_ATOMIC);
        DEBUG(3, "submitting urb of length %d", urb->transfer_buffer_length);
         if(ret)
                 err("usb_submit_urb error (%d)", ret);
@@ -362,8 +362,8 @@ static void konicawc_isoc_irq(struct urb *urb, struct pt_regs *regs)
                else if (!urb->status && !cam->last_data_urb->status)
                        len = konicawc_compress_iso(uvd, cam->last_data_urb, urb);
 
-               resubmit_urb(uvd, urb);
                resubmit_urb(uvd, cam->last_data_urb);
+               resubmit_urb(uvd, urb);
                cam->last_data_urb = NULL;
                uvd->stats.urb_length = len;
                uvd->stats.data_count += len;
@@ -390,7 +390,7 @@ static int konicawc_start_data(struct uvd *uvd)
                                spd_to_iface[cam->speed]);
        if (!interface)
                return -ENXIO;
-       pktsz = interface->endpoint[1].desc.wMaxPacketSize;
+       pktsz = le16_to_cpu(interface->endpoint[1].desc.wMaxPacketSize);
        DEBUG(1, "pktsz = %d", pktsz);
        if (!CAMERA_IS_OPERATIONAL(uvd)) {
                err("Camera is not operational");
@@ -474,13 +474,8 @@ static void konicawc_stop_data(struct uvd *uvd)
 
        /* Unschedule all of the iso td's */
        for (i=0; i < USBVIDEO_NUMSBUF; i++) {
-               j = usb_unlink_urb(uvd->sbuf[i].urb);
-               if (j < 0)
-                       err("usb_unlink_urb() error %d.", j);
-
-               j = usb_unlink_urb(cam->sts_urb[i]);
-               if (j < 0)
-                       err("usb_unlink_urb() error %d.", j);
+               usb_kill_urb(uvd->sbuf[i].urb);
+               usb_kill_urb(cam->sts_urb[i]);
        }
 
        if (!uvd->remove_pending) {
@@ -737,7 +732,7 @@ static int konicawc_probe(struct usb_interface *intf, const struct usb_device_id
        if (dev->descriptor.bNumConfigurations != 1)
                return -ENODEV;
 
-       info("Konica Webcam (rev. 0x%04x)", dev->descriptor.bcdDevice);
+       info("Konica Webcam (rev. 0x%04x)", le16_to_cpu(dev->descriptor.bcdDevice));
        RESTRICT_TO_RANGE(speed, 0, MAX_SPEED);
 
        /* Validate found interface: must have one ISO endpoint */
@@ -761,7 +756,7 @@ static int konicawc_probe(struct usb_interface *intf, const struct usb_device_id
                }
                endpoint = &interface->endpoint[1].desc;
                DEBUG(1, "found endpoint: addr: 0x%2.2x maxps = 0x%4.4x",
-                   endpoint->bEndpointAddress, endpoint->wMaxPacketSize);
+                   endpoint->bEndpointAddress, le16_to_cpu(endpoint->wMaxPacketSize));
                if (video_ep == 0)
                        video_ep = endpoint->bEndpointAddress;
                else if (video_ep != endpoint->bEndpointAddress) {
@@ -778,7 +773,7 @@ static int konicawc_probe(struct usb_interface *intf, const struct usb_device_id
                            interface->desc.bInterfaceNumber);
                        return -ENODEV;
                }
-               if (endpoint->wMaxPacketSize == 0) {
+               if (le16_to_cpu(endpoint->wMaxPacketSize) == 0) {
                        if (inactInterface < 0)
                                inactInterface = i;
                        else {
@@ -791,8 +786,8 @@ static int konicawc_probe(struct usb_interface *intf, const struct usb_device_id
                                actInterface = i;
                        }
                }
-               if(endpoint->wMaxPacketSize > maxPS)
-                       maxPS = endpoint->wMaxPacketSize;
+               if (le16_to_cpu(endpoint->wMaxPacketSize) > maxPS)
+                       maxPS = le16_to_cpu(endpoint->wMaxPacketSize);
        }
        if(actInterface == -1) {
                err("Cant find required endpoint");
@@ -851,9 +846,9 @@ static int konicawc_probe(struct usb_interface *intf, const struct usb_device_id
                cam->input.evbit[0] = BIT(EV_KEY);
                cam->input.keybit[LONG(BTN_0)] = BIT(BTN_0);
                cam->input.id.bustype = BUS_USB;
-               cam->input.id.vendor = dev->descriptor.idVendor;
-               cam->input.id.product = dev->descriptor.idProduct;
-               cam->input.id.version = dev->descriptor.bcdDevice;
+               cam->input.id.vendor = le16_to_cpu(dev->descriptor.idVendor);
+               cam->input.id.product = le16_to_cpu(dev->descriptor.idProduct);
+               cam->input.id.version = le16_to_cpu(dev->descriptor.bcdDevice);
                input_register_device(&cam->input);
                
                usb_make_path(dev, cam->input_physname, 56);
@@ -928,23 +923,23 @@ MODULE_DEVICE_TABLE(usb, id_table);
 MODULE_LICENSE("GPL");
 MODULE_AUTHOR("Simon Evans <spse@secret.org.uk>");
 MODULE_DESCRIPTION(DRIVER_DESC);
-MODULE_PARM(speed, "i");
+module_param(speed, int, 0);
 MODULE_PARM_DESC(speed, "Initial speed: 0 (slowest) - 6 (fastest)");
-MODULE_PARM(size, "i");
+module_param(size, int, 0);
 MODULE_PARM_DESC(size, "Initial Size 0: 160x120 1: 160x136 2: 176x144 3: 320x240");
-MODULE_PARM(brightness, "i");
+module_param(brightness, int, 0);
 MODULE_PARM_DESC(brightness, "Initial brightness 0 - 108");
-MODULE_PARM(contrast, "i");
+module_param(contrast, int, 0);
 MODULE_PARM_DESC(contrast, "Initial contrast 0 - 108");
-MODULE_PARM(saturation, "i");
+module_param(saturation, int, 0);
 MODULE_PARM_DESC(saturation, "Initial saturation 0 - 108");
-MODULE_PARM(sharpness, "i");
+module_param(sharpness, int, 0);
 MODULE_PARM_DESC(sharpness, "Initial brightness 0 - 108");
-MODULE_PARM(whitebal, "i");
+module_param(whitebal, int, 0);
 MODULE_PARM_DESC(whitebal, "Initial white balance 0 - 363");
 
 #ifdef CONFIG_USB_DEBUG
-MODULE_PARM(debug, "i");
+module_param(debug, int, S_IRUGO | S_IWUSR);
 MODULE_PARM_DESC(debug, "Debug level: 0-9 (default=0)");
 #endif