diff options
author | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2009-12-10 08:44:04 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2009-12-15 21:17:56 -0500 |
commit | 63b0d5ad20365edf8baf96cdbb8e7faf62501286 (patch) | |
tree | 9a12041cab48051834ee67d0de358443464e5d94 /drivers/staging | |
parent | f0813b4c9f7ffbeaddcba1c08a1812f7ff30e1b7 (diff) |
V4L/DVB (13554a): v4l: Use the video_drvdata function in drivers
Fix all device drivers to use the video_drvdata function instead of
maintaining a local list of minor to private data mappings. Call
video_set_drvdata to register the driver private pointer when not
already done.
Where applicable, the local list of mappings is completely removed when
it becomes unused.
[mchehab.redhat.com: removed tm6000 changes as tm6000 is not ready yet for submission even on staging]
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/staging')
-rw-r--r-- | drivers/staging/cx25821/cx25821-audups11.c | 27 | ||||
-rw-r--r-- | drivers/staging/cx25821/cx25821-video.c | 1 | ||||
-rw-r--r-- | drivers/staging/cx25821/cx25821-video0.c | 27 | ||||
-rw-r--r-- | drivers/staging/cx25821/cx25821-video1.c | 27 | ||||
-rw-r--r-- | drivers/staging/cx25821/cx25821-video2.c | 28 | ||||
-rw-r--r-- | drivers/staging/cx25821/cx25821-video3.c | 28 | ||||
-rw-r--r-- | drivers/staging/cx25821/cx25821-video4.c | 28 | ||||
-rw-r--r-- | drivers/staging/cx25821/cx25821-video5.c | 28 | ||||
-rw-r--r-- | drivers/staging/cx25821/cx25821-video6.c | 28 | ||||
-rw-r--r-- | drivers/staging/cx25821/cx25821-video7.c | 28 | ||||
-rw-r--r-- | drivers/staging/cx25821/cx25821-videoioctl.c | 26 | ||||
-rw-r--r-- | drivers/staging/cx25821/cx25821-vidups10.c | 27 | ||||
-rw-r--r-- | drivers/staging/cx25821/cx25821-vidups9.c | 27 |
13 files changed, 67 insertions, 263 deletions
diff --git a/drivers/staging/cx25821/cx25821-audups11.c b/drivers/staging/cx25821/cx25821-audups11.c index f78b8912d90..e1364d1c976 100644 --- a/drivers/staging/cx25821/cx25821-audups11.c +++ b/drivers/staging/cx25821/cx25821-audups11.c | |||
@@ -95,35 +95,18 @@ static struct videobuf_queue_ops cx25821_video_qops = { | |||
95 | static int video_open(struct file *file) | 95 | static int video_open(struct file *file) |
96 | { | 96 | { |
97 | int minor = video_devdata(file)->minor; | 97 | int minor = video_devdata(file)->minor; |
98 | struct cx25821_dev *h, *dev = NULL; | 98 | struct cx25821_dev *dev = video_drvdata(file); |
99 | struct cx25821_fh *fh; | 99 | struct cx25821_fh *fh; |
100 | struct list_head *list; | 100 | enum v4l2_buf_type type = V4L2_BUF_TYPE_VIDEO_CAPTURE; |
101 | enum v4l2_buf_type type = 0; | ||
102 | |||
103 | lock_kernel(); | ||
104 | list_for_each(list, &cx25821_devlist) { | ||
105 | h = list_entry(list, struct cx25821_dev, devlist); | ||
106 | |||
107 | if (h->video_dev[SRAM_CH11] | ||
108 | && h->video_dev[SRAM_CH11]->minor == minor) { | ||
109 | dev = h; | ||
110 | type = V4L2_BUF_TYPE_VIDEO_CAPTURE; | ||
111 | } | ||
112 | } | ||
113 | |||
114 | if (NULL == dev) { | ||
115 | unlock_kernel(); | ||
116 | return -ENODEV; | ||
117 | } | ||
118 | 101 | ||
119 | printk("open minor=%d type=%s\n", minor, v4l2_type_names[type]); | 102 | printk("open minor=%d type=%s\n", minor, v4l2_type_names[type]); |
120 | 103 | ||
121 | /* allocate + initialize per filehandle data */ | 104 | /* allocate + initialize per filehandle data */ |
122 | fh = kzalloc(sizeof(*fh), GFP_KERNEL); | 105 | fh = kzalloc(sizeof(*fh), GFP_KERNEL); |
123 | if (NULL == fh) { | 106 | if (NULL == fh) |
124 | unlock_kernel(); | ||
125 | return -ENOMEM; | 107 | return -ENOMEM; |
126 | } | 108 | |
109 | lock_kernel(); | ||
127 | 110 | ||
128 | file->private_data = fh; | 111 | file->private_data = fh; |
129 | fh->dev = dev; | 112 | fh->dev = dev; |
diff --git a/drivers/staging/cx25821/cx25821-video.c b/drivers/staging/cx25821/cx25821-video.c index 156e332ce00..c0c99c0fd43 100644 --- a/drivers/staging/cx25821/cx25821-video.c +++ b/drivers/staging/cx25821/cx25821-video.c | |||
@@ -189,6 +189,7 @@ struct video_device *cx25821_vdev_init(struct cx25821_dev *dev, | |||
189 | vfd->release = video_device_release; | 189 | vfd->release = video_device_release; |
190 | snprintf(vfd->name, sizeof(vfd->name), "%s %s (%s)", dev->name, type, | 190 | snprintf(vfd->name, sizeof(vfd->name), "%s %s (%s)", dev->name, type, |
191 | cx25821_boards[dev->board].name); | 191 | cx25821_boards[dev->board].name); |
192 | video_set_drvdata(vfd, dev); | ||
192 | return vfd; | 193 | return vfd; |
193 | } | 194 | } |
194 | 195 | ||
diff --git a/drivers/staging/cx25821/cx25821-video0.c b/drivers/staging/cx25821/cx25821-video0.c index 950fac1d700..eb0fe817551 100644 --- a/drivers/staging/cx25821/cx25821-video0.c +++ b/drivers/staging/cx25821/cx25821-video0.c | |||
@@ -95,36 +95,19 @@ static struct videobuf_queue_ops cx25821_video_qops = { | |||
95 | static int video_open(struct file *file) | 95 | static int video_open(struct file *file) |
96 | { | 96 | { |
97 | int minor = video_devdata(file)->minor; | 97 | int minor = video_devdata(file)->minor; |
98 | struct cx25821_dev *h, *dev = NULL; | 98 | struct cx25821_dev *dev = video_drvdata(file); |
99 | struct cx25821_fh *fh; | 99 | struct cx25821_fh *fh; |
100 | struct list_head *list; | 100 | enum v4l2_buf_type type = V4L2_BUF_TYPE_VIDEO_CAPTURE; |
101 | enum v4l2_buf_type type = 0; | ||
102 | u32 pix_format; | 101 | u32 pix_format; |
103 | 102 | ||
104 | lock_kernel(); | ||
105 | list_for_each(list, &cx25821_devlist) { | ||
106 | h = list_entry(list, struct cx25821_dev, devlist); | ||
107 | |||
108 | if (h->video_dev[SRAM_CH00] | ||
109 | && h->video_dev[SRAM_CH00]->minor == minor) { | ||
110 | dev = h; | ||
111 | type = V4L2_BUF_TYPE_VIDEO_CAPTURE; | ||
112 | } | ||
113 | } | ||
114 | |||
115 | if (NULL == dev) { | ||
116 | unlock_kernel(); | ||
117 | return -ENODEV; | ||
118 | } | ||
119 | |||
120 | printk("open minor=%d type=%s\n", minor, v4l2_type_names[type]); | 103 | printk("open minor=%d type=%s\n", minor, v4l2_type_names[type]); |
121 | 104 | ||
122 | /* allocate + initialize per filehandle data */ | 105 | /* allocate + initialize per filehandle data */ |
123 | fh = kzalloc(sizeof(*fh), GFP_KERNEL); | 106 | fh = kzalloc(sizeof(*fh), GFP_KERNEL); |
124 | if (NULL == fh) { | 107 | if (NULL == fh) |
125 | unlock_kernel(); | ||
126 | return -ENOMEM; | 108 | return -ENOMEM; |
127 | } | 109 | |
110 | lock_kernel(); | ||
128 | 111 | ||
129 | file->private_data = fh; | 112 | file->private_data = fh; |
130 | fh->dev = dev; | 113 | fh->dev = dev; |
diff --git a/drivers/staging/cx25821/cx25821-video1.c b/drivers/staging/cx25821/cx25821-video1.c index a4dddc684ad..96ec2385bcd 100644 --- a/drivers/staging/cx25821/cx25821-video1.c +++ b/drivers/staging/cx25821/cx25821-video1.c | |||
@@ -95,36 +95,19 @@ static struct videobuf_queue_ops cx25821_video_qops = { | |||
95 | static int video_open(struct file *file) | 95 | static int video_open(struct file *file) |
96 | { | 96 | { |
97 | int minor = video_devdata(file)->minor; | 97 | int minor = video_devdata(file)->minor; |
98 | struct cx25821_dev *h, *dev = NULL; | 98 | struct cx25821_dev *dev = video_drvdata(file); |
99 | struct cx25821_fh *fh; | 99 | struct cx25821_fh *fh; |
100 | struct list_head *list; | 100 | enum v4l2_buf_type type = V4L2_BUF_TYPE_VIDEO_CAPTURE; |
101 | enum v4l2_buf_type type = 0; | ||
102 | u32 pix_format; | 101 | u32 pix_format; |
103 | 102 | ||
104 | lock_kernel(); | ||
105 | list_for_each(list, &cx25821_devlist) { | ||
106 | h = list_entry(list, struct cx25821_dev, devlist); | ||
107 | |||
108 | if (h->video_dev[SRAM_CH01] | ||
109 | && h->video_dev[SRAM_CH01]->minor == minor) { | ||
110 | dev = h; | ||
111 | type = V4L2_BUF_TYPE_VIDEO_CAPTURE; | ||
112 | } | ||
113 | } | ||
114 | |||
115 | if (NULL == dev) { | ||
116 | unlock_kernel(); | ||
117 | return -ENODEV; | ||
118 | } | ||
119 | |||
120 | printk("open minor=%d type=%s\n", minor, v4l2_type_names[type]); | 103 | printk("open minor=%d type=%s\n", minor, v4l2_type_names[type]); |
121 | 104 | ||
122 | /* allocate + initialize per filehandle data */ | 105 | /* allocate + initialize per filehandle data */ |
123 | fh = kzalloc(sizeof(*fh), GFP_KERNEL); | 106 | fh = kzalloc(sizeof(*fh), GFP_KERNEL); |
124 | if (NULL == fh) { | 107 | if (NULL == fh) |
125 | unlock_kernel(); | ||
126 | return -ENOMEM; | 108 | return -ENOMEM; |
127 | } | 109 | |
110 | lock_kernel(); | ||
128 | 111 | ||
129 | file->private_data = fh; | 112 | file->private_data = fh; |
130 | fh->dev = dev; | 113 | fh->dev = dev; |
diff --git a/drivers/staging/cx25821/cx25821-video2.c b/drivers/staging/cx25821/cx25821-video2.c index 8e04e253f5d..e659603c3fb 100644 --- a/drivers/staging/cx25821/cx25821-video2.c +++ b/drivers/staging/cx25821/cx25821-video2.c | |||
@@ -95,36 +95,20 @@ static struct videobuf_queue_ops cx25821_video_qops = { | |||
95 | static int video_open(struct file *file) | 95 | static int video_open(struct file *file) |
96 | { | 96 | { |
97 | int minor = video_devdata(file)->minor; | 97 | int minor = video_devdata(file)->minor; |
98 | struct cx25821_dev *h, *dev = NULL; | 98 | struct cx25821_dev *dev = video_drvdata(file); |
99 | struct cx25821_fh *fh; | 99 | struct cx25821_fh *fh; |
100 | struct list_head *list; | 100 | enum v4l2_buf_type type = V4L2_BUF_TYPE_VIDEO_CAPTURE; |
101 | enum v4l2_buf_type type = 0; | ||
102 | u32 pix_format; | 101 | u32 pix_format; |
103 | 102 | ||
104 | lock_kernel(); | ||
105 | list_for_each(list, &cx25821_devlist) { | ||
106 | h = list_entry(list, struct cx25821_dev, devlist); | ||
107 | |||
108 | if (h->video_dev[SRAM_CH02] | ||
109 | && h->video_dev[SRAM_CH02]->minor == minor) { | ||
110 | dev = h; | ||
111 | type = V4L2_BUF_TYPE_VIDEO_CAPTURE; | ||
112 | } | ||
113 | } | ||
114 | |||
115 | if (NULL == dev) { | ||
116 | unlock_kernel(); | ||
117 | return -ENODEV; | ||
118 | } | ||
119 | |||
120 | printk("open minor=%d type=%s\n", minor, v4l2_type_names[type]); | 103 | printk("open minor=%d type=%s\n", minor, v4l2_type_names[type]); |
121 | 104 | ||
122 | /* allocate + initialize per filehandle data */ | 105 | /* allocate + initialize per filehandle data */ |
123 | fh = kzalloc(sizeof(*fh), GFP_KERNEL); | 106 | fh = kzalloc(sizeof(*fh), GFP_KERNEL); |
124 | if (NULL == fh) { | 107 | if (NULL == fh) |
125 | unlock_kernel(); | ||
126 | return -ENOMEM; | 108 | return -ENOMEM; |
127 | } | 109 | |
110 | lock_kernel(); | ||
111 | |||
128 | file->private_data = fh; | 112 | file->private_data = fh; |
129 | fh->dev = dev; | 113 | fh->dev = dev; |
130 | fh->type = type; | 114 | fh->type = type; |
diff --git a/drivers/staging/cx25821/cx25821-video3.c b/drivers/staging/cx25821/cx25821-video3.c index 8801a8ead90..873f0f83a89 100644 --- a/drivers/staging/cx25821/cx25821-video3.c +++ b/drivers/staging/cx25821/cx25821-video3.c | |||
@@ -95,36 +95,20 @@ static struct videobuf_queue_ops cx25821_video_qops = { | |||
95 | static int video_open(struct file *file) | 95 | static int video_open(struct file *file) |
96 | { | 96 | { |
97 | int minor = video_devdata(file)->minor; | 97 | int minor = video_devdata(file)->minor; |
98 | struct cx25821_dev *h, *dev = NULL; | 98 | struct cx25821_dev *dev = video_drvdata(file); |
99 | struct cx25821_fh *fh; | 99 | struct cx25821_fh *fh; |
100 | struct list_head *list; | 100 | enum v4l2_buf_type type = V4L2_BUF_TYPE_VIDEO_CAPTURE; |
101 | enum v4l2_buf_type type = 0; | ||
102 | u32 pix_format; | 101 | u32 pix_format; |
103 | 102 | ||
104 | lock_kernel(); | ||
105 | list_for_each(list, &cx25821_devlist) { | ||
106 | h = list_entry(list, struct cx25821_dev, devlist); | ||
107 | |||
108 | if (h->video_dev[SRAM_CH03] | ||
109 | && h->video_dev[SRAM_CH03]->minor == minor) { | ||
110 | dev = h; | ||
111 | type = V4L2_BUF_TYPE_VIDEO_CAPTURE; | ||
112 | } | ||
113 | } | ||
114 | |||
115 | if (NULL == dev) { | ||
116 | unlock_kernel(); | ||
117 | return -ENODEV; | ||
118 | } | ||
119 | |||
120 | printk("open minor=%d type=%s\n", minor, v4l2_type_names[type]); | 103 | printk("open minor=%d type=%s\n", minor, v4l2_type_names[type]); |
121 | 104 | ||
122 | /* allocate + initialize per filehandle data */ | 105 | /* allocate + initialize per filehandle data */ |
123 | fh = kzalloc(sizeof(*fh), GFP_KERNEL); | 106 | fh = kzalloc(sizeof(*fh), GFP_KERNEL); |
124 | if (NULL == fh) { | 107 | if (NULL == fh) |
125 | unlock_kernel(); | ||
126 | return -ENOMEM; | 108 | return -ENOMEM; |
127 | } | 109 | |
110 | lock_kernel(); | ||
111 | |||
128 | file->private_data = fh; | 112 | file->private_data = fh; |
129 | fh->dev = dev; | 113 | fh->dev = dev; |
130 | fh->type = type; | 114 | fh->type = type; |
diff --git a/drivers/staging/cx25821/cx25821-video4.c b/drivers/staging/cx25821/cx25821-video4.c index ab0d747138a..c00e3f84e8e 100644 --- a/drivers/staging/cx25821/cx25821-video4.c +++ b/drivers/staging/cx25821/cx25821-video4.c | |||
@@ -95,36 +95,20 @@ static struct videobuf_queue_ops cx25821_video_qops = { | |||
95 | static int video_open(struct file *file) | 95 | static int video_open(struct file *file) |
96 | { | 96 | { |
97 | int minor = video_devdata(file)->minor; | 97 | int minor = video_devdata(file)->minor; |
98 | struct cx25821_dev *h, *dev = NULL; | 98 | struct cx25821_dev *dev = video_drvdata(file); |
99 | struct cx25821_fh *fh; | 99 | struct cx25821_fh *fh; |
100 | struct list_head *list; | 100 | enum v4l2_buf_type type = V4L2_BUF_TYPE_VIDEO_CAPTURE; |
101 | enum v4l2_buf_type type = 0; | ||
102 | u32 pix_format; | 101 | u32 pix_format; |
103 | 102 | ||
104 | lock_kernel(); | ||
105 | list_for_each(list, &cx25821_devlist) { | ||
106 | h = list_entry(list, struct cx25821_dev, devlist); | ||
107 | |||
108 | if (h->video_dev[SRAM_CH04] | ||
109 | && h->video_dev[SRAM_CH04]->minor == minor) { | ||
110 | dev = h; | ||
111 | type = V4L2_BUF_TYPE_VIDEO_CAPTURE; | ||
112 | } | ||
113 | } | ||
114 | |||
115 | if (NULL == dev) { | ||
116 | unlock_kernel(); | ||
117 | return -ENODEV; | ||
118 | } | ||
119 | |||
120 | printk("open minor=%d type=%s\n", minor, v4l2_type_names[type]); | 103 | printk("open minor=%d type=%s\n", minor, v4l2_type_names[type]); |
121 | 104 | ||
122 | /* allocate + initialize per filehandle data */ | 105 | /* allocate + initialize per filehandle data */ |
123 | fh = kzalloc(sizeof(*fh), GFP_KERNEL); | 106 | fh = kzalloc(sizeof(*fh), GFP_KERNEL); |
124 | if (NULL == fh) { | 107 | if (NULL == fh) |
125 | unlock_kernel(); | ||
126 | return -ENOMEM; | 108 | return -ENOMEM; |
127 | } | 109 | |
110 | lock_kernel(); | ||
111 | |||
128 | file->private_data = fh; | 112 | file->private_data = fh; |
129 | fh->dev = dev; | 113 | fh->dev = dev; |
130 | fh->type = type; | 114 | fh->type = type; |
diff --git a/drivers/staging/cx25821/cx25821-video5.c b/drivers/staging/cx25821/cx25821-video5.c index 7ef0b971f5c..06396b86e98 100644 --- a/drivers/staging/cx25821/cx25821-video5.c +++ b/drivers/staging/cx25821/cx25821-video5.c | |||
@@ -95,36 +95,20 @@ static struct videobuf_queue_ops cx25821_video_qops = { | |||
95 | static int video_open(struct file *file) | 95 | static int video_open(struct file *file) |
96 | { | 96 | { |
97 | int minor = video_devdata(file)->minor; | 97 | int minor = video_devdata(file)->minor; |
98 | struct cx25821_dev *h, *dev = NULL; | 98 | struct cx25821_dev *dev = video_drvdata(file); |
99 | struct cx25821_fh *fh; | 99 | struct cx25821_fh *fh; |
100 | struct list_head *list; | 100 | enum v4l2_buf_type type = V4L2_BUF_TYPE_VIDEO_CAPTURE; |
101 | enum v4l2_buf_type type = 0; | ||
102 | u32 pix_format; | 101 | u32 pix_format; |
103 | 102 | ||
104 | lock_kernel(); | ||
105 | list_for_each(list, &cx25821_devlist) { | ||
106 | h = list_entry(list, struct cx25821_dev, devlist); | ||
107 | |||
108 | if (h->video_dev[SRAM_CH05] | ||
109 | && h->video_dev[SRAM_CH05]->minor == minor) { | ||
110 | dev = h; | ||
111 | type = V4L2_BUF_TYPE_VIDEO_CAPTURE; | ||
112 | } | ||
113 | } | ||
114 | |||
115 | if (NULL == dev) { | ||
116 | unlock_kernel(); | ||
117 | return -ENODEV; | ||
118 | } | ||
119 | |||
120 | printk("open minor=%d type=%s\n", minor, v4l2_type_names[type]); | 103 | printk("open minor=%d type=%s\n", minor, v4l2_type_names[type]); |
121 | 104 | ||
122 | /* allocate + initialize per filehandle data */ | 105 | /* allocate + initialize per filehandle data */ |
123 | fh = kzalloc(sizeof(*fh), GFP_KERNEL); | 106 | fh = kzalloc(sizeof(*fh), GFP_KERNEL); |
124 | if (NULL == fh) { | 107 | if (NULL == fh) |
125 | unlock_kernel(); | ||
126 | return -ENOMEM; | 108 | return -ENOMEM; |
127 | } | 109 | |
110 | lock_kernel(); | ||
111 | |||
128 | file->private_data = fh; | 112 | file->private_data = fh; |
129 | fh->dev = dev; | 113 | fh->dev = dev; |
130 | fh->type = type; | 114 | fh->type = type; |
diff --git a/drivers/staging/cx25821/cx25821-video6.c b/drivers/staging/cx25821/cx25821-video6.c index 3c41b49e2ea..c5410c1558e 100644 --- a/drivers/staging/cx25821/cx25821-video6.c +++ b/drivers/staging/cx25821/cx25821-video6.c | |||
@@ -95,36 +95,20 @@ static struct videobuf_queue_ops cx25821_video_qops = { | |||
95 | static int video_open(struct file *file) | 95 | static int video_open(struct file *file) |
96 | { | 96 | { |
97 | int minor = video_devdata(file)->minor; | 97 | int minor = video_devdata(file)->minor; |
98 | struct cx25821_dev *h, *dev = NULL; | 98 | struct cx25821_dev *dev = video_drvdata(file); |
99 | struct cx25821_fh *fh; | 99 | struct cx25821_fh *fh; |
100 | struct list_head *list; | 100 | enum v4l2_buf_type type = V4L2_BUF_TYPE_VIDEO_CAPTURE; |
101 | enum v4l2_buf_type type = 0; | ||
102 | u32 pix_format; | 101 | u32 pix_format; |
103 | 102 | ||
104 | lock_kernel(); | ||
105 | list_for_each(list, &cx25821_devlist) { | ||
106 | h = list_entry(list, struct cx25821_dev, devlist); | ||
107 | |||
108 | if (h->video_dev[SRAM_CH06] | ||
109 | && h->video_dev[SRAM_CH06]->minor == minor) { | ||
110 | dev = h; | ||
111 | type = V4L2_BUF_TYPE_VIDEO_CAPTURE; | ||
112 | } | ||
113 | } | ||
114 | |||
115 | if (NULL == dev) { | ||
116 | unlock_kernel(); | ||
117 | return -ENODEV; | ||
118 | } | ||
119 | |||
120 | printk("open minor=%d type=%s\n", minor, v4l2_type_names[type]); | 103 | printk("open minor=%d type=%s\n", minor, v4l2_type_names[type]); |
121 | 104 | ||
122 | /* allocate + initialize per filehandle data */ | 105 | /* allocate + initialize per filehandle data */ |
123 | fh = kzalloc(sizeof(*fh), GFP_KERNEL); | 106 | fh = kzalloc(sizeof(*fh), GFP_KERNEL); |
124 | if (NULL == fh) { | 107 | if (NULL == fh) |
125 | unlock_kernel(); | ||
126 | return -ENOMEM; | 108 | return -ENOMEM; |
127 | } | 109 | |
110 | lock_kernel(); | ||
111 | |||
128 | file->private_data = fh; | 112 | file->private_data = fh; |
129 | fh->dev = dev; | 113 | fh->dev = dev; |
130 | fh->type = type; | 114 | fh->type = type; |
diff --git a/drivers/staging/cx25821/cx25821-video7.c b/drivers/staging/cx25821/cx25821-video7.c index 625c9b78a9c..274977eefca 100644 --- a/drivers/staging/cx25821/cx25821-video7.c +++ b/drivers/staging/cx25821/cx25821-video7.c | |||
@@ -94,36 +94,20 @@ static struct videobuf_queue_ops cx25821_video_qops = { | |||
94 | static int video_open(struct file *file) | 94 | static int video_open(struct file *file) |
95 | { | 95 | { |
96 | int minor = video_devdata(file)->minor; | 96 | int minor = video_devdata(file)->minor; |
97 | struct cx25821_dev *h, *dev = NULL; | 97 | struct cx25821_dev *dev = video_drvdata(file); |
98 | struct cx25821_fh *fh; | 98 | struct cx25821_fh *fh; |
99 | struct list_head *list; | 99 | enum v4l2_buf_type type = V4L2_BUF_TYPE_VIDEO_CAPTURE; |
100 | enum v4l2_buf_type type = 0; | ||
101 | u32 pix_format; | 100 | u32 pix_format; |
102 | 101 | ||
103 | lock_kernel(); | ||
104 | list_for_each(list, &cx25821_devlist) { | ||
105 | h = list_entry(list, struct cx25821_dev, devlist); | ||
106 | |||
107 | if (h->video_dev[SRAM_CH07] | ||
108 | && h->video_dev[SRAM_CH07]->minor == minor) { | ||
109 | dev = h; | ||
110 | type = V4L2_BUF_TYPE_VIDEO_CAPTURE; | ||
111 | } | ||
112 | } | ||
113 | |||
114 | if (NULL == dev) { | ||
115 | unlock_kernel(); | ||
116 | return -ENODEV; | ||
117 | } | ||
118 | |||
119 | printk("open minor=%d type=%s\n", minor, v4l2_type_names[type]); | 102 | printk("open minor=%d type=%s\n", minor, v4l2_type_names[type]); |
120 | 103 | ||
121 | /* allocate + initialize per filehandle data */ | 104 | /* allocate + initialize per filehandle data */ |
122 | fh = kzalloc(sizeof(*fh), GFP_KERNEL); | 105 | fh = kzalloc(sizeof(*fh), GFP_KERNEL); |
123 | if (NULL == fh) { | 106 | if (NULL == fh) |
124 | unlock_kernel(); | ||
125 | return -ENOMEM; | 107 | return -ENOMEM; |
126 | } | 108 | |
109 | lock_kernel(); | ||
110 | |||
127 | file->private_data = fh; | 111 | file->private_data = fh; |
128 | fh->dev = dev; | 112 | fh->dev = dev; |
129 | fh->type = type; | 113 | fh->type = type; |
diff --git a/drivers/staging/cx25821/cx25821-videoioctl.c b/drivers/staging/cx25821/cx25821-videoioctl.c index 2a312ce78c6..42ea8bfa9ed 100644 --- a/drivers/staging/cx25821/cx25821-videoioctl.c +++ b/drivers/staging/cx25821/cx25821-videoioctl.c | |||
@@ -95,35 +95,19 @@ static struct videobuf_queue_ops cx25821_video_qops = { | |||
95 | static int video_open(struct file *file) | 95 | static int video_open(struct file *file) |
96 | { | 96 | { |
97 | int minor = video_devdata(file)->minor; | 97 | int minor = video_devdata(file)->minor; |
98 | struct cx25821_dev *h, *dev = NULL; | 98 | struct cx25821_dev *dev = video_drvdata(file); |
99 | struct cx25821_fh *fh; | 99 | struct cx25821_fh *fh; |
100 | struct list_head *list; | 100 | enum v4l2_buf_type type = V4L2_BUF_TYPE_VIDEO_CAPTURE; |
101 | enum v4l2_buf_type type = 0; | ||
102 | u32 pix_format; | 101 | u32 pix_format; |
103 | 102 | ||
104 | lock_kernel(); | ||
105 | list_for_each(list, &cx25821_devlist) { | ||
106 | h = list_entry(list, struct cx25821_dev, devlist); | ||
107 | |||
108 | if (h->ioctl_dev && h->ioctl_dev->minor == minor) { | ||
109 | dev = h; | ||
110 | type = V4L2_BUF_TYPE_VIDEO_CAPTURE; | ||
111 | } | ||
112 | } | ||
113 | |||
114 | if (NULL == dev) { | ||
115 | unlock_kernel(); | ||
116 | return -ENODEV; | ||
117 | } | ||
118 | |||
119 | printk("open minor=%d type=%s\n", minor, v4l2_type_names[type]); | 103 | printk("open minor=%d type=%s\n", minor, v4l2_type_names[type]); |
120 | 104 | ||
121 | /* allocate + initialize per filehandle data */ | 105 | /* allocate + initialize per filehandle data */ |
122 | fh = kzalloc(sizeof(*fh), GFP_KERNEL); | 106 | fh = kzalloc(sizeof(*fh), GFP_KERNEL); |
123 | if (NULL == fh) { | 107 | if (NULL == fh) |
124 | unlock_kernel(); | ||
125 | return -ENOMEM; | 108 | return -ENOMEM; |
126 | } | 109 | |
110 | lock_kernel(); | ||
127 | 111 | ||
128 | file->private_data = fh; | 112 | file->private_data = fh; |
129 | fh->dev = dev; | 113 | fh->dev = dev; |
diff --git a/drivers/staging/cx25821/cx25821-vidups10.c b/drivers/staging/cx25821/cx25821-vidups10.c index 77b63b06040..4e0033fa205 100644 --- a/drivers/staging/cx25821/cx25821-vidups10.c +++ b/drivers/staging/cx25821/cx25821-vidups10.c | |||
@@ -95,35 +95,18 @@ static struct videobuf_queue_ops cx25821_video_qops = { | |||
95 | static int video_open(struct file *file) | 95 | static int video_open(struct file *file) |
96 | { | 96 | { |
97 | int minor = video_devdata(file)->minor; | 97 | int minor = video_devdata(file)->minor; |
98 | struct cx25821_dev *h, *dev = NULL; | 98 | struct cx25821_dev *dev = video_drvdata(file); |
99 | struct cx25821_fh *fh; | 99 | struct cx25821_fh *fh; |
100 | struct list_head *list; | 100 | enum v4l2_buf_type type = V4L2_BUF_TYPE_VIDEO_CAPTURE; |
101 | enum v4l2_buf_type type = 0; | ||
102 | |||
103 | lock_kernel(); | ||
104 | list_for_each(list, &cx25821_devlist) { | ||
105 | h = list_entry(list, struct cx25821_dev, devlist); | ||
106 | |||
107 | if (h->video_dev[SRAM_CH10] | ||
108 | && h->video_dev[SRAM_CH10]->minor == minor) { | ||
109 | dev = h; | ||
110 | type = V4L2_BUF_TYPE_VIDEO_CAPTURE; | ||
111 | } | ||
112 | } | ||
113 | |||
114 | if (NULL == dev) { | ||
115 | unlock_kernel(); | ||
116 | return -ENODEV; | ||
117 | } | ||
118 | 101 | ||
119 | printk("open minor=%d type=%s\n", minor, v4l2_type_names[type]); | 102 | printk("open minor=%d type=%s\n", minor, v4l2_type_names[type]); |
120 | 103 | ||
121 | /* allocate + initialize per filehandle data */ | 104 | /* allocate + initialize per filehandle data */ |
122 | fh = kzalloc(sizeof(*fh), GFP_KERNEL); | 105 | fh = kzalloc(sizeof(*fh), GFP_KERNEL); |
123 | if (NULL == fh) { | 106 | if (NULL == fh) |
124 | unlock_kernel(); | ||
125 | return -ENOMEM; | 107 | return -ENOMEM; |
126 | } | 108 | |
109 | lock_kernel(); | ||
127 | 110 | ||
128 | file->private_data = fh; | 111 | file->private_data = fh; |
129 | fh->dev = dev; | 112 | fh->dev = dev; |
diff --git a/drivers/staging/cx25821/cx25821-vidups9.c b/drivers/staging/cx25821/cx25821-vidups9.c index 75c8c1eed2d..67fc082e308 100644 --- a/drivers/staging/cx25821/cx25821-vidups9.c +++ b/drivers/staging/cx25821/cx25821-vidups9.c | |||
@@ -95,35 +95,18 @@ static struct videobuf_queue_ops cx25821_video_qops = { | |||
95 | static int video_open(struct file *file) | 95 | static int video_open(struct file *file) |
96 | { | 96 | { |
97 | int minor = video_devdata(file)->minor; | 97 | int minor = video_devdata(file)->minor; |
98 | struct cx25821_dev *h, *dev = NULL; | 98 | struct cx25821_dev *dev = video_drvdata(file); |
99 | struct cx25821_fh *fh; | 99 | struct cx25821_fh *fh; |
100 | struct list_head *list; | 100 | enum v4l2_buf_type type = V4L2_BUF_TYPE_VIDEO_CAPTURE; |
101 | enum v4l2_buf_type type = 0; | ||
102 | |||
103 | lock_kernel(); | ||
104 | list_for_each(list, &cx25821_devlist) { | ||
105 | h = list_entry(list, struct cx25821_dev, devlist); | ||
106 | |||
107 | if (h->video_dev[SRAM_CH09] | ||
108 | && h->video_dev[SRAM_CH09]->minor == minor) { | ||
109 | dev = h; | ||
110 | type = V4L2_BUF_TYPE_VIDEO_CAPTURE; | ||
111 | } | ||
112 | } | ||
113 | |||
114 | if (NULL == dev) { | ||
115 | unlock_kernel(); | ||
116 | return -ENODEV; | ||
117 | } | ||
118 | 101 | ||
119 | printk("open minor=%d type=%s\n", minor, v4l2_type_names[type]); | 102 | printk("open minor=%d type=%s\n", minor, v4l2_type_names[type]); |
120 | 103 | ||
121 | /* allocate + initialize per filehandle data */ | 104 | /* allocate + initialize per filehandle data */ |
122 | fh = kzalloc(sizeof(*fh), GFP_KERNEL); | 105 | fh = kzalloc(sizeof(*fh), GFP_KERNEL); |
123 | if (NULL == fh) { | 106 | if (NULL == fh) |
124 | unlock_kernel(); | ||
125 | return -ENOMEM; | 107 | return -ENOMEM; |
126 | } | 108 | |
109 | lock_kernel(); | ||
127 | 110 | ||
128 | file->private_data = fh; | 111 | file->private_data = fh; |
129 | fh->dev = dev; | 112 | fh->dev = dev; |