summaryrefslogtreecommitdiff
path: root/linux/drivers/media/video/em28xx/em28xx-video.c
diff options
context:
space:
mode:
Diffstat (limited to 'linux/drivers/media/video/em28xx/em28xx-video.c')
-rw-r--r--linux/drivers/media/video/em28xx/em28xx-video.c62
1 files changed, 16 insertions, 46 deletions
diff --git a/linux/drivers/media/video/em28xx/em28xx-video.c b/linux/drivers/media/video/em28xx/em28xx-video.c
index 9e7965a32..5929d0860 100644
--- a/linux/drivers/media/video/em28xx/em28xx-video.c
+++ b/linux/drivers/media/video/em28xx/em28xx-video.c
@@ -42,9 +42,6 @@
#include <media/v4l2-common.h>
#include <media/msp3400.h>
#include <media/tuner.h>
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 5, 0)
-#include "i2c-compat.h"
-#endif
#define DRIVER_AUTHOR "Ludovico Cavedon <cavedon@sssup.it>, " \
"Markus Rechberger <mrechberger@gmail.com>, " \
@@ -83,25 +80,10 @@ static unsigned int video_nr[] = {[0 ... (EM28XX_MAXBOARDS - 1)] = UNSET };
static unsigned int vbi_nr[] = {[0 ... (EM28XX_MAXBOARDS - 1)] = UNSET };
static unsigned int radio_nr[] = {[0 ... (EM28XX_MAXBOARDS - 1)] = UNSET };
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 5, 0)
-MODULE_PARM(card, "1-" __stringify(EM28XX_MAXBOARDS) "i");
-MODULE_PARM(video_nr, "1-" __stringify(EM28XX_MAXBOARDS) "i");
-MODULE_PARM(vbi_nr, "1-" __stringify(EM28XX_MAXBOARDS) "i");
-MODULE_PARM(radio_nr, "1-" __stringify(EM28XX_MAXBOARDS) "i");
-#else
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 10)
-static int dummy;
-module_param_array(card, int, dummy, 0444);
-module_param_array(video_nr, int, dummy, 0444);
-module_param_array(vbi_nr, int, dummy, 0444);
-module_param_array(radio_nr, int, dummy, 0444);
-#else
module_param_array(card, int, NULL, 0444);
module_param_array(video_nr, int, NULL, 0444);
module_param_array(vbi_nr, int, NULL, 0444);
module_param_array(radio_nr, int, NULL, 0444);
-#endif
-#endif
MODULE_PARM_DESC(card, "card type");
MODULE_PARM_DESC(video_nr, "video device numbers");
MODULE_PARM_DESC(vbi_nr, "vbi device numbers");
@@ -1192,13 +1174,13 @@ static int vidioc_g_register(struct file *file, void *priv,
reg->val = ret;
} else {
- u64 val = 0;
+ __le64 val = 0;
ret = em28xx_read_reg_req_len(dev, USB_REQ_GET_STATUS,
reg->reg, (char *)&val, 2);
if (ret < 0)
return ret;
- reg->val = cpu_to_le64((__u64)val);
+ reg->val = le64_to_cpu(val);
}
return 0;
@@ -1209,9 +1191,9 @@ static int vidioc_s_register(struct file *file, void *priv,
{
struct em28xx_fh *fh = priv;
struct em28xx *dev = fh->dev;
- u64 buf;
+ __le64 buf;
- buf = le64_to_cpu((__u64)reg->val);
+ buf = cpu_to_le64(reg->val);
return em28xx_write_regs(dev, reg->reg, (char *)&buf,
em28xx_reg_len(reg->reg));
@@ -1667,6 +1649,8 @@ static void em28xx_release_resources(struct em28xx *dev)
dev->vdev->minor-MINOR_VFL_TYPE_GRABBER_MIN,
dev->vbi_dev->minor-MINOR_VFL_TYPE_VBI_MIN);
list_del(&dev->devlist);
+ if (dev->sbutton_input_dev)
+ em28xx_deregister_snapshot_button(dev);
if (dev->radio_dev) {
if (-1 != dev->radio_dev->minor)
video_unregister_device(dev->radio_dev);
@@ -1835,9 +1819,7 @@ static const struct file_operations em28xx_v4l_fops = {
.mmap = em28xx_v4l2_mmap,
.ioctl = video_ioctl2,
.llseek = no_llseek,
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 11)
.compat_ioctl = v4l_compat_ioctl32,
-#endif
};
static const struct file_operations radio_fops = {
@@ -1845,9 +1827,7 @@ static const struct file_operations radio_fops = {
.open = em28xx_v4l2_open,
.release = em28xx_v4l2_close,
.ioctl = video_ioctl2,
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 11)
.compat_ioctl = v4l_compat_ioctl32,
-#endif
.llseek = no_llseek,
};
@@ -1934,32 +1914,28 @@ static DEFINE_MUTEX(em28xx_extension_devlist_lock);
int em28xx_register_extension(struct em28xx_ops *ops)
{
- struct em28xx *h, *dev = NULL;
-
- list_for_each_entry(h, &em28xx_devlist, devlist)
- dev = h;
+ struct em28xx *dev = NULL;
mutex_lock(&em28xx_extension_devlist_lock);
list_add_tail(&ops->next, &em28xx_extension_devlist);
- if (dev)
- ops->init(dev);
-
+ list_for_each_entry(dev, &em28xx_devlist, devlist) {
+ if (dev)
+ ops->init(dev);
+ }
printk(KERN_INFO "Em28xx: Initialized (%s) extension\n", ops->name);
mutex_unlock(&em28xx_extension_devlist_lock);
-
return 0;
}
EXPORT_SYMBOL(em28xx_register_extension);
void em28xx_unregister_extension(struct em28xx_ops *ops)
{
- struct em28xx *h, *dev = NULL;
-
- list_for_each_entry(h, &em28xx_devlist, devlist)
- dev = h;
+ struct em28xx *dev = NULL;
- if (dev)
- ops->fini(dev);
+ list_for_each_entry(dev, &em28xx_devlist, devlist) {
+ if (dev)
+ ops->fini(dev);
+ }
mutex_lock(&em28xx_extension_devlist_lock);
printk(KERN_INFO "Em28xx: Removed (%s) extension\n", ops->name);
@@ -1980,10 +1956,8 @@ static struct video_device *em28xx_vdev_init(struct em28xx *dev,
return NULL;
*vfd = *template;
vfd->minor = -1;
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 5, 0)
vfd->dev = &dev->udev->dev;
vfd->release = video_device_release;
-#endif
vfd->type = type;
vfd->debug = video_debug;
@@ -2169,9 +2143,6 @@ static void request_module_async(struct work_struct *work)
request_module("em28xx-dvb");
}
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 5, 0)
-#define request_modules(dev)
-#else
static void request_modules(struct em28xx *dev)
{
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 20)
@@ -2182,7 +2153,6 @@ static void request_modules(struct em28xx *dev)
#endif
schedule_work(&dev->request_module_wk);
}
-#endif
#else
#define request_modules(dev)
#endif /* CONFIG_MODULES */