From: ddl Date: Tue, 4 Jun 2013 04:02:07 +0000 (+0800) Subject: camera uvc: urb buffer address must align to 4-bytes, for support white balance X-Git-Tag: firefly_0821_release~7008 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=6681fec79b8d581f7813c01e2f5e095b577455a2;p=firefly-linux-kernel-4.4.55.git camera uvc: urb buffer address must align to 4-bytes, for support white balance --- diff --git a/drivers/media/video/uvc/uvc_ctrl.c b/drivers/media/video/uvc/uvc_ctrl.c old mode 100644 new mode 100755 index a4db26fa2f53..7f49a2fc95e4 --- a/drivers/media/video/uvc/uvc_ctrl.c +++ b/drivers/media/video/uvc/uvc_ctrl.c @@ -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;