summaryrefslogtreecommitdiffstats
path: root/drivers/media/rc/rc-main.c
diff options
context:
space:
mode:
authorDavid Härdeman <david@hardeman.nu>2014-04-04 01:32:21 +0200
committerMauro Carvalho Chehab <m.chehab@samsung.com>2014-07-26 00:10:43 +0200
commitc5540fbb9de39ceec108a889133664a887c2f55a (patch)
tree92d1523fa4ab99fc27d14dcd3ee00627eeb8a346 /drivers/media/rc/rc-main.c
parent[media] rc-core: simplify sysfs code (diff)
downloadlinux-c5540fbb9de39ceec108a889133664a887c2f55a.tar.xz
linux-c5540fbb9de39ceec108a889133664a887c2f55a.zip
[media] rc-core: remove protocol arrays
The basic API of rc-core used to be: dev = rc_allocate_device(); dev->x = a; dev->y = b; dev->z = c; rc_register_device(); which is a pretty common pattern in the kernel, after the introduction of protocol arrays the API looks something like: dev = rc_allocate_device(); dev->x = a; rc_set_allowed_protocols(dev, RC_BIT_X); dev->z = c; rc_register_device(); There's no real need for the protocols to be an array, so change it back to be consistent (and in preparation for the following patches). [m.chehab@samsung.com: added missing changes at some files] Signed-off-by: David Härdeman <david@hardeman.nu> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Diffstat (limited to 'drivers/media/rc/rc-main.c')
-rw-r--r--drivers/media/rc/rc-main.c30
1 files changed, 15 insertions, 15 deletions
diff --git a/drivers/media/rc/rc-main.c b/drivers/media/rc/rc-main.c
index d5bfe6442459..c3fb8f8f192b 100644
--- a/drivers/media/rc/rc-main.c
+++ b/drivers/media/rc/rc-main.c
@@ -857,14 +857,14 @@ static ssize_t show_protocols(struct device *device,
mutex_lock(&dev->lock);
if (fattr->type == RC_FILTER_NORMAL) {
- enabled = dev->enabled_protocols[RC_FILTER_NORMAL];
+ enabled = dev->enabled_protocols;
if (dev->raw)
allowed = ir_raw_get_allowed_protocols();
else
- allowed = dev->allowed_protocols[RC_FILTER_NORMAL];
+ allowed = dev->allowed_protocols;
} else {
- enabled = dev->enabled_protocols[RC_FILTER_WAKEUP];
- allowed = dev->allowed_protocols[RC_FILTER_WAKEUP];
+ enabled = dev->enabled_wakeup_protocols;
+ allowed = dev->allowed_wakeup_protocols;
}
mutex_unlock(&dev->lock);
@@ -989,15 +989,15 @@ static ssize_t store_protocols(struct device *device,
if (fattr->type == RC_FILTER_NORMAL) {
IR_dprintk(1, "Normal protocol change requested\n");
- current_protocols = &dev->enabled_protocols[RC_FILTER_NORMAL];
+ current_protocols = &dev->enabled_protocols;
change_protocol = dev->change_protocol;
- filter = &dev->scancode_filters[RC_FILTER_NORMAL];
+ filter = &dev->scancode_filter;
set_filter = dev->s_filter;
} else {
IR_dprintk(1, "Wakeup protocol change requested\n");
- current_protocols = &dev->enabled_protocols[RC_FILTER_WAKEUP];
+ current_protocols = &dev->enabled_wakeup_protocols;
change_protocol = dev->change_wakeup_protocol;
- filter = &dev->scancode_filters[RC_FILTER_WAKEUP];
+ filter = &dev->scancode_wakeup_filter;
set_filter = dev->s_wakeup_filter;
}
@@ -1085,9 +1085,9 @@ static ssize_t show_filter(struct device *device,
return -EINVAL;
if (fattr->type == RC_FILTER_NORMAL)
- filter = &dev->scancode_filters[RC_FILTER_NORMAL];
+ filter = &dev->scancode_filter;
else
- filter = &dev->scancode_filters[RC_FILTER_WAKEUP];
+ filter = &dev->scancode_wakeup_filter;
mutex_lock(&dev->lock);
if (fattr->mask)
@@ -1140,12 +1140,12 @@ static ssize_t store_filter(struct device *device,
if (fattr->type == RC_FILTER_NORMAL) {
set_filter = dev->s_filter;
- enabled_protocols = &dev->enabled_protocols[RC_FILTER_NORMAL];
- filter = &dev->scancode_filters[RC_FILTER_NORMAL];
+ enabled_protocols = &dev->enabled_protocols;
+ filter = &dev->scancode_filter;
} else {
set_filter = dev->s_wakeup_filter;
- enabled_protocols = &dev->enabled_protocols[RC_FILTER_WAKEUP];
- filter = &dev->scancode_filters[RC_FILTER_WAKEUP];
+ enabled_protocols = &dev->enabled_wakeup_protocols;
+ filter = &dev->scancode_wakeup_filter;
}
if (!set_filter)
@@ -1424,7 +1424,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_FILTER_NORMAL] = rc_type;
+ dev->enabled_protocols = rc_type;
}
mutex_unlock(&dev->lock);