From 98bc745f4c1ff3cdd2b9da0595d65056886786cd Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Sat, 19 Jul 2008 23:53:41 -0300 Subject: backport commit 6606470dd1d628878383c96d10b52a77986ddac7 From: Mauro Carvalho Chehab Author: Jonathan Corbet Date: Fri May 16 14:28:31 2008 -0600 videodev: BKL pushdown Put explicit lock_kernel() calls into videodev_open(). That function itself seems OK, but one never knows about all the open() functions provided by underlying video drivers. Signed-off-by: Mauro Carvalho Chehab --- linux/drivers/media/video/videodev.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'linux/drivers/media') diff --git a/linux/drivers/media/video/videodev.c b/linux/drivers/media/video/videodev.c index b32b59afd..48e03618a 100644 --- a/linux/drivers/media/video/videodev.c +++ b/linux/drivers/media/video/videodev.c @@ -40,6 +40,7 @@ #include #include #include +#include #include #include @@ -492,6 +493,7 @@ static int video_open(struct inode *inode, struct file *file) if(minor>=VIDEO_NUM_DEVICES) return -ENODEV; + lock_kernel(); mutex_lock(&videodev_lock); vfl=video_device[minor]; if(vfl==NULL) { @@ -501,6 +503,7 @@ static int video_open(struct inode *inode, struct file *file) vfl=video_device[minor]; if (vfl==NULL) { mutex_unlock(&videodev_lock); + unlock_kernel(); return -ENODEV; } } @@ -518,6 +521,7 @@ static int video_open(struct inode *inode, struct file *file) } fops_put(old_fops); mutex_unlock(&videodev_lock); + unlock_kernel(); return err; } -- cgit v1.2.3 From e073c4802611d884e129fb37edd1ec9ca41ed50c Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Sun, 20 Jul 2008 00:00:30 -0300 Subject: backport commit 9ad46a6ac5422882d9f9a7f0d77ca0766f56bb6e From: Mauro Carvalho Chehab Author: David Woodhouse Date: Fri May 23 23:58:24 2008 +0100 cx25840: treat firmware data as const kernel-sync: Signed-off-by: Mauro Carvalho Chehab --- .../drivers/media/video/cx25840/cx25840-firmware.c | 27 +++++++++------------- 1 file changed, 11 insertions(+), 16 deletions(-) (limited to 'linux/drivers/media') diff --git a/linux/drivers/media/video/cx25840/cx25840-firmware.c b/linux/drivers/media/video/cx25840/cx25840-firmware.c index 95b84ce21..04a5dbb65 100644 --- a/linux/drivers/media/video/cx25840/cx25840-firmware.c +++ b/linux/drivers/media/video/cx25840/cx25840-firmware.c @@ -80,7 +80,7 @@ static int check_fw_load(struct i2c_client *client, int size) return 0; } -static int fw_write(struct i2c_client *client, u8 *data, int size) +static int fw_write(struct i2c_client *client, const u8 *data, int size) { if (i2c_master_send(client, data, size) < size) { v4l_err(client, "firmware load i2c failure\n"); @@ -94,7 +94,8 @@ int cx25840_loadfw(struct i2c_client *client) { struct cx25840_state *state = i2c_get_clientdata(client); const struct firmware *fw = NULL; - u8 buffer[4], *ptr; + u8 buffer[FWSEND]; + const u8 *ptr; int size, retval; if (state->is_cx23885) @@ -109,29 +110,23 @@ int cx25840_loadfw(struct i2c_client *client) buffer[0] = 0x08; buffer[1] = 0x02; - buffer[2] = fw->data[0]; - buffer[3] = fw->data[1]; - retval = fw_write(client, buffer, 4); - if (retval < 0) { - release_firmware(fw); - return retval; - } - - size = fw->size - 2; + size = fw->size; ptr = fw->data; while (size > 0) { - ptr[0] = 0x08; - ptr[1] = 0x02; - retval = fw_write(client, ptr, min(FWSEND, size + 2)); + int len = min(FWSEND - 2, size); + + memcpy(buffer + 2, ptr, len); + + retval = fw_write(client, buffer, len + 2); if (retval < 0) { release_firmware(fw); return retval; } - size -= FWSEND - 2; - ptr += FWSEND - 2; + size -= len; + ptr += len; } end_fw_load(client); -- cgit v1.2.3