summaryrefslogtreecommitdiff
path: root/linux/drivers/media
diff options
context:
space:
mode:
authorJean-Francois Moine <moinejf@free.fr>2008-07-20 09:16:13 +0200
committerJean-Francois Moine <moinejf@free.fr>2008-07-20 09:16:13 +0200
commit4109a3d32f70aceaa0a576b17014ec62c0ad3eef (patch)
tree9d710fcd47a864af5302cb786d1552d422bc0aad /linux/drivers/media
parentd77364d141afb8277b9b66e0b1ea8faa867a4fe1 (diff)
parentc49e3088c034e1fc59f27b9a97ba1e1d3590320a (diff)
downloadmediapointer-dvb-s2-4109a3d32f70aceaa0a576b17014ec62c0ad3eef.tar.gz
mediapointer-dvb-s2-4109a3d32f70aceaa0a576b17014ec62c0ad3eef.tar.bz2
merge: v4l-dvb
Diffstat (limited to 'linux/drivers/media')
-rw-r--r--linux/drivers/media/video/cx25840/cx25840-firmware.c27
-rw-r--r--linux/drivers/media/video/videodev.c4
2 files changed, 15 insertions, 16 deletions
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);
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 <linux/init.h>
#include <linux/kmod.h>
#include <linux/slab.h>
+#include <linux/smp_lock.h>
#include <asm/uaccess.h>
#include <asm/system.h>
@@ -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;
}