diff options
author | Mauro Carvalho Chehab <mchehab@redhat.com> | 2010-05-18 03:27:27 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2010-05-19 11:59:18 -0400 |
commit | e8d0416796d43a950ec7b65629e53419b2e22453 (patch) | |
tree | 1d2e4d49dc177f0f711ab4f9ad11cb67007964cb /drivers | |
parent | 6b46c3977cdb34a199bbca20ef67b1e13335c43d (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: patch broke into two. This one changes just tm6000]
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/staging/tm6000/tm6000-cards.c | 1 | ||||
-rw-r--r-- | drivers/staging/tm6000/tm6000-video.c | 28 | ||||
-rw-r--r-- | drivers/staging/tm6000/tm6000.h | 1 |
3 files changed, 2 insertions, 28 deletions
diff --git a/drivers/staging/tm6000/tm6000-cards.c b/drivers/staging/tm6000/tm6000-cards.c index 160b4d714898..6143e20d139d 100644 --- a/drivers/staging/tm6000/tm6000-cards.c +++ b/drivers/staging/tm6000/tm6000-cards.c | |||
@@ -791,7 +791,6 @@ static int tm6000_usb_probe(struct usb_interface *interface, | |||
791 | if ((card[nr] >= 0) && (card[nr] < ARRAY_SIZE(tm6000_boards))) | 791 | if ((card[nr] >= 0) && (card[nr] < ARRAY_SIZE(tm6000_boards))) |
792 | dev->model = card[nr]; | 792 | dev->model = card[nr]; |
793 | 793 | ||
794 | INIT_LIST_HEAD(&dev->tm6000_corelist); | ||
795 | dev->udev = usbdev; | 794 | dev->udev = usbdev; |
796 | dev->devno = nr; | 795 | dev->devno = nr; |
797 | 796 | ||
diff --git a/drivers/staging/tm6000/tm6000-video.c b/drivers/staging/tm6000/tm6000-video.c index 7828030c4f33..f2b7fe4a3581 100644 --- a/drivers/staging/tm6000/tm6000-video.c +++ b/drivers/staging/tm6000/tm6000-video.c | |||
@@ -116,8 +116,6 @@ static struct tm6000_fmt format[] = { | |||
116 | } | 116 | } |
117 | }; | 117 | }; |
118 | 118 | ||
119 | static LIST_HEAD(tm6000_corelist); | ||
120 | |||
121 | /* ------------------------------------------------------------------ | 119 | /* ------------------------------------------------------------------ |
122 | DMA and thread functions | 120 | DMA and thread functions |
123 | ------------------------------------------------------------------*/ | 121 | ------------------------------------------------------------------*/ |
@@ -1321,8 +1319,7 @@ static int tm6000_open(struct file *file) | |||
1321 | struct video_device *vdev = video_devdata(file); | 1319 | struct video_device *vdev = video_devdata(file); |
1322 | struct tm6000_core *dev = video_drvdata(file); | 1320 | struct tm6000_core *dev = video_drvdata(file); |
1323 | struct tm6000_fh *fh; | 1321 | struct tm6000_fh *fh; |
1324 | struct list_head *list; | 1322 | enum v4l2_buf_type type = V4L2_BUF_TYPE_VIDEO_CAPTURE; |
1325 | enum v4l2_buf_type type = 0; | ||
1326 | int i,rc; | 1323 | int i,rc; |
1327 | 1324 | ||
1328 | printk(KERN_INFO "tm6000: open called (dev=%s)\n", | 1325 | printk(KERN_INFO "tm6000: open called (dev=%s)\n", |
@@ -1331,16 +1328,6 @@ static int tm6000_open(struct file *file) | |||
1331 | dprintk(dev, V4L2_DEBUG_OPEN, "tm6000: open called (dev=%s)\n", | 1328 | dprintk(dev, V4L2_DEBUG_OPEN, "tm6000: open called (dev=%s)\n", |
1332 | video_device_node_name(vdev)); | 1329 | video_device_node_name(vdev)); |
1333 | 1330 | ||
1334 | list_for_each(list,&tm6000_corelist) { | ||
1335 | h = list_entry(list, struct tm6000_core, tm6000_corelist); | ||
1336 | if (h->vfd->minor == minor) { | ||
1337 | dev = h; | ||
1338 | type = V4L2_BUF_TYPE_VIDEO_CAPTURE; | ||
1339 | } | ||
1340 | } | ||
1341 | if (NULL == dev) | ||
1342 | return -ENODEV; | ||
1343 | |||
1344 | 1331 | ||
1345 | /* If more than one user, mutex should be added */ | 1332 | /* If more than one user, mutex should be added */ |
1346 | dev->users++; | 1333 | dev->users++; |
@@ -1533,8 +1520,6 @@ int tm6000_v4l2_register(struct tm6000_core *dev) | |||
1533 | } | 1520 | } |
1534 | dev->vfd = vfd; | 1521 | dev->vfd = vfd; |
1535 | 1522 | ||
1536 | list_add_tail(&dev->tm6000_corelist,&tm6000_corelist); | ||
1537 | |||
1538 | /* init video dma queues */ | 1523 | /* init video dma queues */ |
1539 | INIT_LIST_HEAD(&dev->vidq.active); | 1524 | INIT_LIST_HEAD(&dev->vidq.active); |
1540 | INIT_LIST_HEAD(&dev->vidq.queued); | 1525 | INIT_LIST_HEAD(&dev->vidq.queued); |
@@ -1542,6 +1527,7 @@ int tm6000_v4l2_register(struct tm6000_core *dev) | |||
1542 | memcpy (dev->vfd, &tm6000_template, sizeof(*(dev->vfd))); | 1527 | memcpy (dev->vfd, &tm6000_template, sizeof(*(dev->vfd))); |
1543 | dev->vfd->debug=tm6000_debug; | 1528 | dev->vfd->debug=tm6000_debug; |
1544 | vfd->v4l2_dev = &dev->v4l2_dev; | 1529 | vfd->v4l2_dev = &dev->v4l2_dev; |
1530 | video_set_drvdata(vfd, dev); | ||
1545 | 1531 | ||
1546 | ret = video_register_device(dev->vfd, VFL_TYPE_GRABBER, video_nr); | 1532 | ret = video_register_device(dev->vfd, VFL_TYPE_GRABBER, video_nr); |
1547 | printk(KERN_INFO "Trident TVMaster TM5600/TM6000/TM6010 USB2 board (Load status: %d)\n", ret); | 1533 | printk(KERN_INFO "Trident TVMaster TM5600/TM6000/TM6010 USB2 board (Load status: %d)\n", ret); |
@@ -1550,18 +1536,8 @@ int tm6000_v4l2_register(struct tm6000_core *dev) | |||
1550 | 1536 | ||
1551 | int tm6000_v4l2_unregister(struct tm6000_core *dev) | 1537 | int tm6000_v4l2_unregister(struct tm6000_core *dev) |
1552 | { | 1538 | { |
1553 | struct tm6000_core *h; | ||
1554 | struct list_head *pos, *tmp; | ||
1555 | |||
1556 | video_unregister_device(dev->vfd); | 1539 | video_unregister_device(dev->vfd); |
1557 | 1540 | ||
1558 | list_for_each_safe(pos, tmp, &tm6000_corelist) { | ||
1559 | h = list_entry(pos, struct tm6000_core, tm6000_corelist); | ||
1560 | if (h == dev) { | ||
1561 | list_del(pos); | ||
1562 | } | ||
1563 | } | ||
1564 | |||
1565 | return 0; | 1541 | return 0; |
1566 | } | 1542 | } |
1567 | 1543 | ||
diff --git a/drivers/staging/tm6000/tm6000.h b/drivers/staging/tm6000/tm6000.h index b49c139c6b55..6812d6867d57 100644 --- a/drivers/staging/tm6000/tm6000.h +++ b/drivers/staging/tm6000/tm6000.h | |||
@@ -169,7 +169,6 @@ struct tm6000_core { | |||
169 | struct i2c_client i2c_client; | 169 | struct i2c_client i2c_client; |
170 | 170 | ||
171 | /* video for linux */ | 171 | /* video for linux */ |
172 | struct list_head tm6000_corelist; | ||
173 | int users; | 172 | int users; |
174 | 173 | ||
175 | /* various device info */ | 174 | /* various device info */ |