aboutsummaryrefslogtreecommitdiff
path: root/drivers/media/rc/rc-main.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2013-04-30 09:58:16 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2013-04-30 09:58:16 -0700
commit240c3c3424366c8109babd2a0fe80855de511b35 (patch)
tree72eb8652c8e513715efee1e254644b4b670333fd /drivers/media/rc/rc-main.c
parent19b344efa35dbc253e2d10403dafe6aafda73c56 (diff)
parentdf90e2258950fd631cdbf322c1ee1f22068391aa (diff)
Merge branch 'v4l_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media
Pull media update from Mauro Carvalho Chehab: - OF documentation and patches at core and drivers, to be used by for embedded media systems - some I2C drivers used on go7007 were rewritten/promoted from staging: sony-btf-mpx, tw2804, tw9903, tw9906, wis-ov7640, wis-uda1342 - add fimc-is driver (Exynos) - add a new radio driver: radio-si476x - add a two new tuners: r820t and tuner_it913x - split camera code on em28xx driver and add more models - the cypress firmware load is used outside dvb usb drivers. So, move it to a common directory to make easier to re-use it - siano media driver updated to work with sms2270 devices - several work done in order to promote go7007 and solo6x1x out of staging (still, there are some pending issues) - several API compliance fixes at v4l2 drivers that don't behave as expected - as usual, lots of driver fixes, improvements, cleanups and new device addition at the existing drivers. * 'v4l_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media: (831 commits) [media] cx88: make core less verbose [media] em28xx: fix oops at em28xx_dvb_bus_ctrl() [media] s5c73m3: fix indentation of the help section in Kconfig [media] cx25821-alsa: get rid of a __must_check warning [media] cx25821-video: declare cx25821_vidioc_s_std as static [media] cx25821-video: remove maxw from cx25821_vidioc_try_fmt_vid_cap [media] r820t: Remove a warning for an unused value [media] dib0090: Fix a warning at dib0090_set_EFUSE [media] dib8000: fix a warning [media] dib8000: Fix sub-channel range [media] dib8000: store dtv_property_cache in a temp var [media] dib8000: warning fix: declare internal functions as static [media] r820t: quiet gcc warning on n_ring [media] r820t: memory leak in release() [media] r820t: precendence bug in r820t_xtal_check() [media] videodev2.h: Remove the unused old V4L1 buffer types [media] anysee: Grammar s/report the/report to/ [media] anysee: Initialize ret = 0 in anysee_frontend_attach() [media] media: videobuf2: fix the length check for mmap [media] em28xx: save isoc endpoint number for DVB only if endpoint has alt settings with xMaxPacketSize != 0 ...
Diffstat (limited to 'drivers/media/rc/rc-main.c')
-rw-r--r--drivers/media/rc/rc-main.c46
1 files changed, 17 insertions, 29 deletions
diff --git a/drivers/media/rc/rc-main.c b/drivers/media/rc/rc-main.c
index 759a40a42eaa..1cf382a0b277 100644
--- a/drivers/media/rc/rc-main.c
+++ b/drivers/media/rc/rc-main.c
@@ -715,14 +715,14 @@ static void ir_close(struct input_dev *idev)
}
/* class for /sys/class/rc */
-static char *ir_devnode(struct device *dev, umode_t *mode)
+static char *rc_devnode(struct device *dev, umode_t *mode)
{
return kasprintf(GFP_KERNEL, "rc/%s", dev_name(dev));
}
-static struct class ir_input_class = {
+static struct class rc_class = {
.name = "rc",
- .devnode = ir_devnode,
+ .devnode = rc_devnode,
};
/*
@@ -783,13 +783,12 @@ static ssize_t show_protocols(struct device *device,
mutex_lock(&dev->lock);
- if (dev->driver_type == RC_DRIVER_SCANCODE) {
- enabled = dev->rc_map.rc_type;
+ enabled = dev->enabled_protocols;
+ if (dev->driver_type == RC_DRIVER_SCANCODE)
allowed = dev->allowed_protos;
- } else if (dev->raw) {
- enabled = dev->raw->enabled_protocols;
+ else if (dev->raw)
allowed = ir_raw_get_allowed_protocols();
- } else {
+ else {
mutex_unlock(&dev->lock);
return -ENODEV;
}
@@ -847,7 +846,6 @@ static ssize_t store_protocols(struct device *device,
u64 type;
u64 mask;
int rc, i, count = 0;
- unsigned long flags;
ssize_t ret;
/* Device is being removed */
@@ -856,15 +854,12 @@ static ssize_t store_protocols(struct device *device,
mutex_lock(&dev->lock);
- if (dev->driver_type == RC_DRIVER_SCANCODE)
- type = dev->rc_map.rc_type;
- else if (dev->raw)
- type = dev->raw->enabled_protocols;
- else {
+ if (dev->driver_type != RC_DRIVER_SCANCODE && !dev->raw) {
IR_dprintk(1, "Protocol switching not supported\n");
ret = -EINVAL;
goto out;
}
+ type = dev->enabled_protocols;
while ((tmp = strsep((char **) &data, " \n")) != NULL) {
if (!*tmp)
@@ -922,14 +917,7 @@ static ssize_t store_protocols(struct device *device,
}
}
- if (dev->driver_type == RC_DRIVER_SCANCODE) {
- spin_lock_irqsave(&dev->rc_map.lock, flags);
- dev->rc_map.rc_type = type;
- spin_unlock_irqrestore(&dev->rc_map.lock, flags);
- } else {
- dev->raw->enabled_protocols = type;
- }
-
+ dev->enabled_protocols = type;
IR_dprintk(1, "Current protocol(s): 0x%llx\n",
(long long)type);
@@ -1016,7 +1004,7 @@ struct rc_dev *rc_allocate_device(void)
setup_timer(&dev->timer_keyup, ir_timer_keyup, (unsigned long)dev);
dev->dev.type = &rc_dev_type;
- dev->dev.class = &ir_input_class;
+ dev->dev.class = &rc_class;
device_initialize(&dev->dev);
__module_get(THIS_MODULE);
@@ -1068,9 +1056,8 @@ int rc_register_device(struct rc_dev *dev)
/*
* Take the lock here, as the device sysfs node will appear
* when device_add() is called, which may trigger an ir-keytable udev
- * rule, which will in turn call show_protocols and access either
- * dev->rc_map.rc_type or dev->raw->enabled_protocols before it has
- * been initialized.
+ * rule, which will in turn call show_protocols and access
+ * dev->enabled_protocols before it has been initialized.
*/
mutex_lock(&dev->lock);
@@ -1132,6 +1119,7 @@ int rc_register_device(struct rc_dev *dev)
rc = dev->change_protocol(dev, &rc_type);
if (rc < 0)
goto out_raw;
+ dev->enabled_protocols = rc_type;
}
mutex_unlock(&dev->lock);
@@ -1190,7 +1178,7 @@ EXPORT_SYMBOL_GPL(rc_unregister_device);
static int __init rc_core_init(void)
{
- int rc = class_register(&ir_input_class);
+ int rc = class_register(&rc_class);
if (rc) {
printk(KERN_ERR "rc_core: unable to register rc class\n");
return rc;
@@ -1203,11 +1191,11 @@ static int __init rc_core_init(void)
static void __exit rc_core_exit(void)
{
- class_unregister(&ir_input_class);
+ class_unregister(&rc_class);
rc_map_unregister(&empty_map);
}
-module_init(rc_core_init);
+subsys_initcall(rc_core_init);
module_exit(rc_core_exit);
int rc_core_debug; /* ir_debug level (0,1,2) */