aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/media/common/saa7146_fops.c2
-rw-r--r--drivers/media/radio/radio-aimslab.c12
-rw-r--r--drivers/media/radio/radio-aztech.c12
-rw-r--r--drivers/media/radio/radio-gemtek-pci.c12
-rw-r--r--drivers/media/radio/radio-gemtek.c10
-rw-r--r--drivers/media/radio/radio-maxiradio.c12
-rw-r--r--drivers/media/radio/radio-rtrack2.c12
-rw-r--r--drivers/media/radio/radio-sf16fmi.c12
-rw-r--r--drivers/media/radio/radio-sf16fmr2.c12
-rw-r--r--drivers/media/radio/radio-terratec.c12
-rw-r--r--drivers/media/radio/radio-typhoon.c10
-rw-r--r--drivers/media/radio/radio-zoltrix.c12
-rw-r--r--drivers/media/video/arv.c10
-rw-r--r--drivers/media/video/cpia.c12
-rw-r--r--drivers/media/video/pwc/pwc-if.c12
-rw-r--r--drivers/media/video/pwc/pwc-v4l.c2
-rw-r--r--drivers/media/video/s2255drv.c2
-rw-r--r--drivers/media/video/saa5246a.c13
-rw-r--r--drivers/media/video/saa5249.c12
-rw-r--r--drivers/media/video/stk-webcam.c4
-rw-r--r--drivers/media/video/usbvideo/vicam.c9
-rw-r--r--drivers/media/video/w9966.c10
-rw-r--r--include/media/v4l2-dev.h14
23 files changed, 111 insertions, 119 deletions
diff --git a/drivers/media/common/saa7146_fops.c b/drivers/media/common/saa7146_fops.c
index cf6a817d5059..5b34c134aa25 100644
--- a/drivers/media/common/saa7146_fops.c
+++ b/drivers/media/common/saa7146_fops.c
@@ -533,7 +533,7 @@ int saa7146_register_device(struct video_device **vid, struct saa7146_dev* dev,
533 memcpy(vfd, &device_template, sizeof(struct video_device)); 533 memcpy(vfd, &device_template, sizeof(struct video_device));
534 strlcpy(vfd->name, name, sizeof(vfd->name)); 534 strlcpy(vfd->name, name, sizeof(vfd->name));
535 vfd->release = video_device_release; 535 vfd->release = video_device_release;
536 vfd->priv = dev; 536 video_set_drvdata(vfd, dev);
537 537
538 // fixme: -1 should be an insmod parameter *for the extension* (like "video_nr"); 538 // fixme: -1 should be an insmod parameter *for the extension* (like "video_nr");
539 if (video_register_device(vfd, type, -1) < 0) { 539 if (video_register_device(vfd, type, -1) < 0) {
diff --git a/drivers/media/radio/radio-aimslab.c b/drivers/media/radio/radio-aimslab.c
index 59fdaf85e41b..62cc6874d63f 100644
--- a/drivers/media/radio/radio-aimslab.c
+++ b/drivers/media/radio/radio-aimslab.c
@@ -247,7 +247,7 @@ static int vidioc_g_tuner(struct file *file, void *priv,
247 struct v4l2_tuner *v) 247 struct v4l2_tuner *v)
248{ 248{
249 struct video_device *dev = video_devdata(file); 249 struct video_device *dev = video_devdata(file);
250 struct rt_device *rt = dev->priv; 250 struct rt_device *rt = video_get_drvdata(dev);
251 251
252 if (v->index > 0) 252 if (v->index > 0)
253 return -EINVAL; 253 return -EINVAL;
@@ -275,7 +275,7 @@ static int vidioc_s_frequency(struct file *file, void *priv,
275 struct v4l2_frequency *f) 275 struct v4l2_frequency *f)
276{ 276{
277 struct video_device *dev = video_devdata(file); 277 struct video_device *dev = video_devdata(file);
278 struct rt_device *rt = dev->priv; 278 struct rt_device *rt = video_get_drvdata(dev);
279 279
280 rt->curfreq = f->frequency; 280 rt->curfreq = f->frequency;
281 rt_setfreq(rt, rt->curfreq); 281 rt_setfreq(rt, rt->curfreq);
@@ -286,7 +286,7 @@ static int vidioc_g_frequency(struct file *file, void *priv,
286 struct v4l2_frequency *f) 286 struct v4l2_frequency *f)
287{ 287{
288 struct video_device *dev = video_devdata(file); 288 struct video_device *dev = video_devdata(file);
289 struct rt_device *rt = dev->priv; 289 struct rt_device *rt = video_get_drvdata(dev);
290 290
291 f->type = V4L2_TUNER_RADIO; 291 f->type = V4L2_TUNER_RADIO;
292 f->frequency = rt->curfreq; 292 f->frequency = rt->curfreq;
@@ -312,7 +312,7 @@ static int vidioc_g_ctrl(struct file *file, void *priv,
312 struct v4l2_control *ctrl) 312 struct v4l2_control *ctrl)
313{ 313{
314 struct video_device *dev = video_devdata(file); 314 struct video_device *dev = video_devdata(file);
315 struct rt_device *rt = dev->priv; 315 struct rt_device *rt = video_get_drvdata(dev);
316 316
317 switch (ctrl->id) { 317 switch (ctrl->id) {
318 case V4L2_CID_AUDIO_MUTE: 318 case V4L2_CID_AUDIO_MUTE:
@@ -329,7 +329,7 @@ static int vidioc_s_ctrl(struct file *file, void *priv,
329 struct v4l2_control *ctrl) 329 struct v4l2_control *ctrl)
330{ 330{
331 struct video_device *dev = video_devdata(file); 331 struct video_device *dev = video_devdata(file);
332 struct rt_device *rt = dev->priv; 332 struct rt_device *rt = video_get_drvdata(dev);
333 333
334 switch (ctrl->id) { 334 switch (ctrl->id) {
335 case V4L2_CID_AUDIO_MUTE: 335 case V4L2_CID_AUDIO_MUTE:
@@ -437,7 +437,7 @@ static int __init rtrack_init(void)
437 return -EBUSY; 437 return -EBUSY;
438 } 438 }
439 439
440 rtrack_radio.priv=&rtrack_unit; 440 video_set_drvdata(&rtrack_radio, &rtrack_unit);
441 441
442 if (video_register_device(&rtrack_radio, VFL_TYPE_RADIO, radio_nr) < 0) { 442 if (video_register_device(&rtrack_radio, VFL_TYPE_RADIO, radio_nr) < 0) {
443 release_region(io, 2); 443 release_region(io, 2);
diff --git a/drivers/media/radio/radio-aztech.c b/drivers/media/radio/radio-aztech.c
index ddd96295a9fe..5dd5e349ef47 100644
--- a/drivers/media/radio/radio-aztech.c
+++ b/drivers/media/radio/radio-aztech.c
@@ -197,7 +197,7 @@ static int vidioc_g_tuner (struct file *file, void *priv,
197 struct v4l2_tuner *v) 197 struct v4l2_tuner *v)
198{ 198{
199 struct video_device *dev = video_devdata(file); 199 struct video_device *dev = video_devdata(file);
200 struct az_device *az = dev->priv; 200 struct az_device *az = video_get_drvdata(dev);
201 201
202 if (v->index > 0) 202 if (v->index > 0)
203 return -EINVAL; 203 return -EINVAL;
@@ -266,7 +266,7 @@ static int vidioc_s_frequency (struct file *file, void *priv,
266 struct v4l2_frequency *f) 266 struct v4l2_frequency *f)
267{ 267{
268 struct video_device *dev = video_devdata(file); 268 struct video_device *dev = video_devdata(file);
269 struct az_device *az = dev->priv; 269 struct az_device *az = video_get_drvdata(dev);
270 270
271 az->curfreq = f->frequency; 271 az->curfreq = f->frequency;
272 az_setfreq(az, az->curfreq); 272 az_setfreq(az, az->curfreq);
@@ -277,7 +277,7 @@ static int vidioc_g_frequency (struct file *file, void *priv,
277 struct v4l2_frequency *f) 277 struct v4l2_frequency *f)
278{ 278{
279 struct video_device *dev = video_devdata(file); 279 struct video_device *dev = video_devdata(file);
280 struct az_device *az = dev->priv; 280 struct az_device *az = video_get_drvdata(dev);
281 281
282 f->type = V4L2_TUNER_RADIO; 282 f->type = V4L2_TUNER_RADIO;
283 f->frequency = az->curfreq; 283 f->frequency = az->curfreq;
@@ -304,7 +304,7 @@ static int vidioc_g_ctrl (struct file *file, void *priv,
304 struct v4l2_control *ctrl) 304 struct v4l2_control *ctrl)
305{ 305{
306 struct video_device *dev = video_devdata(file); 306 struct video_device *dev = video_devdata(file);
307 struct az_device *az = dev->priv; 307 struct az_device *az = video_get_drvdata(dev);
308 308
309 switch (ctrl->id) { 309 switch (ctrl->id) {
310 case V4L2_CID_AUDIO_MUTE: 310 case V4L2_CID_AUDIO_MUTE:
@@ -324,7 +324,7 @@ static int vidioc_s_ctrl (struct file *file, void *priv,
324 struct v4l2_control *ctrl) 324 struct v4l2_control *ctrl)
325{ 325{
326 struct video_device *dev = video_devdata(file); 326 struct video_device *dev = video_devdata(file);
327 struct az_device *az = dev->priv; 327 struct az_device *az = video_get_drvdata(dev);
328 328
329 switch (ctrl->id) { 329 switch (ctrl->id) {
330 case V4L2_CID_AUDIO_MUTE: 330 case V4L2_CID_AUDIO_MUTE:
@@ -405,7 +405,7 @@ static int __init aztech_init(void)
405 } 405 }
406 406
407 mutex_init(&lock); 407 mutex_init(&lock);
408 aztech_radio.priv=&aztech_unit; 408 video_set_drvdata(&aztech_radio, &aztech_unit);
409 409
410 if (video_register_device(&aztech_radio, VFL_TYPE_RADIO, radio_nr) < 0) { 410 if (video_register_device(&aztech_radio, VFL_TYPE_RADIO, radio_nr) < 0) {
411 release_region(io,2); 411 release_region(io,2);
diff --git a/drivers/media/radio/radio-gemtek-pci.c b/drivers/media/radio/radio-gemtek-pci.c
index d65fd287bde1..1f57f731c121 100644
--- a/drivers/media/radio/radio-gemtek-pci.c
+++ b/drivers/media/radio/radio-gemtek-pci.c
@@ -205,7 +205,7 @@ static int vidioc_g_tuner(struct file *file, void *priv,
205 struct v4l2_tuner *v) 205 struct v4l2_tuner *v)
206{ 206{
207 struct video_device *dev = video_devdata(file); 207 struct video_device *dev = video_devdata(file);
208 struct gemtek_pci_card *card = dev->priv; 208 struct gemtek_pci_card *card = video_get_drvdata(dev);
209 209
210 if (v->index > 0) 210 if (v->index > 0)
211 return -EINVAL; 211 return -EINVAL;
@@ -233,7 +233,7 @@ static int vidioc_s_frequency(struct file *file, void *priv,
233 struct v4l2_frequency *f) 233 struct v4l2_frequency *f)
234{ 234{
235 struct video_device *dev = video_devdata(file); 235 struct video_device *dev = video_devdata(file);
236 struct gemtek_pci_card *card = dev->priv; 236 struct gemtek_pci_card *card = video_get_drvdata(dev);
237 237
238 if ( (f->frequency < GEMTEK_PCI_RANGE_LOW) || 238 if ( (f->frequency < GEMTEK_PCI_RANGE_LOW) ||
239 (f->frequency > GEMTEK_PCI_RANGE_HIGH) ) 239 (f->frequency > GEMTEK_PCI_RANGE_HIGH) )
@@ -248,7 +248,7 @@ static int vidioc_g_frequency(struct file *file, void *priv,
248 struct v4l2_frequency *f) 248 struct v4l2_frequency *f)
249{ 249{
250 struct video_device *dev = video_devdata(file); 250 struct video_device *dev = video_devdata(file);
251 struct gemtek_pci_card *card = dev->priv; 251 struct gemtek_pci_card *card = video_get_drvdata(dev);
252 252
253 f->type = V4L2_TUNER_RADIO; 253 f->type = V4L2_TUNER_RADIO;
254 f->frequency = card->current_frequency; 254 f->frequency = card->current_frequency;
@@ -273,7 +273,7 @@ static int vidioc_g_ctrl(struct file *file, void *priv,
273 struct v4l2_control *ctrl) 273 struct v4l2_control *ctrl)
274{ 274{
275 struct video_device *dev = video_devdata(file); 275 struct video_device *dev = video_devdata(file);
276 struct gemtek_pci_card *card = dev->priv; 276 struct gemtek_pci_card *card = video_get_drvdata(dev);
277 277
278 switch (ctrl->id) { 278 switch (ctrl->id) {
279 case V4L2_CID_AUDIO_MUTE: 279 case V4L2_CID_AUDIO_MUTE:
@@ -293,7 +293,7 @@ static int vidioc_s_ctrl(struct file *file, void *priv,
293 struct v4l2_control *ctrl) 293 struct v4l2_control *ctrl)
294{ 294{
295 struct video_device *dev = video_devdata(file); 295 struct video_device *dev = video_devdata(file);
296 struct gemtek_pci_card *card = dev->priv; 296 struct gemtek_pci_card *card = video_get_drvdata(dev);
297 297
298 switch (ctrl->id) { 298 switch (ctrl->id) {
299 case V4L2_CID_AUDIO_MUTE: 299 case V4L2_CID_AUDIO_MUTE:
@@ -442,7 +442,7 @@ static int __devinit gemtek_pci_probe( struct pci_dev *pci_dev, const struct pci
442 } 442 }
443 443
444 card->videodev = devradio; 444 card->videodev = devradio;
445 devradio->priv = card; 445 video_set_drvdata(devradio, card);
446 gemtek_pci_mute( card ); 446 gemtek_pci_mute( card );
447 447
448 printk( KERN_INFO "Gemtek PCI Radio (rev. %d) found at 0x%04x-0x%04x.\n", 448 printk( KERN_INFO "Gemtek PCI Radio (rev. %d) found at 0x%04x-0x%04x.\n",
diff --git a/drivers/media/radio/radio-gemtek.c b/drivers/media/radio/radio-gemtek.c
index 2d991ae2f205..2c4c15e6d510 100644
--- a/drivers/media/radio/radio-gemtek.c
+++ b/drivers/media/radio/radio-gemtek.c
@@ -460,7 +460,7 @@ static int vidioc_s_frequency(struct file *file, void *priv,
460 struct v4l2_frequency *f) 460 struct v4l2_frequency *f)
461{ 461{
462 struct video_device *dev = video_devdata(file); 462 struct video_device *dev = video_devdata(file);
463 struct gemtek_device *rt = dev->priv; 463 struct gemtek_device *rt = video_get_drvdata(dev);
464 464
465 gemtek_setfreq(rt, f->frequency); 465 gemtek_setfreq(rt, f->frequency);
466 466
@@ -471,7 +471,7 @@ static int vidioc_g_frequency(struct file *file, void *priv,
471 struct v4l2_frequency *f) 471 struct v4l2_frequency *f)
472{ 472{
473 struct video_device *dev = video_devdata(file); 473 struct video_device *dev = video_devdata(file);
474 struct gemtek_device *rt = dev->priv; 474 struct gemtek_device *rt = video_get_drvdata(dev);
475 475
476 f->type = V4L2_TUNER_RADIO; 476 f->type = V4L2_TUNER_RADIO;
477 f->frequency = rt->lastfreq; 477 f->frequency = rt->lastfreq;
@@ -496,7 +496,7 @@ static int vidioc_g_ctrl(struct file *file, void *priv,
496 struct v4l2_control *ctrl) 496 struct v4l2_control *ctrl)
497{ 497{
498 struct video_device *dev = video_devdata(file); 498 struct video_device *dev = video_devdata(file);
499 struct gemtek_device *rt = dev->priv; 499 struct gemtek_device *rt = video_get_drvdata(dev);
500 500
501 switch (ctrl->id) { 501 switch (ctrl->id) {
502 case V4L2_CID_AUDIO_MUTE: 502 case V4L2_CID_AUDIO_MUTE:
@@ -516,7 +516,7 @@ static int vidioc_s_ctrl(struct file *file, void *priv,
516 struct v4l2_control *ctrl) 516 struct v4l2_control *ctrl)
517{ 517{
518 struct video_device *dev = video_devdata(file); 518 struct video_device *dev = video_devdata(file);
519 struct gemtek_device *rt = dev->priv; 519 struct gemtek_device *rt = video_get_drvdata(dev);
520 520
521 switch (ctrl->id) { 521 switch (ctrl->id) {
522 case V4L2_CID_AUDIO_MUTE: 522 case V4L2_CID_AUDIO_MUTE:
@@ -623,7 +623,7 @@ static int __init gemtek_init(void)
623 return -EINVAL; 623 return -EINVAL;
624 } 624 }
625 625
626 gemtek_radio.priv = &gemtek_unit; 626 video_set_drvdata(&gemtek_radio, &gemtek_unit);
627 627
628 if (video_register_device(&gemtek_radio, VFL_TYPE_RADIO, radio_nr) < 0) { 628 if (video_register_device(&gemtek_radio, VFL_TYPE_RADIO, radio_nr) < 0) {
629 release_region(io, 1); 629 release_region(io, 1);
diff --git a/drivers/media/radio/radio-maxiradio.c b/drivers/media/radio/radio-maxiradio.c
index 4e2e8a3d9b5f..9bf2acf5249c 100644
--- a/drivers/media/radio/radio-maxiradio.c
+++ b/drivers/media/radio/radio-maxiradio.c
@@ -232,7 +232,7 @@ static int vidioc_g_tuner (struct file *file, void *priv,
232 struct v4l2_tuner *v) 232 struct v4l2_tuner *v)
233{ 233{
234 struct video_device *dev = video_devdata(file); 234 struct video_device *dev = video_devdata(file);
235 struct radio_device *card=dev->priv; 235 struct radio_device *card = video_get_drvdata(dev);
236 236
237 if (v->index > 0) 237 if (v->index > 0)
238 return -EINVAL; 238 return -EINVAL;
@@ -303,7 +303,7 @@ static int vidioc_s_frequency (struct file *file, void *priv,
303 struct v4l2_frequency *f) 303 struct v4l2_frequency *f)
304{ 304{
305 struct video_device *dev = video_devdata(file); 305 struct video_device *dev = video_devdata(file);
306 struct radio_device *card=dev->priv; 306 struct radio_device *card = video_get_drvdata(dev);
307 307
308 if (f->frequency < FREQ_LO || f->frequency > FREQ_HI) { 308 if (f->frequency < FREQ_LO || f->frequency > FREQ_HI) {
309 dprintk(1, "radio freq (%d.%02d MHz) out of range (%d-%d)\n", 309 dprintk(1, "radio freq (%d.%02d MHz) out of range (%d-%d)\n",
@@ -325,7 +325,7 @@ static int vidioc_g_frequency (struct file *file, void *priv,
325 struct v4l2_frequency *f) 325 struct v4l2_frequency *f)
326{ 326{
327 struct video_device *dev = video_devdata(file); 327 struct video_device *dev = video_devdata(file);
328 struct radio_device *card=dev->priv; 328 struct radio_device *card = video_get_drvdata(dev);
329 329
330 f->type = V4L2_TUNER_RADIO; 330 f->type = V4L2_TUNER_RADIO;
331 f->frequency = card->freq; 331 f->frequency = card->freq;
@@ -356,7 +356,7 @@ static int vidioc_g_ctrl (struct file *file, void *priv,
356 struct v4l2_control *ctrl) 356 struct v4l2_control *ctrl)
357{ 357{
358 struct video_device *dev = video_devdata(file); 358 struct video_device *dev = video_devdata(file);
359 struct radio_device *card=dev->priv; 359 struct radio_device *card = video_get_drvdata(dev);
360 360
361 switch (ctrl->id) { 361 switch (ctrl->id) {
362 case V4L2_CID_AUDIO_MUTE: 362 case V4L2_CID_AUDIO_MUTE:
@@ -371,7 +371,7 @@ static int vidioc_s_ctrl (struct file *file, void *priv,
371 struct v4l2_control *ctrl) 371 struct v4l2_control *ctrl)
372{ 372{
373 struct video_device *dev = video_devdata(file); 373 struct video_device *dev = video_devdata(file);
374 struct radio_device *card=dev->priv; 374 struct radio_device *card = video_get_drvdata(dev);
375 375
376 switch (ctrl->id) { 376 switch (ctrl->id) {
377 case V4L2_CID_AUDIO_MUTE: 377 case V4L2_CID_AUDIO_MUTE:
@@ -421,7 +421,7 @@ static int __devinit maxiradio_init_one(struct pci_dev *pdev, const struct pci_d
421 421
422 radio_unit.io = pci_resource_start(pdev, 0); 422 radio_unit.io = pci_resource_start(pdev, 0);
423 mutex_init(&radio_unit.lock); 423 mutex_init(&radio_unit.lock);
424 maxiradio_radio.priv = &radio_unit; 424 video_set_drvdata(&maxiradio_radio, &radio_unit);
425 425
426 if (video_register_device(&maxiradio_radio, VFL_TYPE_RADIO, radio_nr) < 0) { 426 if (video_register_device(&maxiradio_radio, VFL_TYPE_RADIO, radio_nr) < 0) {
427 printk("radio-maxiradio: can't register device!"); 427 printk("radio-maxiradio: can't register device!");
diff --git a/drivers/media/radio/radio-rtrack2.c b/drivers/media/radio/radio-rtrack2.c
index 8fe820da73e8..4234f7ed0fc3 100644
--- a/drivers/media/radio/radio-rtrack2.c
+++ b/drivers/media/radio/radio-rtrack2.c
@@ -155,7 +155,7 @@ static int vidioc_g_tuner(struct file *file, void *priv,
155 struct v4l2_tuner *v) 155 struct v4l2_tuner *v)
156{ 156{
157 struct video_device *dev = video_devdata(file); 157 struct video_device *dev = video_devdata(file);
158 struct rt_device *rt = dev->priv; 158 struct rt_device *rt = video_get_drvdata(dev);
159 159
160 if (v->index > 0) 160 if (v->index > 0)
161 return -EINVAL; 161 return -EINVAL;
@@ -175,7 +175,7 @@ static int vidioc_s_frequency(struct file *file, void *priv,
175 struct v4l2_frequency *f) 175 struct v4l2_frequency *f)
176{ 176{
177 struct video_device *dev = video_devdata(file); 177 struct video_device *dev = video_devdata(file);
178 struct rt_device *rt = dev->priv; 178 struct rt_device *rt = video_get_drvdata(dev);
179 179
180 rt->curfreq = f->frequency; 180 rt->curfreq = f->frequency;
181 rt_setfreq(rt, rt->curfreq); 181 rt_setfreq(rt, rt->curfreq);
@@ -186,7 +186,7 @@ static int vidioc_g_frequency(struct file *file, void *priv,
186 struct v4l2_frequency *f) 186 struct v4l2_frequency *f)
187{ 187{
188 struct video_device *dev = video_devdata(file); 188 struct video_device *dev = video_devdata(file);
189 struct rt_device *rt = dev->priv; 189 struct rt_device *rt = video_get_drvdata(dev);
190 190
191 f->type = V4L2_TUNER_RADIO; 191 f->type = V4L2_TUNER_RADIO;
192 f->frequency = rt->curfreq; 192 f->frequency = rt->curfreq;
@@ -212,7 +212,7 @@ static int vidioc_g_ctrl(struct file *file, void *priv,
212 struct v4l2_control *ctrl) 212 struct v4l2_control *ctrl)
213{ 213{
214 struct video_device *dev = video_devdata(file); 214 struct video_device *dev = video_devdata(file);
215 struct rt_device *rt = dev->priv; 215 struct rt_device *rt = video_get_drvdata(dev);
216 216
217 switch (ctrl->id) { 217 switch (ctrl->id) {
218 case V4L2_CID_AUDIO_MUTE: 218 case V4L2_CID_AUDIO_MUTE:
@@ -232,7 +232,7 @@ static int vidioc_s_ctrl(struct file *file, void *priv,
232 struct v4l2_control *ctrl) 232 struct v4l2_control *ctrl)
233{ 233{
234 struct video_device *dev = video_devdata(file); 234 struct video_device *dev = video_devdata(file);
235 struct rt_device *rt = dev->priv; 235 struct rt_device *rt = video_get_drvdata(dev);
236 236
237 switch (ctrl->id) { 237 switch (ctrl->id) {
238 case V4L2_CID_AUDIO_MUTE: 238 case V4L2_CID_AUDIO_MUTE:
@@ -342,7 +342,7 @@ static int __init rtrack2_init(void)
342 return -EBUSY; 342 return -EBUSY;
343 } 343 }
344 344
345 rtrack2_radio.priv=&rtrack2_unit; 345 video_set_drvdata(&rtrack2_radio, &rtrack2_unit);
346 346
347 spin_lock_init(&lock); 347 spin_lock_init(&lock);
348 if (video_register_device(&rtrack2_radio, VFL_TYPE_RADIO, radio_nr) < 0) { 348 if (video_register_device(&rtrack2_radio, VFL_TYPE_RADIO, radio_nr) < 0) {
diff --git a/drivers/media/radio/radio-sf16fmi.c b/drivers/media/radio/radio-sf16fmi.c
index 6d865a7a91ec..810c366b73b0 100644
--- a/drivers/media/radio/radio-sf16fmi.c
+++ b/drivers/media/radio/radio-sf16fmi.c
@@ -148,7 +148,7 @@ static int vidioc_g_tuner(struct file *file, void *priv,
148{ 148{
149 int mult; 149 int mult;
150 struct video_device *dev = video_devdata(file); 150 struct video_device *dev = video_devdata(file);
151 struct fmi_device *fmi = dev->priv; 151 struct fmi_device *fmi = video_get_drvdata(dev);
152 152
153 if (v->index > 0) 153 if (v->index > 0)
154 return -EINVAL; 154 return -EINVAL;
@@ -177,7 +177,7 @@ static int vidioc_s_frequency(struct file *file, void *priv,
177 struct v4l2_frequency *f) 177 struct v4l2_frequency *f)
178{ 178{
179 struct video_device *dev = video_devdata(file); 179 struct video_device *dev = video_devdata(file);
180 struct fmi_device *fmi = dev->priv; 180 struct fmi_device *fmi = video_get_drvdata(dev);
181 181
182 if (!(fmi->flags & V4L2_TUNER_CAP_LOW)) 182 if (!(fmi->flags & V4L2_TUNER_CAP_LOW))
183 f->frequency *= 1000; 183 f->frequency *= 1000;
@@ -195,7 +195,7 @@ static int vidioc_g_frequency(struct file *file, void *priv,
195 struct v4l2_frequency *f) 195 struct v4l2_frequency *f)
196{ 196{
197 struct video_device *dev = video_devdata(file); 197 struct video_device *dev = video_devdata(file);
198 struct fmi_device *fmi = dev->priv; 198 struct fmi_device *fmi = video_get_drvdata(dev);
199 199
200 f->type = V4L2_TUNER_RADIO; 200 f->type = V4L2_TUNER_RADIO;
201 f->frequency = fmi->curfreq; 201 f->frequency = fmi->curfreq;
@@ -223,7 +223,7 @@ static int vidioc_g_ctrl(struct file *file, void *priv,
223 struct v4l2_control *ctrl) 223 struct v4l2_control *ctrl)
224{ 224{
225 struct video_device *dev = video_devdata(file); 225 struct video_device *dev = video_devdata(file);
226 struct fmi_device *fmi = dev->priv; 226 struct fmi_device *fmi = video_get_drvdata(dev);
227 227
228 switch (ctrl->id) { 228 switch (ctrl->id) {
229 case V4L2_CID_AUDIO_MUTE: 229 case V4L2_CID_AUDIO_MUTE:
@@ -237,7 +237,7 @@ static int vidioc_s_ctrl(struct file *file, void *priv,
237 struct v4l2_control *ctrl) 237 struct v4l2_control *ctrl)
238{ 238{
239 struct video_device *dev = video_devdata(file); 239 struct video_device *dev = video_devdata(file);
240 struct fmi_device *fmi = dev->priv; 240 struct fmi_device *fmi = video_get_drvdata(dev);
241 241
242 switch (ctrl->id) { 242 switch (ctrl->id) {
243 case V4L2_CID_AUDIO_MUTE: 243 case V4L2_CID_AUDIO_MUTE:
@@ -386,7 +386,7 @@ static int __init fmi_init(void)
386 fmi_unit.curvol = 0; 386 fmi_unit.curvol = 0;
387 fmi_unit.curfreq = 0; 387 fmi_unit.curfreq = 0;
388 fmi_unit.flags = V4L2_TUNER_CAP_LOW; 388 fmi_unit.flags = V4L2_TUNER_CAP_LOW;
389 fmi_radio.priv = &fmi_unit; 389 video_set_drvdata(&fmi_radio, &fmi_unit);
390 390
391 mutex_init(&lock); 391 mutex_init(&lock);
392 392
diff --git a/drivers/media/radio/radio-sf16fmr2.c b/drivers/media/radio/radio-sf16fmr2.c
index 9625d1f0194e..9f823150452d 100644
--- a/drivers/media/radio/radio-sf16fmr2.c
+++ b/drivers/media/radio/radio-sf16fmr2.c
@@ -231,7 +231,7 @@ static int vidioc_g_tuner(struct file *file, void *priv,
231{ 231{
232 int mult; 232 int mult;
233 struct video_device *dev = video_devdata(file); 233 struct video_device *dev = video_devdata(file);
234 struct fmr2_device *fmr2 = dev->priv; 234 struct fmr2_device *fmr2 = video_get_drvdata(dev);
235 235
236 if (v->index > 0) 236 if (v->index > 0)
237 return -EINVAL; 237 return -EINVAL;
@@ -264,7 +264,7 @@ static int vidioc_s_frequency(struct file *file, void *priv,
264 struct v4l2_frequency *f) 264 struct v4l2_frequency *f)
265{ 265{
266 struct video_device *dev = video_devdata(file); 266 struct video_device *dev = video_devdata(file);
267 struct fmr2_device *fmr2 = dev->priv; 267 struct fmr2_device *fmr2 = video_get_drvdata(dev);
268 268
269 if (!(fmr2->flags & V4L2_TUNER_CAP_LOW)) 269 if (!(fmr2->flags & V4L2_TUNER_CAP_LOW))
270 f->frequency *= 1000; 270 f->frequency *= 1000;
@@ -288,7 +288,7 @@ static int vidioc_g_frequency(struct file *file, void *priv,
288 struct v4l2_frequency *f) 288 struct v4l2_frequency *f)
289{ 289{
290 struct video_device *dev = video_devdata(file); 290 struct video_device *dev = video_devdata(file);
291 struct fmr2_device *fmr2 = dev->priv; 291 struct fmr2_device *fmr2 = video_get_drvdata(dev);
292 292
293 f->type = V4L2_TUNER_RADIO; 293 f->type = V4L2_TUNER_RADIO;
294 f->frequency = fmr2->curfreq; 294 f->frequency = fmr2->curfreq;
@@ -315,7 +315,7 @@ static int vidioc_g_ctrl(struct file *file, void *priv,
315 struct v4l2_control *ctrl) 315 struct v4l2_control *ctrl)
316{ 316{
317 struct video_device *dev = video_devdata(file); 317 struct video_device *dev = video_devdata(file);
318 struct fmr2_device *fmr2 = dev->priv; 318 struct fmr2_device *fmr2 = video_get_drvdata(dev);
319 319
320 switch (ctrl->id) { 320 switch (ctrl->id) {
321 case V4L2_CID_AUDIO_MUTE: 321 case V4L2_CID_AUDIO_MUTE:
@@ -332,7 +332,7 @@ static int vidioc_s_ctrl(struct file *file, void *priv,
332 struct v4l2_control *ctrl) 332 struct v4l2_control *ctrl)
333{ 333{
334 struct video_device *dev = video_devdata(file); 334 struct video_device *dev = video_devdata(file);
335 struct fmr2_device *fmr2 = dev->priv; 335 struct fmr2_device *fmr2 = video_get_drvdata(dev);
336 336
337 switch (ctrl->id) { 337 switch (ctrl->id) {
338 case V4L2_CID_AUDIO_MUTE: 338 case V4L2_CID_AUDIO_MUTE:
@@ -454,7 +454,7 @@ static int __init fmr2_init(void)
454 fmr2_unit.stereo = 1; 454 fmr2_unit.stereo = 1;
455 fmr2_unit.flags = V4L2_TUNER_CAP_LOW; 455 fmr2_unit.flags = V4L2_TUNER_CAP_LOW;
456 fmr2_unit.card_type = 0; 456 fmr2_unit.card_type = 0;
457 fmr2_radio.priv = &fmr2_unit; 457 video_set_drvdata(&fmr2_radio, &fmr2_unit);
458 458
459 mutex_init(&lock); 459 mutex_init(&lock);
460 460
diff --git a/drivers/media/radio/radio-terratec.c b/drivers/media/radio/radio-terratec.c
index de13ec81ce49..0bc9af686ad7 100644
--- a/drivers/media/radio/radio-terratec.c
+++ b/drivers/media/radio/radio-terratec.c
@@ -222,7 +222,7 @@ static int vidioc_g_tuner(struct file *file, void *priv,
222 struct v4l2_tuner *v) 222 struct v4l2_tuner *v)
223{ 223{
224 struct video_device *dev = video_devdata(file); 224 struct video_device *dev = video_devdata(file);
225 struct tt_device *tt = dev->priv; 225 struct tt_device *tt = video_get_drvdata(dev);
226 226
227 if (v->index > 0) 227 if (v->index > 0)
228 return -EINVAL; 228 return -EINVAL;
@@ -250,7 +250,7 @@ static int vidioc_s_frequency(struct file *file, void *priv,
250 struct v4l2_frequency *f) 250 struct v4l2_frequency *f)
251{ 251{
252 struct video_device *dev = video_devdata(file); 252 struct video_device *dev = video_devdata(file);
253 struct tt_device *tt = dev->priv; 253 struct tt_device *tt = video_get_drvdata(dev);
254 254
255 tt->curfreq = f->frequency; 255 tt->curfreq = f->frequency;
256 tt_setfreq(tt, tt->curfreq); 256 tt_setfreq(tt, tt->curfreq);
@@ -261,7 +261,7 @@ static int vidioc_g_frequency(struct file *file, void *priv,
261 struct v4l2_frequency *f) 261 struct v4l2_frequency *f)
262{ 262{
263 struct video_device *dev = video_devdata(file); 263 struct video_device *dev = video_devdata(file);
264 struct tt_device *tt = dev->priv; 264 struct tt_device *tt = video_get_drvdata(dev);
265 265
266 f->type = V4L2_TUNER_RADIO; 266 f->type = V4L2_TUNER_RADIO;
267 f->frequency = tt->curfreq; 267 f->frequency = tt->curfreq;
@@ -287,7 +287,7 @@ static int vidioc_g_ctrl(struct file *file, void *priv,
287 struct v4l2_control *ctrl) 287 struct v4l2_control *ctrl)
288{ 288{
289 struct video_device *dev = video_devdata(file); 289 struct video_device *dev = video_devdata(file);
290 struct tt_device *tt = dev->priv; 290 struct tt_device *tt = video_get_drvdata(dev);
291 291
292 switch (ctrl->id) { 292 switch (ctrl->id) {
293 case V4L2_CID_AUDIO_MUTE: 293 case V4L2_CID_AUDIO_MUTE:
@@ -307,7 +307,7 @@ static int vidioc_s_ctrl(struct file *file, void *priv,
307 struct v4l2_control *ctrl) 307 struct v4l2_control *ctrl)
308{ 308{
309 struct video_device *dev = video_devdata(file); 309 struct video_device *dev = video_devdata(file);
310 struct tt_device *tt = dev->priv; 310 struct tt_device *tt = video_get_drvdata(dev);
311 311
312 switch (ctrl->id) { 312 switch (ctrl->id) {
313 case V4L2_CID_AUDIO_MUTE: 313 case V4L2_CID_AUDIO_MUTE:
@@ -414,7 +414,7 @@ static int __init terratec_init(void)
414 return -EBUSY; 414 return -EBUSY;
415 } 415 }
416 416
417 terratec_radio.priv=&terratec_unit; 417 video_set_drvdata(&terratec_radio, &terratec_unit);
418 418
419 spin_lock_init(&lock); 419 spin_lock_init(&lock);
420 420
diff --git a/drivers/media/radio/radio-typhoon.c b/drivers/media/radio/radio-typhoon.c
index c2eedb7a73a5..27255d7ff1ba 100644
--- a/drivers/media/radio/radio-typhoon.c
+++ b/drivers/media/radio/radio-typhoon.c
@@ -224,7 +224,7 @@ static int vidioc_s_frequency(struct file *file, void *priv,
224 struct v4l2_frequency *f) 224 struct v4l2_frequency *f)
225{ 225{
226 struct video_device *dev = video_devdata(file); 226 struct video_device *dev = video_devdata(file);
227 struct typhoon_device *typhoon = dev->priv; 227 struct typhoon_device *typhoon = video_get_drvdata(dev);
228 228
229 typhoon->curfreq = f->frequency; 229 typhoon->curfreq = f->frequency;
230 typhoon_setfreq(typhoon, typhoon->curfreq); 230 typhoon_setfreq(typhoon, typhoon->curfreq);
@@ -235,7 +235,7 @@ static int vidioc_g_frequency(struct file *file, void *priv,
235 struct v4l2_frequency *f) 235 struct v4l2_frequency *f)
236{ 236{
237 struct video_device *dev = video_devdata(file); 237 struct video_device *dev = video_devdata(file);
238 struct typhoon_device *typhoon = dev->priv; 238 struct typhoon_device *typhoon = video_get_drvdata(dev);
239 239
240 f->type = V4L2_TUNER_RADIO; 240 f->type = V4L2_TUNER_RADIO;
241 f->frequency = typhoon->curfreq; 241 f->frequency = typhoon->curfreq;
@@ -262,7 +262,7 @@ static int vidioc_g_ctrl(struct file *file, void *priv,
262 struct v4l2_control *ctrl) 262 struct v4l2_control *ctrl)
263{ 263{
264 struct video_device *dev = video_devdata(file); 264 struct video_device *dev = video_devdata(file);
265 struct typhoon_device *typhoon = dev->priv; 265 struct typhoon_device *typhoon = video_get_drvdata(dev);
266 266
267 switch (ctrl->id) { 267 switch (ctrl->id) {
268 case V4L2_CID_AUDIO_MUTE: 268 case V4L2_CID_AUDIO_MUTE:
@@ -279,7 +279,7 @@ static int vidioc_s_ctrl (struct file *file, void *priv,
279 struct v4l2_control *ctrl) 279 struct v4l2_control *ctrl)
280{ 280{
281 struct video_device *dev = video_devdata(file); 281 struct video_device *dev = video_devdata(file);
282 struct typhoon_device *typhoon = dev->priv; 282 struct typhoon_device *typhoon = video_get_drvdata(dev);
283 283
284 switch (ctrl->id) { 284 switch (ctrl->id) {
285 case V4L2_CID_AUDIO_MUTE: 285 case V4L2_CID_AUDIO_MUTE:
@@ -458,7 +458,7 @@ static int __init typhoon_init(void)
458 return -EBUSY; 458 return -EBUSY;
459 } 459 }
460 460
461 typhoon_radio.priv = &typhoon_unit; 461 video_set_drvdata(&typhoon_radio, &typhoon_unit);
462 if (video_register_device(&typhoon_radio, VFL_TYPE_RADIO, radio_nr) < 0) { 462 if (video_register_device(&typhoon_radio, VFL_TYPE_RADIO, radio_nr) < 0) {
463 release_region(io, 8); 463 release_region(io, 8);
464 return -EINVAL; 464 return -EINVAL;
diff --git a/drivers/media/radio/radio-zoltrix.c b/drivers/media/radio/radio-zoltrix.c
index 0d43e8401eb5..3a9a7772ae51 100644
--- a/drivers/media/radio/radio-zoltrix.c
+++ b/drivers/media/radio/radio-zoltrix.c
@@ -247,7 +247,7 @@ static int vidioc_g_tuner(struct file *file, void *priv,
247 struct v4l2_tuner *v) 247 struct v4l2_tuner *v)
248{ 248{
249 struct video_device *dev = video_devdata(file); 249 struct video_device *dev = video_devdata(file);
250 struct zol_device *zol = dev->priv; 250 struct zol_device *zol = video_get_drvdata(dev);
251 251
252 if (v->index > 0) 252 if (v->index > 0)
253 return -EINVAL; 253 return -EINVAL;
@@ -278,7 +278,7 @@ static int vidioc_s_frequency(struct file *file, void *priv,
278 struct v4l2_frequency *f) 278 struct v4l2_frequency *f)
279{ 279{
280 struct video_device *dev = video_devdata(file); 280 struct video_device *dev = video_devdata(file);
281 struct zol_device *zol = dev->priv; 281 struct zol_device *zol = video_get_drvdata(dev);
282 282
283 zol->curfreq = f->frequency; 283 zol->curfreq = f->frequency;
284 zol_setfreq(zol, zol->curfreq); 284 zol_setfreq(zol, zol->curfreq);
@@ -289,7 +289,7 @@ static int vidioc_g_frequency(struct file *file, void *priv,
289 struct v4l2_frequency *f) 289 struct v4l2_frequency *f)
290{ 290{
291 struct video_device *dev = video_devdata(file); 291 struct video_device *dev = video_devdata(file);
292 struct zol_device *zol = dev->priv; 292 struct zol_device *zol = video_get_drvdata(dev);
293 293
294 f->type = V4L2_TUNER_RADIO; 294 f->type = V4L2_TUNER_RADIO;
295 f->frequency = zol->curfreq; 295 f->frequency = zol->curfreq;
@@ -315,7 +315,7 @@ static int vidioc_g_ctrl(struct file *file, void *priv,
315 struct v4l2_control *ctrl) 315 struct v4l2_control *ctrl)
316{ 316{
317 struct video_device *dev = video_devdata(file); 317 struct video_device *dev = video_devdata(file);
318 struct zol_device *zol = dev->priv; 318 struct zol_device *zol = video_get_drvdata(dev);
319 319
320 switch (ctrl->id) { 320 switch (ctrl->id) {
321 case V4L2_CID_AUDIO_MUTE: 321 case V4L2_CID_AUDIO_MUTE:
@@ -332,7 +332,7 @@ static int vidioc_s_ctrl(struct file *file, void *priv,
332 struct v4l2_control *ctrl) 332 struct v4l2_control *ctrl)
333{ 333{
334 struct video_device *dev = video_devdata(file); 334 struct video_device *dev = video_devdata(file);
335 struct zol_device *zol = dev->priv; 335 struct zol_device *zol = video_get_drvdata(dev);
336 336
337 switch (ctrl->id) { 337 switch (ctrl->id) {
338 case V4L2_CID_AUDIO_MUTE: 338 case V4L2_CID_AUDIO_MUTE:
@@ -453,7 +453,7 @@ static int __init zoltrix_init(void)
453 return -ENXIO; 453 return -ENXIO;
454 } 454 }
455 455
456 zoltrix_radio.priv = &zoltrix_unit; 456 video_set_drvdata(&zoltrix_radio, &zoltrix_unit);
457 if (!request_region(io, 2, "zoltrix")) { 457 if (!request_region(io, 2, "zoltrix")) {
458 printk(KERN_ERR "zoltrix: port 0x%x already in use\n", io); 458 printk(KERN_ERR "zoltrix: port 0x%x already in use\n", io);
459 return -EBUSY; 459 return -EBUSY;
diff --git a/drivers/media/video/arv.c b/drivers/media/video/arv.c
index 0d4f9b683459..218754b4906a 100644
--- a/drivers/media/video/arv.c
+++ b/drivers/media/video/arv.c
@@ -270,7 +270,7 @@ static inline void wait_for_vertical_sync(int exp_line)
270static ssize_t ar_read(struct file *file, char *buf, size_t count, loff_t *ppos) 270static ssize_t ar_read(struct file *file, char *buf, size_t count, loff_t *ppos)
271{ 271{
272 struct video_device *v = video_devdata(file); 272 struct video_device *v = video_devdata(file);
273 struct ar_device *ar = v->priv; 273 struct ar_device *ar = video_get_drvdata(v);
274 long ret = ar->frame_bytes; /* return read bytes */ 274 long ret = ar->frame_bytes; /* return read bytes */
275 unsigned long arvcr1 = 0; 275 unsigned long arvcr1 = 0;
276 unsigned long flags; 276 unsigned long flags;
@@ -400,7 +400,7 @@ static int ar_do_ioctl(struct inode *inode, struct file *file,
400 unsigned int cmd, void *arg) 400 unsigned int cmd, void *arg)
401{ 401{
402 struct video_device *dev = video_devdata(file); 402 struct video_device *dev = video_devdata(file);
403 struct ar_device *ar = dev->priv; 403 struct ar_device *ar = video_get_drvdata(dev);
404 404
405 DEBUG(1, "ar_ioctl()\n"); 405 DEBUG(1, "ar_ioctl()\n");
406 switch(cmd) { 406 switch(cmd) {
@@ -626,7 +626,7 @@ static void ar_interrupt(int irq, void *dev)
626 */ 626 */
627static int ar_initialize(struct video_device *dev) 627static int ar_initialize(struct video_device *dev)
628{ 628{
629 struct ar_device *ar = dev->priv; 629 struct ar_device *ar = video_get_drvdata(dev);
630 unsigned long cr = 0; 630 unsigned long cr = 0;
631 int i,found=0; 631 int i,found=0;
632 632
@@ -733,7 +733,7 @@ static int ar_initialize(struct video_device *dev)
733 733
734void ar_release(struct video_device *vfd) 734void ar_release(struct video_device *vfd)
735{ 735{
736 struct ar_device *ar = vfd->priv; 736 struct ar_device *ar = video_get_drvdata(vfd);
737 mutex_lock(&ar->lock); 737 mutex_lock(&ar->lock);
738 video_device_release(vfd); 738 video_device_release(vfd);
739} 739}
@@ -815,7 +815,7 @@ static int __init ar_init(void)
815 return -ENOMEM; 815 return -ENOMEM;
816 } 816 }
817 memcpy(ar->vdev, &ar_template, sizeof(ar_template)); 817 memcpy(ar->vdev, &ar_template, sizeof(ar_template));
818 ar->vdev->priv = ar; 818 video_set_drvdata(ar->vdev, ar);
819 819
820 if (vga) { 820 if (vga) {
821 ar->width = AR_WIDTH_VGA; 821 ar->width = AR_WIDTH_VGA;
diff --git a/drivers/media/video/cpia.c b/drivers/media/video/cpia.c
index c0600fdbfc6f..b14c59c281eb 100644
--- a/drivers/media/video/cpia.c
+++ b/drivers/media/video/cpia.c
@@ -3155,7 +3155,7 @@ static void put_cam(struct cpia_camera_ops* ops)
3155static int cpia_open(struct inode *inode, struct file *file) 3155static int cpia_open(struct inode *inode, struct file *file)
3156{ 3156{
3157 struct video_device *dev = video_devdata(file); 3157 struct video_device *dev = video_devdata(file);
3158 struct cam_data *cam = dev->priv; 3158 struct cam_data *cam = video_get_drvdata(dev);
3159 int err; 3159 int err;
3160 3160
3161 if (!cam) { 3161 if (!cam) {
@@ -3232,7 +3232,7 @@ static int cpia_open(struct inode *inode, struct file *file)
3232static int cpia_close(struct inode *inode, struct file *file) 3232static int cpia_close(struct inode *inode, struct file *file)
3233{ 3233{
3234 struct video_device *dev = file->private_data; 3234 struct video_device *dev = file->private_data;
3235 struct cam_data *cam = dev->priv; 3235 struct cam_data *cam = video_get_drvdata(dev);
3236 3236
3237 if (cam->ops) { 3237 if (cam->ops) {
3238 /* Return ownership of /proc/cpia/videoX to root */ 3238 /* Return ownership of /proc/cpia/videoX to root */
@@ -3284,7 +3284,7 @@ static ssize_t cpia_read(struct file *file, char __user *buf,
3284 size_t count, loff_t *ppos) 3284 size_t count, loff_t *ppos)
3285{ 3285{
3286 struct video_device *dev = file->private_data; 3286 struct video_device *dev = file->private_data;
3287 struct cam_data *cam = dev->priv; 3287 struct cam_data *cam = video_get_drvdata(dev);
3288 int err; 3288 int err;
3289 3289
3290 /* make this _really_ smp and multithread-safe */ 3290 /* make this _really_ smp and multithread-safe */
@@ -3341,7 +3341,7 @@ static int cpia_do_ioctl(struct inode *inode, struct file *file,
3341 unsigned int ioctlnr, void *arg) 3341 unsigned int ioctlnr, void *arg)
3342{ 3342{
3343 struct video_device *dev = file->private_data; 3343 struct video_device *dev = file->private_data;
3344 struct cam_data *cam = dev->priv; 3344 struct cam_data *cam = video_get_drvdata(dev);
3345 int retval = 0; 3345 int retval = 0;
3346 3346
3347 if (!cam || !cam->ops) 3347 if (!cam || !cam->ops)
@@ -3739,7 +3739,7 @@ static int cpia_mmap(struct file *file, struct vm_area_struct *vma)
3739 unsigned long start = vma->vm_start; 3739 unsigned long start = vma->vm_start;
3740 unsigned long size = vma->vm_end - vma->vm_start; 3740 unsigned long size = vma->vm_end - vma->vm_start;
3741 unsigned long page, pos; 3741 unsigned long page, pos;
3742 struct cam_data *cam = dev->priv; 3742 struct cam_data *cam = video_get_drvdata(dev);
3743 int retval; 3743 int retval;
3744 3744
3745 if (!cam || !cam->ops) 3745 if (!cam || !cam->ops)
@@ -3929,7 +3929,7 @@ static void init_camera_struct(struct cam_data *cam,
3929 cam->proc_entry = NULL; 3929 cam->proc_entry = NULL;
3930 3930
3931 memcpy(&cam->vdev, &cpia_template, sizeof(cpia_template)); 3931 memcpy(&cam->vdev, &cpia_template, sizeof(cpia_template));
3932 cam->vdev.priv = cam; 3932 video_set_drvdata(&cam->vdev, cam);
3933 3933
3934 cam->curframe = 0; 3934 cam->curframe = 0;
3935 for (i = 0; i < FRAME_NUM; i++) { 3935 for (i = 0; i < FRAME_NUM; i++) {
diff --git a/drivers/media/video/pwc/pwc-if.c b/drivers/media/video/pwc/pwc-if.c
index 9aee7cb6f79a..ab28389b4cda 100644
--- a/drivers/media/video/pwc/pwc-if.c
+++ b/drivers/media/video/pwc/pwc-if.c
@@ -1112,7 +1112,7 @@ static int pwc_video_open(struct inode *inode, struct file *file)
1112 1112
1113 PWC_DEBUG_OPEN(">> video_open called(vdev = 0x%p).\n", vdev); 1113 PWC_DEBUG_OPEN(">> video_open called(vdev = 0x%p).\n", vdev);
1114 1114
1115 pdev = (struct pwc_device *)vdev->priv; 1115 pdev = video_get_drvdata(vdev);
1116 BUG_ON(!pdev); 1116 BUG_ON(!pdev);
1117 if (pdev->vopen) { 1117 if (pdev->vopen) {
1118 PWC_DEBUG_OPEN("I'm busy, someone is using the device.\n"); 1118 PWC_DEBUG_OPEN("I'm busy, someone is using the device.\n");
@@ -1233,7 +1233,7 @@ static int pwc_video_close(struct inode *inode, struct file *file)
1233 PWC_DEBUG_OPEN(">> video_close called(vdev = 0x%p).\n", vdev); 1233 PWC_DEBUG_OPEN(">> video_close called(vdev = 0x%p).\n", vdev);
1234 1234
1235 lock_kernel(); 1235 lock_kernel();
1236 pdev = (struct pwc_device *)vdev->priv; 1236 pdev = video_get_drvdata(vdev);
1237 if (pdev->vopen == 0) 1237 if (pdev->vopen == 0)
1238 PWC_DEBUG_MODULE("video_close() called on closed device?\n"); 1238 PWC_DEBUG_MODULE("video_close() called on closed device?\n");
1239 1239
@@ -1304,7 +1304,7 @@ static ssize_t pwc_video_read(struct file *file, char __user *buf,
1304 vdev, buf, count); 1304 vdev, buf, count);
1305 if (vdev == NULL) 1305 if (vdev == NULL)
1306 return -EFAULT; 1306 return -EFAULT;
1307 pdev = vdev->priv; 1307 pdev = video_get_drvdata(vdev);
1308 if (pdev == NULL) 1308 if (pdev == NULL)
1309 return -EFAULT; 1309 return -EFAULT;
1310 1310
@@ -1386,7 +1386,7 @@ static unsigned int pwc_video_poll(struct file *file, poll_table *wait)
1386 1386
1387 if (vdev == NULL) 1387 if (vdev == NULL)
1388 return -EFAULT; 1388 return -EFAULT;
1389 pdev = vdev->priv; 1389 pdev = video_get_drvdata(vdev);
1390 if (pdev == NULL) 1390 if (pdev == NULL)
1391 return -EFAULT; 1391 return -EFAULT;
1392 1392
@@ -1408,7 +1408,7 @@ static int pwc_video_ioctl(struct inode *inode, struct file *file,
1408 1408
1409 if (!vdev) 1409 if (!vdev)
1410 goto out; 1410 goto out;
1411 pdev = vdev->priv; 1411 pdev = video_get_drvdata(vdev);
1412 1412
1413 mutex_lock(&pdev->modlock); 1413 mutex_lock(&pdev->modlock);
1414 if (!pdev->unplugged) 1414 if (!pdev->unplugged)
@@ -1428,7 +1428,7 @@ static int pwc_video_mmap(struct file *file, struct vm_area_struct *vma)
1428 int index; 1428 int index;
1429 1429
1430 PWC_DEBUG_MEMORY(">> %s\n", __func__); 1430 PWC_DEBUG_MEMORY(">> %s\n", __func__);
1431 pdev = vdev->priv; 1431 pdev = video_get_drvdata(vdev);
1432 size = vma->vm_end - vma->vm_start; 1432 size = vma->vm_end - vma->vm_start;
1433 start = vma->vm_start; 1433 start = vma->vm_start;
1434 1434
diff --git a/drivers/media/video/pwc/pwc-v4l.c b/drivers/media/video/pwc/pwc-v4l.c
index 1742889874df..76a1376c9751 100644
--- a/drivers/media/video/pwc/pwc-v4l.c
+++ b/drivers/media/video/pwc/pwc-v4l.c
@@ -346,7 +346,7 @@ int pwc_video_do_ioctl(struct inode *inode, struct file *file,
346 346
347 if (vdev == NULL) 347 if (vdev == NULL)
348 return -EFAULT; 348 return -EFAULT;
349 pdev = vdev->priv; 349 pdev = video_get_drvdata(vdev);
350 if (pdev == NULL) 350 if (pdev == NULL)
351 return -EFAULT; 351 return -EFAULT;
352 352
diff --git a/drivers/media/video/s2255drv.c b/drivers/media/video/s2255drv.c
index af19bb346ef1..ea40f4c8b33e 100644
--- a/drivers/media/video/s2255drv.c
+++ b/drivers/media/video/s2255drv.c
@@ -1800,7 +1800,7 @@ static int s2255_probe_v4l(struct s2255_dev *dev)
1800 ret = video_register_device(dev->vdev[i], 1800 ret = video_register_device(dev->vdev[i],
1801 VFL_TYPE_GRABBER, 1801 VFL_TYPE_GRABBER,
1802 cur_nr + i); 1802 cur_nr + i);
1803 dev->vdev[i]->priv = dev; 1803 video_set_drvdata(dev->vdev[i], dev);
1804 1804
1805 if (ret != 0) { 1805 if (ret != 0) {
1806 dev_err(&dev->udev->dev, 1806 dev_err(&dev->udev->dev,
diff --git a/drivers/media/video/saa5246a.c b/drivers/media/video/saa5246a.c
index 5f5aa2063e0e..0178b49da0c1 100644
--- a/drivers/media/video/saa5246a.c
+++ b/drivers/media/video/saa5246a.c
@@ -117,7 +117,7 @@ static int saa5246a_attach(struct i2c_adapter *adap, int addr, int kind)
117 memset(t->pgbuf[pgbuf], ' ', sizeof(t->pgbuf[0])); 117 memset(t->pgbuf[pgbuf], ' ', sizeof(t->pgbuf[0]));
118 t->is_searching[pgbuf] = false; 118 t->is_searching[pgbuf] = false;
119 } 119 }
120 vd->priv=t; 120 video_set_drvdata(vd, t);
121 121
122 122
123 /* 123 /*
@@ -151,7 +151,7 @@ static int saa5246a_detach(struct i2c_client *client)
151 struct video_device *vd = i2c_get_clientdata(client); 151 struct video_device *vd = i2c_get_clientdata(client);
152 i2c_detach_client(client); 152 i2c_detach_client(client);
153 video_unregister_device(vd); 153 video_unregister_device(vd);
154 kfree(vd->priv); 154 kfree(video_get_drvdata(vd));
155 kfree(client); 155 kfree(client);
156 return 0; 156 return 0;
157} 157}
@@ -582,7 +582,8 @@ static int do_saa5246a_ioctl(struct inode *inode, struct file *file,
582 unsigned int cmd, void *arg) 582 unsigned int cmd, void *arg)
583{ 583{
584 struct video_device *vd = video_devdata(file); 584 struct video_device *vd = video_devdata(file);
585 struct saa5246a_device *t=vd->priv; 585 struct saa5246a_device *t = video_get_drvdata(vd);
586
586 switch(cmd) 587 switch(cmd)
587 { 588 {
588 case VTXIOCGETINFO: 589 case VTXIOCGETINFO:
@@ -723,7 +724,7 @@ static int saa5246a_ioctl(struct inode *inode, struct file *file,
723 unsigned int cmd, unsigned long arg) 724 unsigned int cmd, unsigned long arg)
724{ 725{
725 struct video_device *vd = video_devdata(file); 726 struct video_device *vd = video_devdata(file);
726 struct saa5246a_device *t = vd->priv; 727 struct saa5246a_device *t = video_get_drvdata(vd);
727 int err; 728 int err;
728 729
729 cmd = vtx_fix_command(cmd); 730 cmd = vtx_fix_command(cmd);
@@ -736,7 +737,7 @@ static int saa5246a_ioctl(struct inode *inode, struct file *file,
736static int saa5246a_open(struct inode *inode, struct file *file) 737static int saa5246a_open(struct inode *inode, struct file *file)
737{ 738{
738 struct video_device *vd = video_devdata(file); 739 struct video_device *vd = video_devdata(file);
739 struct saa5246a_device *t = vd->priv; 740 struct saa5246a_device *t = video_get_drvdata(vd);
740 741
741 if (t->client == NULL) 742 if (t->client == NULL)
742 return -ENODEV; 743 return -ENODEV;
@@ -779,7 +780,7 @@ static int saa5246a_open(struct inode *inode, struct file *file)
779static int saa5246a_release(struct inode *inode, struct file *file) 780static int saa5246a_release(struct inode *inode, struct file *file)
780{ 781{
781 struct video_device *vd = video_devdata(file); 782 struct video_device *vd = video_devdata(file);
782 struct saa5246a_device *t = vd->priv; 783 struct saa5246a_device *t = video_get_drvdata(vd);
783 784
784 /* Stop all acquisition circuits. */ 785 /* Stop all acquisition circuits. */
785 i2c_senddata(t, SAA5246A_REGISTER_R1, 786 i2c_senddata(t, SAA5246A_REGISTER_R1,
diff --git a/drivers/media/video/saa5249.c b/drivers/media/video/saa5249.c
index 225117c789ca..c784715a0b04 100644
--- a/drivers/media/video/saa5249.c
+++ b/drivers/media/video/saa5249.c
@@ -186,7 +186,7 @@ static int saa5249_attach(struct i2c_adapter *adap, int addr, int kind)
186 t->vdau[pgbuf].stopped = true; 186 t->vdau[pgbuf].stopped = true;
187 t->is_searching[pgbuf] = false; 187 t->is_searching[pgbuf] = false;
188 } 188 }
189 vd->priv=t; 189 video_set_drvdata(vd, t);
190 190
191 191
192 /* 192 /*
@@ -221,7 +221,7 @@ static int saa5249_detach(struct i2c_client *client)
221 struct video_device *vd = i2c_get_clientdata(client); 221 struct video_device *vd = i2c_get_clientdata(client);
222 i2c_detach_client(client); 222 i2c_detach_client(client);
223 video_unregister_device(vd); 223 video_unregister_device(vd);
224 kfree(vd->priv); 224 kfree(video_get_drvdata(vd));
225 kfree(vd); 225 kfree(vd);
226 kfree(client); 226 kfree(client);
227 return 0; 227 return 0;
@@ -320,7 +320,7 @@ static int do_saa5249_ioctl(struct inode *inode, struct file *file,
320{ 320{
321 static int virtual_mode = false; 321 static int virtual_mode = false;
322 struct video_device *vd = video_devdata(file); 322 struct video_device *vd = video_devdata(file);
323 struct saa5249_device *t=vd->priv; 323 struct saa5249_device *t = video_get_drvdata(vd);
324 324
325 switch(cmd) 325 switch(cmd)
326 { 326 {
@@ -619,7 +619,7 @@ static int saa5249_ioctl(struct inode *inode, struct file *file,
619 unsigned int cmd, unsigned long arg) 619 unsigned int cmd, unsigned long arg)
620{ 620{
621 struct video_device *vd = video_devdata(file); 621 struct video_device *vd = video_devdata(file);
622 struct saa5249_device *t=vd->priv; 622 struct saa5249_device *t = video_get_drvdata(vd);
623 int err; 623 int err;
624 624
625 cmd = vtx_fix_command(cmd); 625 cmd = vtx_fix_command(cmd);
@@ -632,7 +632,7 @@ static int saa5249_ioctl(struct inode *inode, struct file *file,
632static int saa5249_open(struct inode *inode, struct file *file) 632static int saa5249_open(struct inode *inode, struct file *file)
633{ 633{
634 struct video_device *vd = video_devdata(file); 634 struct video_device *vd = video_devdata(file);
635 struct saa5249_device *t = vd->priv; 635 struct saa5249_device *t = video_get_drvdata(vd);
636 int pgbuf; 636 int pgbuf;
637 637
638 if (t->client == NULL) 638 if (t->client == NULL)
@@ -670,7 +670,7 @@ static int saa5249_open(struct inode *inode, struct file *file)
670static int saa5249_release(struct inode *inode, struct file *file) 670static int saa5249_release(struct inode *inode, struct file *file)
671{ 671{
672 struct video_device *vd = video_devdata(file); 672 struct video_device *vd = video_devdata(file);
673 struct saa5249_device *t = vd->priv; 673 struct saa5249_device *t = video_get_drvdata(vd);
674 674
675 i2c_senddata(t, 1, 0x20, -1); /* Turn off CCT */ 675 i2c_senddata(t, 1, 0x20, -1); /* Turn off CCT */
676 i2c_senddata(t, 5, 3, 3, -1); /* Turn off TV-display */ 676 i2c_senddata(t, 5, 3, 3, -1); /* Turn off TV-display */
diff --git a/drivers/media/video/stk-webcam.c b/drivers/media/video/stk-webcam.c
index 6b1ef5dc562c..8dda5680094d 100644
--- a/drivers/media/video/stk-webcam.c
+++ b/drivers/media/video/stk-webcam.c
@@ -72,7 +72,7 @@ static void stk_camera_cleanup(struct kref *kref)
72 STK_INFO("Syntek USB2.0 Camera release resources" 72 STK_INFO("Syntek USB2.0 Camera release resources"
73 " video device /dev/video%d\n", dev->vdev.minor); 73 " video device /dev/video%d\n", dev->vdev.minor);
74 video_unregister_device(&dev->vdev); 74 video_unregister_device(&dev->vdev);
75 dev->vdev.priv = NULL; 75 video_set_drvdata(&dev->vdev, NULL);
76 76
77 if (dev->sio_bufs != NULL || dev->isobufs != NULL) 77 if (dev->sio_bufs != NULL || dev->isobufs != NULL)
78 STK_ERROR("We are leaking memory\n"); 78 STK_ERROR("We are leaking memory\n");
@@ -1379,7 +1379,7 @@ static int stk_register_video_device(struct stk_camera *dev)
1379 dev->vdev = stk_v4l_data; 1379 dev->vdev = stk_v4l_data;
1380 dev->vdev.debug = debug; 1380 dev->vdev.debug = debug;
1381 dev->vdev.parent = &dev->interface->dev; 1381 dev->vdev.parent = &dev->interface->dev;
1382 dev->vdev.priv = dev; 1382 video_set_drvdata(&dev->vdev, dev);
1383 err = video_register_device(&dev->vdev, VFL_TYPE_GRABBER, -1); 1383 err = video_register_device(&dev->vdev, VFL_TYPE_GRABBER, -1);
1384 if (err) 1384 if (err)
1385 STK_ERROR("v4l registration failed\n"); 1385 STK_ERROR("v4l registration failed\n");
diff --git a/drivers/media/video/usbvideo/vicam.c b/drivers/media/video/usbvideo/vicam.c
index d7728256f295..1ffcc393fcbb 100644
--- a/drivers/media/video/usbvideo/vicam.c
+++ b/drivers/media/video/usbvideo/vicam.c
@@ -473,8 +473,8 @@ static int
473vicam_open(struct inode *inode, struct file *file) 473vicam_open(struct inode *inode, struct file *file)
474{ 474{
475 struct video_device *dev = video_devdata(file); 475 struct video_device *dev = video_devdata(file);
476 struct vicam_camera *cam = 476 struct vicam_camera *cam = video_get_drvdata(dev);
477 (struct vicam_camera *) dev->priv; 477
478 DBG("open\n"); 478 DBG("open\n");
479 479
480 if (!cam) { 480 if (!cam) {
@@ -866,9 +866,8 @@ vicam_probe( struct usb_interface *intf, const struct usb_device_id *id)
866 866
867 mutex_init(&cam->cam_lock); 867 mutex_init(&cam->cam_lock);
868 868
869 memcpy(&cam->vdev, &vicam_template, 869 memcpy(&cam->vdev, &vicam_template, sizeof(vicam_template));
870 sizeof (vicam_template)); 870 video_set_drvdata(&cam->vdev, cam);
871 cam->vdev.priv = cam; // sort of a reverse mapping for those functions that get vdev only
872 871
873 cam->udev = dev; 872 cam->udev = dev;
874 cam->bulkEndpoint = bulkEndpoint; 873 cam->bulkEndpoint = bulkEndpoint;
diff --git a/drivers/media/video/w9966.c b/drivers/media/video/w9966.c
index e3580119640f..14ebb15837fb 100644
--- a/drivers/media/video/w9966.c
+++ b/drivers/media/video/w9966.c
@@ -188,7 +188,7 @@ static ssize_t w9966_v4l_read(struct file *file, char __user *buf,
188static int w9966_exclusive_open(struct inode *inode, struct file *file) 188static int w9966_exclusive_open(struct inode *inode, struct file *file)
189{ 189{
190 struct video_device *vdev = video_devdata(file); 190 struct video_device *vdev = video_devdata(file);
191 struct w9966_dev *cam = vdev->priv; 191 struct w9966_dev *cam = video_get_drvdata(vdev);
192 192
193 return test_and_set_bit(0, &cam->in_use) ? -EBUSY : 0; 193 return test_and_set_bit(0, &cam->in_use) ? -EBUSY : 0;
194} 194}
@@ -196,7 +196,7 @@ static int w9966_exclusive_open(struct inode *inode, struct file *file)
196static int w9966_exclusive_release(struct inode *inode, struct file *file) 196static int w9966_exclusive_release(struct inode *inode, struct file *file)
197{ 197{
198 struct video_device *vdev = video_devdata(file); 198 struct video_device *vdev = video_devdata(file);
199 struct w9966_dev *cam = vdev->priv; 199 struct w9966_dev *cam = video_get_drvdata(vdev);
200 200
201 clear_bit(0, &cam->in_use); 201 clear_bit(0, &cam->in_use);
202 return 0; 202 return 0;
@@ -351,7 +351,7 @@ static int w9966_init(struct w9966_dev* cam, struct parport* port)
351 351
352// Fill in the video_device struct and register us to v4l 352// Fill in the video_device struct and register us to v4l
353 memcpy(&cam->vdev, &w9966_template, sizeof(struct video_device)); 353 memcpy(&cam->vdev, &w9966_template, sizeof(struct video_device));
354 cam->vdev.priv = cam; 354 video_set_drvdata(&cam->vdev, cam);
355 355
356 if (video_register_device(&cam->vdev, VFL_TYPE_GRABBER, video_nr) < 0) 356 if (video_register_device(&cam->vdev, VFL_TYPE_GRABBER, video_nr) < 0)
357 return -1; 357 return -1;
@@ -733,7 +733,7 @@ static int w9966_v4l_do_ioctl(struct inode *inode, struct file *file,
733 unsigned int cmd, void *arg) 733 unsigned int cmd, void *arg)
734{ 734{
735 struct video_device *vdev = video_devdata(file); 735 struct video_device *vdev = video_devdata(file);
736 struct w9966_dev *cam = vdev->priv; 736 struct w9966_dev *cam = video_get_drvdata(vdev);
737 737
738 switch(cmd) 738 switch(cmd)
739 { 739 {
@@ -892,7 +892,7 @@ static ssize_t w9966_v4l_read(struct file *file, char __user *buf,
892 size_t count, loff_t *ppos) 892 size_t count, loff_t *ppos)
893{ 893{
894 struct video_device *vdev = video_devdata(file); 894 struct video_device *vdev = video_devdata(file);
895 struct w9966_dev *cam = vdev->priv; 895 struct w9966_dev *cam = video_get_drvdata(vdev);
896 unsigned char addr = 0xa0; // ECP, read, CCD-transfer, 00000 896 unsigned char addr = 0xa0; // ECP, read, CCD-transfer, 00000
897 unsigned char __user *dest = (unsigned char __user *)buf; 897 unsigned char __user *dest = (unsigned char __user *)buf;
898 unsigned long dleft = count; 898 unsigned long dleft = count;
diff --git a/include/media/v4l2-dev.h b/include/media/v4l2-dev.h
index 23df00919ae8..1d4df571060b 100644
--- a/include/media/v4l2-dev.h
+++ b/include/media/v4l2-dev.h
@@ -69,14 +69,6 @@ struct video_device
69 69
70 /* ioctl callbacks */ 70 /* ioctl callbacks */
71 const struct v4l2_ioctl_ops *ioctl_ops; 71 const struct v4l2_ioctl_ops *ioctl_ops;
72
73#ifdef OBSOLETE_DEVDATA /* to be removed soon */
74 /* dev->driver_data will be used instead some day.
75 * Use the video_{get|set}_drvdata() helper functions,
76 * so the switch over will be transparent for you.
77 * Or use {pci|usb}_{get|set}_drvdata() directly. */
78 void *priv;
79#endif
80}; 72};
81 73
82/* Class-dev to video-device */ 74/* Class-dev to video-device */
@@ -98,18 +90,18 @@ void video_device_release(struct video_device *vfd);
98 a dubious construction at best. */ 90 a dubious construction at best. */
99void video_device_release_empty(struct video_device *vfd); 91void video_device_release_empty(struct video_device *vfd);
100 92
101#ifdef OBSOLETE_DEVDATA /* to be removed soon */
102/* helper functions to access driver private data. */ 93/* helper functions to access driver private data. */
103static inline void *video_get_drvdata(struct video_device *dev) 94static inline void *video_get_drvdata(struct video_device *dev)
104{ 95{
105 return dev->priv; 96 return dev_get_drvdata(&dev->dev);
106} 97}
107 98
108static inline void video_set_drvdata(struct video_device *dev, void *data) 99static inline void video_set_drvdata(struct video_device *dev, void *data)
109{ 100{
110 dev->priv = data; 101 dev_set_drvdata(&dev->dev, data);
111} 102}
112 103
104#ifdef OBSOLETE_DEVDATA /* to be removed soon */
113/* Obsolete stuff - Still needed for radio devices and obsolete drivers */ 105/* Obsolete stuff - Still needed for radio devices and obsolete drivers */
114extern struct video_device* video_devdata(struct file*); 106extern struct video_device* video_devdata(struct file*);
115#endif 107#endif