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/em28xx | |
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/em28xx')
-rw-r--r-- | drivers/media/video/em28xx/em28xx-cards.c | 1 | ||||
-rw-r--r-- | drivers/media/video/em28xx/em28xx-core.c | 28 | ||||
-rw-r--r-- | drivers/media/video/em28xx/em28xx-video.c | 23 | ||||
-rw-r--r-- | drivers/media/video/em28xx/em28xx.h | 3 |
4 files changed, 16 insertions, 39 deletions
diff --git a/drivers/media/video/em28xx/em28xx-cards.c b/drivers/media/video/em28xx/em28xx-cards.c index 4ace70946d32..e7a68e2507de 100644 --- a/drivers/media/video/em28xx/em28xx-cards.c +++ b/drivers/media/video/em28xx/em28xx-cards.c | |||
@@ -2653,7 +2653,6 @@ static int em28xx_init_dev(struct em28xx **devhandle, struct usb_device *udev, | |||
2653 | INIT_LIST_HEAD(&dev->vbiq.active); | 2653 | INIT_LIST_HEAD(&dev->vbiq.active); |
2654 | INIT_LIST_HEAD(&dev->vbiq.queued); | 2654 | INIT_LIST_HEAD(&dev->vbiq.queued); |
2655 | 2655 | ||
2656 | |||
2657 | if (dev->board.has_msp34xx) { | 2656 | if (dev->board.has_msp34xx) { |
2658 | /* Send a reset to other chips via gpio */ | 2657 | /* Send a reset to other chips via gpio */ |
2659 | errCode = em28xx_write_reg(dev, EM28XX_R08_GPIO, 0xf7); | 2658 | errCode = em28xx_write_reg(dev, EM28XX_R08_GPIO, 0xf7); |
diff --git a/drivers/media/video/em28xx/em28xx-core.c b/drivers/media/video/em28xx/em28xx-core.c index 4f61e05d30b4..b311d4514bdf 100644 --- a/drivers/media/video/em28xx/em28xx-core.c +++ b/drivers/media/video/em28xx/em28xx-core.c | |||
@@ -1136,34 +1136,6 @@ void em28xx_wake_i2c(struct em28xx *dev) | |||
1136 | static LIST_HEAD(em28xx_devlist); | 1136 | static LIST_HEAD(em28xx_devlist); |
1137 | static DEFINE_MUTEX(em28xx_devlist_mutex); | 1137 | static DEFINE_MUTEX(em28xx_devlist_mutex); |
1138 | 1138 | ||
1139 | struct em28xx *em28xx_get_device(int minor, | ||
1140 | enum v4l2_buf_type *fh_type, | ||
1141 | int *has_radio) | ||
1142 | { | ||
1143 | struct em28xx *h, *dev = NULL; | ||
1144 | |||
1145 | *fh_type = V4L2_BUF_TYPE_VIDEO_CAPTURE; | ||
1146 | *has_radio = 0; | ||
1147 | |||
1148 | mutex_lock(&em28xx_devlist_mutex); | ||
1149 | list_for_each_entry(h, &em28xx_devlist, devlist) { | ||
1150 | if (h->vdev->minor == minor) | ||
1151 | dev = h; | ||
1152 | if (h->vbi_dev && h->vbi_dev->minor == minor) { | ||
1153 | dev = h; | ||
1154 | *fh_type = V4L2_BUF_TYPE_VBI_CAPTURE; | ||
1155 | } | ||
1156 | if (h->radio_dev && | ||
1157 | h->radio_dev->minor == minor) { | ||
1158 | dev = h; | ||
1159 | *has_radio = 1; | ||
1160 | } | ||
1161 | } | ||
1162 | mutex_unlock(&em28xx_devlist_mutex); | ||
1163 | |||
1164 | return dev; | ||
1165 | } | ||
1166 | |||
1167 | /* | 1139 | /* |
1168 | * em28xx_realease_resources() | 1140 | * em28xx_realease_resources() |
1169 | * unregisters the v4l2,i2c and usb devices | 1141 | * unregisters the v4l2,i2c and usb devices |
diff --git a/drivers/media/video/em28xx/em28xx-video.c b/drivers/media/video/em28xx/em28xx-video.c index 9a8ff32cb31b..dd9bbe88c601 100644 --- a/drivers/media/video/em28xx/em28xx-video.c +++ b/drivers/media/video/em28xx/em28xx-video.c | |||
@@ -2082,16 +2082,24 @@ static int radio_queryctrl(struct file *file, void *priv, | |||
2082 | static int em28xx_v4l2_open(struct file *filp) | 2082 | static int em28xx_v4l2_open(struct file *filp) |
2083 | { | 2083 | { |
2084 | int minor = video_devdata(filp)->minor; | 2084 | int minor = video_devdata(filp)->minor; |
2085 | int errCode = 0, radio; | 2085 | int errCode = 0, radio = 0; |
2086 | struct em28xx *dev; | 2086 | struct video_device *vdev = video_devdata(filp); |
2087 | enum v4l2_buf_type fh_type; | 2087 | struct em28xx *dev = video_drvdata(filp); |
2088 | enum v4l2_buf_type fh_type = 0; | ||
2088 | struct em28xx_fh *fh; | 2089 | struct em28xx_fh *fh; |
2089 | enum v4l2_field field; | 2090 | enum v4l2_field field; |
2090 | 2091 | ||
2091 | dev = em28xx_get_device(minor, &fh_type, &radio); | 2092 | switch (vdev->vfl_type) { |
2092 | 2093 | case VFL_TYPE_GRABBER: | |
2093 | if (NULL == dev) | 2094 | fh_type = V4L2_BUF_TYPE_VIDEO_CAPTURE; |
2094 | return -ENODEV; | 2095 | break; |
2096 | case VFL_TYPE_VBI: | ||
2097 | fh_type = V4L2_BUF_TYPE_VBI_CAPTURE; | ||
2098 | break; | ||
2099 | case VFL_TYPE_RADIO: | ||
2100 | radio = 1; | ||
2101 | break; | ||
2102 | } | ||
2095 | 2103 | ||
2096 | mutex_lock(&dev->lock); | 2104 | mutex_lock(&dev->lock); |
2097 | 2105 | ||
@@ -2459,6 +2467,7 @@ static struct video_device *em28xx_vdev_init(struct em28xx *dev, | |||
2459 | snprintf(vfd->name, sizeof(vfd->name), "%s %s", | 2467 | snprintf(vfd->name, sizeof(vfd->name), "%s %s", |
2460 | dev->name, type_name); | 2468 | dev->name, type_name); |
2461 | 2469 | ||
2470 | video_set_drvdata(vfd, dev); | ||
2462 | return vfd; | 2471 | return vfd; |
2463 | } | 2472 | } |
2464 | 2473 | ||
diff --git a/drivers/media/video/em28xx/em28xx.h b/drivers/media/video/em28xx/em28xx.h index 48977832316e..80d9b4fa1b97 100644 --- a/drivers/media/video/em28xx/em28xx.h +++ b/drivers/media/video/em28xx/em28xx.h | |||
@@ -668,9 +668,6 @@ int em28xx_gpio_set(struct em28xx *dev, struct em28xx_reg_seq *gpio); | |||
668 | void em28xx_wake_i2c(struct em28xx *dev); | 668 | void em28xx_wake_i2c(struct em28xx *dev); |
669 | void em28xx_remove_from_devlist(struct em28xx *dev); | 669 | void em28xx_remove_from_devlist(struct em28xx *dev); |
670 | void em28xx_add_into_devlist(struct em28xx *dev); | 670 | void em28xx_add_into_devlist(struct em28xx *dev); |
671 | struct em28xx *em28xx_get_device(int minor, | ||
672 | enum v4l2_buf_type *fh_type, | ||
673 | int *has_radio); | ||
674 | int em28xx_register_extension(struct em28xx_ops *dev); | 671 | int em28xx_register_extension(struct em28xx_ops *dev); |
675 | void em28xx_unregister_extension(struct em28xx_ops *dev); | 672 | void em28xx_unregister_extension(struct em28xx_ops *dev); |
676 | void em28xx_init_extension(struct em28xx *dev); | 673 | void em28xx_init_extension(struct em28xx *dev); |