camera uvc: urb buffer address must align to 4-bytes, for support white balance
authorddl <ddl@rock-chips.com>
Tue, 4 Jun 2013 04:02:07 +0000 (12:02 +0800)
committerddl <ddl@rock-chips.com>
Tue, 4 Jun 2013 07:29:10 +0000 (15:29 +0800)
drivers/media/video/uvc/uvc_ctrl.c [changed mode: 0644->0755]

old mode 100644 (file)
new mode 100755 (executable)
index a4db26f..7f49a2f
@@ -675,7 +675,11 @@ static struct uvc_control_mapping uvc_ctrl_mappings[] = {
 
 static inline __u8 *uvc_ctrl_data(struct uvc_control *ctrl, int id)
 {
+    #if 0       /* ddl@rock-chips.com: address must align to 4-bytes */
        return ctrl->uvc_data + id * ctrl->info.size;
+    #else
+    return ctrl->uvc_data + id * ((ctrl->info.size+3)/4*4);
+    #endif
 }
 
 static inline int uvc_test_bit(const __u8 *data, int bit)
@@ -1590,8 +1594,13 @@ static int uvc_ctrl_add_info(struct uvc_device *dev, struct uvc_control *ctrl,
        INIT_LIST_HEAD(&ctrl->info.mappings);
 
        /* Allocate an array to save control values (cur, def, max, etc.) */
+    #if 0           /* ddl@rock-chips.com: address must align to 4-bytes */
        ctrl->uvc_data = kzalloc(ctrl->info.size * UVC_CTRL_DATA_LAST + 1,
                                 GFP_KERNEL);
+    #else
+    ctrl->uvc_data = kzalloc(((ctrl->info.size+3)/4*4) * UVC_CTRL_DATA_LAST + 1,
+                                GFP_KERNEL);
+    #endif
        if (ctrl->uvc_data == NULL) {
                ret = -ENOMEM;
                goto done;