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/media/video/saa7134 | |
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/media/video/saa7134')
-rw-r--r-- | drivers/media/video/saa7134/saa7134-core.c | 1 | ||||
-rw-r--r-- | drivers/media/video/saa7134/saa7134-empress.c | 11 | ||||
-rw-r--r-- | drivers/media/video/saa7134/saa7134-video.c | 32 |
3 files changed, 16 insertions, 28 deletions
diff --git a/drivers/media/video/saa7134/saa7134-core.c b/drivers/media/video/saa7134/saa7134-core.c index b910df94ed72..9f85e917f9f3 100644 --- a/drivers/media/video/saa7134/saa7134-core.c +++ b/drivers/media/video/saa7134/saa7134-core.c | |||
@@ -797,6 +797,7 @@ static struct video_device *vdev_init(struct saa7134_dev *dev, | |||
797 | vfd->debug = video_debug; | 797 | vfd->debug = video_debug; |
798 | snprintf(vfd->name, sizeof(vfd->name), "%s %s (%s)", | 798 | snprintf(vfd->name, sizeof(vfd->name), "%s %s (%s)", |
799 | dev->name, type, saa7134_boards[dev->board].name); | 799 | dev->name, type, saa7134_boards[dev->board].name); |
800 | video_set_drvdata(vfd, dev); | ||
800 | return vfd; | 801 | return vfd; |
801 | } | 802 | } |
802 | 803 | ||
diff --git a/drivers/media/video/saa7134/saa7134-empress.c b/drivers/media/video/saa7134/saa7134-empress.c index abc1d0bf5837..1de27af54590 100644 --- a/drivers/media/video/saa7134/saa7134-empress.c +++ b/drivers/media/video/saa7134/saa7134-empress.c | |||
@@ -87,17 +87,9 @@ static int ts_init_encoder(struct saa7134_dev* dev) | |||
87 | static int ts_open(struct file *file) | 87 | static int ts_open(struct file *file) |
88 | { | 88 | { |
89 | int minor = video_devdata(file)->minor; | 89 | int minor = video_devdata(file)->minor; |
90 | struct saa7134_dev *dev; | 90 | struct saa7134_dev *dev = video_drvdata(file); |
91 | int err; | 91 | int err; |
92 | 92 | ||
93 | lock_kernel(); | ||
94 | list_for_each_entry(dev, &saa7134_devlist, devlist) | ||
95 | if (dev->empress_dev && dev->empress_dev->minor == minor) | ||
96 | goto found; | ||
97 | unlock_kernel(); | ||
98 | return -ENODEV; | ||
99 | found: | ||
100 | |||
101 | dprintk("open minor=%d\n",minor); | 93 | dprintk("open minor=%d\n",minor); |
102 | err = -EBUSY; | 94 | err = -EBUSY; |
103 | if (!mutex_trylock(&dev->empress_tsq.vb_lock)) | 95 | if (!mutex_trylock(&dev->empress_tsq.vb_lock)) |
@@ -531,6 +523,7 @@ static int empress_init(struct saa7134_dev *dev) | |||
531 | 523 | ||
532 | INIT_WORK(&dev->empress_workqueue, empress_signal_update); | 524 | INIT_WORK(&dev->empress_workqueue, empress_signal_update); |
533 | 525 | ||
526 | video_set_drvdata(dev->empress_dev, dev); | ||
534 | err = video_register_device(dev->empress_dev,VFL_TYPE_GRABBER, | 527 | err = video_register_device(dev->empress_dev,VFL_TYPE_GRABBER, |
535 | empress_nr[dev->nr]); | 528 | empress_nr[dev->nr]); |
536 | if (err < 0) { | 529 | if (err < 0) { |
diff --git a/drivers/media/video/saa7134/saa7134-video.c b/drivers/media/video/saa7134/saa7134-video.c index 35f8daa3a359..bcca5a479817 100644 --- a/drivers/media/video/saa7134/saa7134-video.c +++ b/drivers/media/video/saa7134/saa7134-video.c | |||
@@ -1327,29 +1327,23 @@ static int saa7134_resource(struct saa7134_fh *fh) | |||
1327 | static int video_open(struct file *file) | 1327 | static int video_open(struct file *file) |
1328 | { | 1328 | { |
1329 | int minor = video_devdata(file)->minor; | 1329 | int minor = video_devdata(file)->minor; |
1330 | struct saa7134_dev *dev; | 1330 | struct video_device *vdev = video_devdata(file); |
1331 | struct saa7134_dev *dev = video_drvdata(file); | ||
1331 | struct saa7134_fh *fh; | 1332 | struct saa7134_fh *fh; |
1332 | enum v4l2_buf_type type = V4L2_BUF_TYPE_VIDEO_CAPTURE; | 1333 | enum v4l2_buf_type type = 0; |
1333 | int radio = 0; | 1334 | int radio = 0; |
1334 | 1335 | ||
1335 | mutex_lock(&saa7134_devlist_lock); | 1336 | switch (vdev->vfl_type) { |
1336 | list_for_each_entry(dev, &saa7134_devlist, devlist) { | 1337 | case VFL_TYPE_GRABBER: |
1337 | if (dev->video_dev && (dev->video_dev->minor == minor)) | 1338 | type = V4L2_BUF_TYPE_VIDEO_CAPTURE; |
1338 | goto found; | 1339 | break; |
1339 | if (dev->radio_dev && (dev->radio_dev->minor == minor)) { | 1340 | case VFL_TYPE_VBI: |
1340 | radio = 1; | 1341 | type = V4L2_BUF_TYPE_VBI_CAPTURE; |
1341 | goto found; | 1342 | break; |
1342 | } | 1343 | case VFL_TYPE_RADIO: |
1343 | if (dev->vbi_dev && (dev->vbi_dev->minor == minor)) { | 1344 | radio = 1; |
1344 | type = V4L2_BUF_TYPE_VBI_CAPTURE; | 1345 | break; |
1345 | goto found; | ||
1346 | } | ||
1347 | } | 1346 | } |
1348 | mutex_unlock(&saa7134_devlist_lock); | ||
1349 | return -ENODEV; | ||
1350 | |||
1351 | found: | ||
1352 | mutex_unlock(&saa7134_devlist_lock); | ||
1353 | 1347 | ||
1354 | dprintk("open minor=%d radio=%d type=%s\n",minor,radio, | 1348 | dprintk("open minor=%d radio=%d type=%s\n",minor,radio, |
1355 | v4l2_type_names[type]); | 1349 | v4l2_type_names[type]); |