]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
[media] rc-core: remove protocol arrays
authorDavid Härdeman <david@hardeman.nu>
Thu, 3 Apr 2014 23:32:21 +0000 (20:32 -0300)
committerMauro Carvalho Chehab <m.chehab@samsung.com>
Fri, 25 Jul 2014 22:10:43 +0000 (19:10 -0300)
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>
39 files changed:
drivers/hid/hid-picolcd_cir.c
drivers/media/common/siano/smsir.c
drivers/media/i2c/ir-kbd-i2c.c
drivers/media/pci/cx23885/cx23885-input.c
drivers/media/pci/cx88/cx88-input.c
drivers/media/rc/ati_remote.c
drivers/media/rc/ene_ir.c
drivers/media/rc/fintek-cir.c
drivers/media/rc/gpio-ir-recv.c
drivers/media/rc/iguanair.c
drivers/media/rc/img-ir/img-ir-hw.c
drivers/media/rc/imon.c
drivers/media/rc/ir-jvc-decoder.c
drivers/media/rc/ir-lirc-codec.c
drivers/media/rc/ir-mce_kbd-decoder.c
drivers/media/rc/ir-nec-decoder.c
drivers/media/rc/ir-raw.c
drivers/media/rc/ir-rc5-decoder.c
drivers/media/rc/ir-rc5-sz-decoder.c
drivers/media/rc/ir-rc6-decoder.c
drivers/media/rc/ir-sanyo-decoder.c
drivers/media/rc/ir-sharp-decoder.c
drivers/media/rc/ir-sony-decoder.c
drivers/media/rc/ite-cir.c
drivers/media/rc/mceusb.c
drivers/media/rc/nuvoton-cir.c
drivers/media/rc/rc-loopback.c
drivers/media/rc/rc-main.c
drivers/media/rc/redrat3.c
drivers/media/rc/st_rc.c
drivers/media/rc/streamzap.c
drivers/media/rc/sunxi-cir.c
drivers/media/rc/ttusbir.c
drivers/media/rc/winbond-cir.c
drivers/media/usb/dvb-usb-v2/dvb_usb_core.c
drivers/media/usb/dvb-usb/dvb-usb-remote.c
drivers/media/usb/em28xx/em28xx-input.c
drivers/media/usb/tm6000/tm6000-input.c
include/media/rc-core.h

index cf1a9f1c12170542bca294c9706911532bb224f9..045f8ebf16b53747746bf92c110f434ffdaff319 100644 (file)
@@ -114,7 +114,7 @@ int picolcd_init_cir(struct picolcd_data *data, struct hid_report *report)
 
        rdev->priv             = data;
        rdev->driver_type      = RC_DRIVER_IR_RAW;
-       rc_set_allowed_protocols(rdev, RC_BIT_ALL);
+       rdev->allowed_protocols = RC_BIT_ALL;
        rdev->open             = picolcd_cir_open;
        rdev->close            = picolcd_cir_close;
        rdev->input_name       = data->hdev->name;
index 6d7c0c858bd04b708d5eae6dab636f814fd2f63a..273043ea8f47e9b425d01be28c4fdaf68228de33 100644 (file)
@@ -88,7 +88,7 @@ int sms_ir_init(struct smscore_device_t *coredev)
 
        dev->priv = coredev;
        dev->driver_type = RC_DRIVER_IR_RAW;
-       rc_set_allowed_protocols(dev, RC_BIT_ALL);
+       dev->allowed_protocols = RC_BIT_ALL;
        dev->map_name = sms_get_board(board_id)->rc_codes;
        dev->driver_name = MODULE_NAME;
 
index f9c4233ba96eeb5e0c56148234383bd1df0928b6..8311f1a9a38e34a679d19c61e91900014a9e15e7 100644 (file)
@@ -432,8 +432,8 @@ static int ir_probe(struct i2c_client *client, const struct i2c_device_id *id)
         * Initialize the other fields of rc_dev
         */
        rc->map_name       = ir->ir_codes;
-       rc_set_allowed_protocols(rc, rc_type);
-       rc_set_enabled_protocols(rc, rc_type);
+       rc->allowed_protocols = rc_type;
+       rc->enabled_protocols = rc_type;
        if (!rc->driver_name)
                rc->driver_name = MODULE_NAME;
 
index 097d0a0b5f57ada60fd50ae78b6c2ffd654b7b37..1940c18e186cfbb6d0fbac1b579bdee75a040231 100644 (file)
@@ -346,7 +346,7 @@ int cx23885_input_init(struct cx23885_dev *dev)
        }
        rc->dev.parent = &dev->pci->dev;
        rc->driver_type = driver_type;
-       rc_set_allowed_protocols(rc, allowed_protos);
+       rc->allowed_protocols = allowed_protos;
        rc->priv = kernel_ir;
        rc->open = cx23885_input_ir_open;
        rc->close = cx23885_input_ir_close;
index 9bf48ca619c7f15315a72cb36f6b4ee24d8859e5..93ff6a7f23543c8697def1140f0af93db60a387c 100644 (file)
@@ -485,7 +485,7 @@ int cx88_ir_init(struct cx88_core *core, struct pci_dev *pci)
                dev->timeout = 10 * 1000 * 1000; /* 10 ms */
        } else {
                dev->driver_type = RC_DRIVER_SCANCODE;
-               rc_set_allowed_protocols(dev, rc_type);
+               dev->allowed_protocols = rc_type;
        }
 
        ir->core = core;
index 8730b32a067c3bed7ac7e63a8d9b74b55604d823..2e1335306eb3055e468f4bcd774f7520f025b80e 100644 (file)
@@ -784,7 +784,7 @@ static void ati_remote_rc_init(struct ati_remote *ati_remote)
 
        rdev->priv = ati_remote;
        rdev->driver_type = RC_DRIVER_SCANCODE;
-       rc_set_allowed_protocols(rdev, RC_BIT_OTHER);
+       rdev->allowed_protocols = RC_BIT_OTHER;
        rdev->driver_name = "ati_remote";
 
        rdev->open = ati_remote_rc_open;
index fc9d23f2ed3f4c9922fd3ee57df56d47ee73a19f..d16d9b496b92e4f1b1f66fa87b01af7d5757501e 100644 (file)
@@ -1059,7 +1059,7 @@ static int ene_probe(struct pnp_dev *pnp_dev, const struct pnp_device_id *id)
                learning_mode_force = false;
 
        rdev->driver_type = RC_DRIVER_IR_RAW;
-       rc_set_allowed_protocols(rdev, RC_BIT_ALL);
+       rdev->allowed_protocols = RC_BIT_ALL;
        rdev->priv = dev;
        rdev->open = ene_open;
        rdev->close = ene_close;
index 46b66e59438f51cc910f54ce8b659247a766cca5..f000faf7340bcf74f683cc591b691e3f7edd880e 100644 (file)
@@ -541,7 +541,7 @@ static int fintek_probe(struct pnp_dev *pdev, const struct pnp_device_id *dev_id
        /* Set up the rc device */
        rdev->priv = fintek;
        rdev->driver_type = RC_DRIVER_IR_RAW;
-       rc_set_allowed_protocols(rdev, RC_BIT_ALL);
+       rdev->allowed_protocols = RC_BIT_ALL;
        rdev->open = fintek_open;
        rdev->close = fintek_close;
        rdev->input_name = FINTEK_DESCRIPTION;
index 29b5f89813b4692a58e1dde5793bbef8902175a4..59853085bc88b8ca37420b4d99efde21dea8b3ec 100644 (file)
@@ -145,9 +145,9 @@ static int gpio_ir_recv_probe(struct platform_device *pdev)
        rcdev->dev.parent = &pdev->dev;
        rcdev->driver_name = GPIO_IR_DRIVER_NAME;
        if (pdata->allowed_protos)
-               rc_set_allowed_protocols(rcdev, pdata->allowed_protos);
+               rcdev->allowed_protocols = pdata->allowed_protos;
        else
-               rc_set_allowed_protocols(rcdev, RC_BIT_ALL);
+               rcdev->allowed_protocols = RC_BIT_ALL;
        rcdev->map_name = pdata->map_name ?: RC_MAP_EMPTY;
 
        gpio_dev->rcdev = rcdev;
index 627ddfd61980b5738219d8d1454784b53fdd6750..ee60e17fba05d715c1a7b10bdc8013575f445a10 100644 (file)
@@ -495,7 +495,7 @@ static int iguanair_probe(struct usb_interface *intf,
        usb_to_input_id(ir->udev, &rc->input_id);
        rc->dev.parent = &intf->dev;
        rc->driver_type = RC_DRIVER_IR_RAW;
-       rc_set_allowed_protocols(rc, RC_BIT_ALL);
+       rc->allowed_protocols = RC_BIT_ALL;
        rc->priv = ir;
        rc->open = iguanair_open;
        rc->close = iguanair_close;
index b0ec55f522281e39ceaead204ebf3af2a0bc000b..bfb282a714e8e2ca8bc77777ed375961d6e01a5f 100644 (file)
@@ -556,8 +556,8 @@ static void img_ir_set_decoder(struct img_ir_priv *priv,
        hw->mode = IMG_IR_M_NORMAL;
 
        /* clear the wakeup scancode filter */
-       rdev->scancode_filters[RC_FILTER_WAKEUP].data = 0;
-       rdev->scancode_filters[RC_FILTER_WAKEUP].mask = 0;
+       rdev->scancode_wakeup_filter.data = 0;
+       rdev->scancode_wakeup_filter.mask = 0;
 
        /* clear raw filters */
        _img_ir_set_filter(priv, NULL);
@@ -661,8 +661,8 @@ static int img_ir_change_protocol(struct rc_dev *dev, u64 *ir_type)
        wakeup_protocols = *ir_type;
        if (!hw->decoder || !hw->decoder->filter)
                wakeup_protocols = 0;
-       rc_set_allowed_wakeup_protocols(rdev, wakeup_protocols);
-       rc_set_enabled_wakeup_protocols(rdev, wakeup_protocols);
+       rdev->allowed_wakeup_protocols = wakeup_protocols;
+       rdev->enabled_wakeup_protocols = wakeup_protocols;
        return 0;
 }
 
@@ -676,9 +676,9 @@ static void img_ir_set_protocol(struct img_ir_priv *priv, u64 proto)
        spin_unlock_irq(&rdev->rc_map.lock);
 
        mutex_lock(&rdev->lock);
-       rc_set_enabled_protocols(rdev, proto);
-       rc_set_allowed_wakeup_protocols(rdev, proto);
-       rc_set_enabled_wakeup_protocols(rdev, proto);
+       rdev->enabled_protocols = proto;
+       rdev->allowed_wakeup_protocols = proto;
+       rdev->enabled_wakeup_protocols = proto;
        mutex_unlock(&rdev->lock);
 }
 
@@ -1003,7 +1003,7 @@ int img_ir_probe_hw(struct img_ir_priv *priv)
        }
        rdev->priv = priv;
        rdev->map_name = RC_MAP_EMPTY;
-       rc_set_allowed_protocols(rdev, img_ir_allowed_protos(priv));
+       rdev->allowed_protocols = img_ir_allowed_protos(priv);
        rdev->input_name = "IMG Infrared Decoder";
        rdev->s_filter = img_ir_set_normal_filter;
        rdev->s_wakeup_filter = img_ir_set_wakeup_filter;
index eb37f26223644d391b520bd7bbf7cae5ff3be790..ac05c364f66384e7ffecb8bd49655ecf2747c7c0 100644 (file)
@@ -1017,7 +1017,7 @@ static int imon_ir_change_protocol(struct rc_dev *rc, u64 *rc_type)
        unsigned char ir_proto_packet[] = {
                0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x86 };
 
-       if (*rc_type && !rc_protocols_allowed(rc, *rc_type))
+       if (*rc_type && !(*rc_type & rc->allowed_protocols))
                dev_warn(dev, "Looks like you're trying to use an IR protocol "
                         "this device does not support\n");
 
@@ -1870,8 +1870,7 @@ static struct rc_dev *imon_init_rdev(struct imon_context *ictx)
 
        rdev->priv = ictx;
        rdev->driver_type = RC_DRIVER_SCANCODE;
-                                       /* iMON PAD or MCE */
-       rc_set_allowed_protocols(rdev, RC_BIT_OTHER | RC_BIT_RC6_MCE);
+       rdev->allowed_protocols = RC_BIT_OTHER | RC_BIT_RC6_MCE; /* iMON PAD or MCE */
        rdev->change_protocol = imon_ir_change_protocol;
        rdev->driver_name = MOD_NAME;
 
@@ -1884,7 +1883,7 @@ static struct rc_dev *imon_init_rdev(struct imon_context *ictx)
 
        if (ictx->product == 0xffdc) {
                imon_get_ffdc_type(ictx);
-               rc_set_allowed_protocols(rdev, ictx->rc_type);
+               rdev->allowed_protocols = ictx->rc_type;
        }
 
        imon_set_display_type(ictx);
index 7b79eca83449b2d40a6df45713c1e3c499fd3409..30bcf188d3773006dd0afc1d1a314f044b8e8db8 100644 (file)
@@ -47,7 +47,7 @@ static int ir_jvc_decode(struct rc_dev *dev, struct ir_raw_event ev)
 {
        struct jvc_dec *data = &dev->raw->jvc;
 
-       if (!rc_protocols_enabled(dev, RC_BIT_JVC))
+       if (!(dev->enabled_protocols & RC_BIT_JVC))
                return 0;
 
        if (!is_timing_event(ev)) {
index d731da6c414da0a2b7bfc9dde18cd816c8d2f80a..ed2c8a1ed8caf39ee9eae20c8ec5b5f534c33c0a 100644 (file)
@@ -35,7 +35,7 @@ static int ir_lirc_decode(struct rc_dev *dev, struct ir_raw_event ev)
        struct lirc_codec *lirc = &dev->raw->lirc;
        int sample;
 
-       if (!rc_protocols_enabled(dev, RC_BIT_LIRC))
+       if (!(dev->enabled_protocols & RC_BIT_LIRC))
                return 0;
 
        if (!dev->raw->lirc.drv || !dev->raw->lirc.drv->rbuf)
index 0c55f794c8cf85b9906f21ddf4194972419aed54..9f3c9b59f30ccf27bf96b00b9d9142057f5148cf 100644 (file)
@@ -216,7 +216,7 @@ static int ir_mce_kbd_decode(struct rc_dev *dev, struct ir_raw_event ev)
        u32 scancode;
        unsigned long delay;
 
-       if (!rc_protocols_enabled(dev, RC_BIT_MCE_KBD))
+       if (!(dev->enabled_protocols & RC_BIT_MCE_KBD))
                return 0;
 
        if (!is_timing_event(ev)) {
index c4333d5c0046ad1476bf016f9adeb1d9675e1331..7b81fec0820fe6abb54561dfef2f973175c512c9 100644 (file)
@@ -52,7 +52,7 @@ static int ir_nec_decode(struct rc_dev *dev, struct ir_raw_event ev)
        u8 address, not_address, command, not_command;
        bool send_32bits = false;
 
-       if (!rc_protocols_enabled(dev, RC_BIT_NEC))
+       if (!(dev->enabled_protocols & RC_BIT_NEC))
                return 0;
 
        if (!is_timing_event(ev)) {
index c08718e176717c1f2560f3ff7d7686ef5a35dceb..c72f57cebfd240ebaf648f27f286e145c176d053 100644 (file)
@@ -262,7 +262,7 @@ int ir_raw_event_register(struct rc_dev *dev)
                return -ENOMEM;
 
        dev->raw->dev = dev;
-       rc_set_enabled_protocols(dev, ~0);
+       dev->enabled_protocols = ~0;
        dev->change_protocol = change_protocol;
        rc = kfifo_alloc(&dev->raw->kfifo,
                         sizeof(struct ir_raw_event) * MAX_IR_EVENT_SIZE,
index 3d38cbce5667cb3a24aca1b9d762a43a1fddec67..04ce42fa9eec523cf5aeed730d89e057367bbe7f 100644 (file)
@@ -53,7 +53,7 @@ static int ir_rc5_decode(struct rc_dev *dev, struct ir_raw_event ev)
        u32 scancode;
        enum rc_type protocol;
 
-       if (!rc_protocols_enabled(dev, RC_BIT_RC5 | RC_BIT_RC5X))
+       if (!(dev->enabled_protocols & (RC_BIT_RC5 | RC_BIT_RC5X)))
                return 0;
 
        if (!is_timing_event(ev)) {
@@ -129,7 +129,7 @@ static int ir_rc5_decode(struct rc_dev *dev, struct ir_raw_event ev)
                if (data->wanted_bits == RC5X_NBITS) {
                        /* RC5X */
                        u8 xdata, command, system;
-                       if (!rc_protocols_enabled(dev, RC_BIT_RC5X)) {
+                       if (!(dev->enabled_protocols & RC_BIT_RC5X)) {
                                data->state = STATE_INACTIVE;
                                return 0;
                        }
@@ -147,7 +147,7 @@ static int ir_rc5_decode(struct rc_dev *dev, struct ir_raw_event ev)
                } else {
                        /* RC5 */
                        u8 command, system;
-                       if (!rc_protocols_enabled(dev, RC_BIT_RC5)) {
+                       if (!(dev->enabled_protocols & RC_BIT_RC5)) {
                                data->state = STATE_INACTIVE;
                                return 0;
                        }
index 85c771112cf5a02c2dc52ebb2eafc28cee066a9b..771e9fcbd770e9aa936a19a11d6873441fbe3b1e 100644 (file)
@@ -48,7 +48,7 @@ static int ir_rc5_sz_decode(struct rc_dev *dev, struct ir_raw_event ev)
        u8 toggle, command, system;
        u32 scancode;
 
-       if (!rc_protocols_enabled(dev, RC_BIT_RC5_SZ))
+       if (!(dev->enabled_protocols & RC_BIT_RC5_SZ))
                return 0;
 
        if (!is_timing_event(ev)) {
index 1dc97a7b92a53ddd6ebcd883b133d0f8dc892af5..f1f098e22f7ea9f19b458223f226d5e73077bb2d 100644 (file)
@@ -90,9 +90,9 @@ static int ir_rc6_decode(struct rc_dev *dev, struct ir_raw_event ev)
        u8 toggle;
        enum rc_type protocol;
 
-       if (!rc_protocols_enabled(dev, RC_BIT_RC6_0 | RC_BIT_RC6_6A_20 |
-                                 RC_BIT_RC6_6A_24 | RC_BIT_RC6_6A_32 |
-                                 RC_BIT_RC6_MCE))
+       if (!(dev->enabled_protocols &
+             (RC_BIT_RC6_0 | RC_BIT_RC6_6A_20 | RC_BIT_RC6_6A_24 |
+              RC_BIT_RC6_6A_32 | RC_BIT_RC6_MCE)))
                return 0;
 
        if (!is_timing_event(ev)) {
index 5f7702261d234ebccd088bda983feb47784ba002..ad1dc6ae21fc1b5c499fd5b967b2e9e30cddb918 100644 (file)
@@ -58,7 +58,7 @@ static int ir_sanyo_decode(struct rc_dev *dev, struct ir_raw_event ev)
        u32 scancode;
        u8 address, command, not_command;
 
-       if (!rc_protocols_enabled(dev, RC_BIT_SANYO))
+       if (!(dev->enabled_protocols & RC_BIT_SANYO))
                return 0;
 
        if (!is_timing_event(ev)) {
index c8f2519391434e1f5da9700d2b6537274bada0ed..b7acdbae8159383c4405f1ca989b826e8d72e717 100644 (file)
@@ -48,7 +48,7 @@ static int ir_sharp_decode(struct rc_dev *dev, struct ir_raw_event ev)
        struct sharp_dec *data = &dev->raw->sharp;
        u32 msg, echo, address, command, scancode;
 
-       if (!rc_protocols_enabled(dev, RC_BIT_SHARP))
+       if (!(dev->enabled_protocols & RC_BIT_SHARP))
                return 0;
 
        if (!is_timing_event(ev)) {
index f485f9fe1e90ce8a701f4bfd47de99796f0e2389..d12dc3da59316f1380a07a2cd9d3bb0f86ba6664 100644 (file)
@@ -46,8 +46,8 @@ static int ir_sony_decode(struct rc_dev *dev, struct ir_raw_event ev)
        u32 scancode;
        u8 device, subdevice, function;
 
-       if (!rc_protocols_enabled(dev, RC_BIT_SONY12 | RC_BIT_SONY15 |
-                                 RC_BIT_SONY20))
+       if (!(dev->enabled_protocols &
+             (RC_BIT_SONY12 | RC_BIT_SONY15 | RC_BIT_SONY20)))
                return 0;
 
        if (!is_timing_event(ev)) {
@@ -125,7 +125,7 @@ static int ir_sony_decode(struct rc_dev *dev, struct ir_raw_event ev)
 
                switch (data->count) {
                case 12:
-                       if (!rc_protocols_enabled(dev, RC_BIT_SONY12)) {
+                       if (!(dev->enabled_protocols & RC_BIT_SONY12)) {
                                data->state = STATE_INACTIVE;
                                return 0;
                        }
@@ -135,7 +135,7 @@ static int ir_sony_decode(struct rc_dev *dev, struct ir_raw_event ev)
                        protocol = RC_TYPE_SONY12;
                        break;
                case 15:
-                       if (!rc_protocols_enabled(dev, RC_BIT_SONY15)) {
+                       if (!(dev->enabled_protocols & RC_BIT_SONY15)) {
                                data->state = STATE_INACTIVE;
                                return 0;
                        }
@@ -145,7 +145,7 @@ static int ir_sony_decode(struct rc_dev *dev, struct ir_raw_event ev)
                        protocol = RC_TYPE_SONY15;
                        break;
                case 20:
-                       if (!rc_protocols_enabled(dev, RC_BIT_SONY20)) {
+                       if (!(dev->enabled_protocols & RC_BIT_SONY20)) {
                                data->state = STATE_INACTIVE;
                                return 0;
                        }
index ab24cc6d365560778a2ded716b5a0d1d978fb3d3..32fd5f4614c835d780e34ea3f285c138d4981837 100644 (file)
@@ -1563,7 +1563,7 @@ static int ite_probe(struct pnp_dev *pdev, const struct pnp_device_id
        /* set up ir-core props */
        rdev->priv = itdev;
        rdev->driver_type = RC_DRIVER_IR_RAW;
-       rc_set_allowed_protocols(rdev, RC_BIT_ALL);
+       rdev->allowed_protocols = RC_BIT_ALL;
        rdev->open = ite_open;
        rdev->close = ite_close;
        rdev->s_idle = ite_s_idle;
index d5c1df3c9db119ba9dcf70acc09de44e416fce83..b1be81fc6bd7733b2024b9a9d687dd0e310cad4a 100644 (file)
@@ -1219,7 +1219,7 @@ static struct rc_dev *mceusb_init_rc_dev(struct mceusb_dev *ir)
        rc->dev.parent = dev;
        rc->priv = ir;
        rc->driver_type = RC_DRIVER_IR_RAW;
-       rc_set_allowed_protocols(rc, RC_BIT_ALL);
+       rc->allowed_protocols = RC_BIT_ALL;
        rc->timeout = MS_TO_NS(100);
        if (!ir->flags.no_tx) {
                rc->s_tx_mask = mceusb_set_tx_mask;
index d244e1a83f43f67f9c2f77156a920a42af591e9a..8c6008f81332c9c09ff7056ee3a5bfb0f359942f 100644 (file)
@@ -1044,7 +1044,7 @@ static int nvt_probe(struct pnp_dev *pdev, const struct pnp_device_id *dev_id)
        /* Set up the rc device */
        rdev->priv = nvt;
        rdev->driver_type = RC_DRIVER_IR_RAW;
-       rc_set_allowed_protocols(rdev, RC_BIT_ALL);
+       rdev->allowed_protocols = RC_BIT_ALL;
        rdev->open = nvt_open;
        rdev->close = nvt_close;
        rdev->tx_ir = nvt_tx_ir;
index 0a88e0cf964f945f26c6515f7540a5b1c9174700..63dace8198b0b3dbcb116108e238351fe9684a9e 100644 (file)
@@ -195,7 +195,7 @@ static int __init loop_init(void)
        rc->map_name            = RC_MAP_EMPTY;
        rc->priv                = &loopdev;
        rc->driver_type         = RC_DRIVER_IR_RAW;
-       rc_set_allowed_protocols(rc, RC_BIT_ALL);
+       rc->allowed_protocols   = RC_BIT_ALL;
        rc->timeout             = 100 * 1000 * 1000; /* 100 ms */
        rc->min_timeout         = 1;
        rc->max_timeout         = UINT_MAX;
index d5bfe6442459b7764a139da94b7de6a64ceddb47..c3fb8f8f192bb2e05c4e82cf5f474b77b57f50fa 100644 (file)
@@ -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);
index 79abbc8d960029a47096c2cb663791efa77a3cd2..795b394a5d847367db0d41cc167557adc19245e5 100644 (file)
@@ -878,7 +878,7 @@ static struct rc_dev *redrat3_init_rc_dev(struct redrat3_dev *rr3)
        rc->dev.parent = dev;
        rc->priv = rr3;
        rc->driver_type = RC_DRIVER_IR_RAW;
-       rc_set_allowed_protocols(rc, RC_BIT_ALL);
+       rc->allowed_protocols = RC_BIT_ALL;
        rc->timeout = US_TO_NS(2750);
        rc->tx_ir = redrat3_transmit_ir;
        rc->s_tx_carrier = redrat3_set_tx_carrier;
index 22e4c1f28ab414b6cea761e0be22013bd6d4f08a..5c151351afa4c72f48ccf9e48b88abe48cfc8331 100644 (file)
@@ -287,7 +287,7 @@ static int st_rc_probe(struct platform_device *pdev)
        st_rc_hardware_init(rc_dev);
 
        rdev->driver_type = RC_DRIVER_IR_RAW;
-       rc_set_allowed_protocols(rdev, RC_BIT_ALL);
+       rdev->allowed_protocols = RC_BIT_ALL;
        /* rx sampling rate is 10Mhz */
        rdev->rx_resolution = 100;
        rdev->timeout = US_TO_NS(MAX_SYMB_TIME);
index bd5e4ff9e0ba08213ccfef975318b84ebdef19c9..828bbb886882315581cd538c22cf961933abd6a4 100644 (file)
@@ -316,7 +316,7 @@ static struct rc_dev *streamzap_init_rc_dev(struct streamzap_ir *sz)
        rdev->dev.parent = dev;
        rdev->priv = sz;
        rdev->driver_type = RC_DRIVER_IR_RAW;
-       rc_set_allowed_protocols(rdev, RC_BIT_ALL);
+       rdev->allowed_protocols = RC_BIT_ALL;
        rdev->driver_name = DRIVER_NAME;
        rdev->map_name = RC_MAP_STREAMZAP;
 
index 13dcd800eb41e17c50730036473bdfa46324b257..bcee8e1a4e9efa5700bc2ba249b7375d3d759a0a 100644 (file)
@@ -210,7 +210,7 @@ static int sunxi_ir_probe(struct platform_device *pdev)
        ir->rc->map_name = ir->map_name ?: RC_MAP_EMPTY;
        ir->rc->dev.parent = dev;
        ir->rc->driver_type = RC_DRIVER_IR_RAW;
-       rc_set_allowed_protocols(ir->rc, RC_BIT_ALL);
+       ir->rc->allowed_protocols = RC_BIT_ALL;
        ir->rc->rx_resolution = SUNXI_IR_SAMPLE;
        ir->rc->timeout = MS_TO_NS(SUNXI_IR_TIMEOUT);
        ir->rc->driver_name = SUNXI_IR_DEV;
index c5be38e2a2fea7454c7e80a0cb312772d867d8aa..bc214e2b3a368941c857d5b176fa28ada8fd7c80 100644 (file)
@@ -318,7 +318,7 @@ static int ttusbir_probe(struct usb_interface *intf,
        usb_to_input_id(tt->udev, &rc->input_id);
        rc->dev.parent = &intf->dev;
        rc->driver_type = RC_DRIVER_IR_RAW;
-       rc_set_allowed_protocols(rc, RC_BIT_ALL);
+       rc->allowed_protocols = RC_BIT_ALL;
        rc->priv = tt;
        rc->driver_name = DRIVER_NAME;
        rc->map_name = RC_MAP_TT_1500;
index a8b981f5ce2ea13aa7f44635fe30ba5171bd3af9..d839f73f6a055185a3655e76927d458211bd50a8 100644 (file)
@@ -1082,7 +1082,7 @@ wbcir_probe(struct pnp_dev *device, const struct pnp_device_id *dev_id)
        data->dev->dev.parent = &device->dev;
        data->dev->timeout = MS_TO_NS(100);
        data->dev->rx_resolution = US_TO_NS(2);
-       rc_set_allowed_protocols(data->dev, RC_BIT_ALL);
+       data->dev->allowed_protocols = RC_BIT_ALL;
 
        err = rc_register_device(data->dev);
        if (err)
index e35580618936cd62e8a3bbd3ec54e50ebd7cc211..45f5ee9f46fc59f77323894d573ef15d8d7ab1c1 100644 (file)
@@ -164,7 +164,7 @@ static int dvb_usbv2_remote_init(struct dvb_usb_device *d)
        dev->driver_name = (char *) d->props->driver_name;
        dev->map_name = d->rc.map_name;
        dev->driver_type = d->rc.driver_type;
-       rc_set_allowed_protocols(dev, d->rc.allowed_protos);
+       dev->allowed_protocols = d->rc.allowed_protos;
        dev->change_protocol = d->rc.change_protocol;
        dev->priv = d;
 
index 4058aea9272faad2667961776ca7a42957e639fc..7b5dae3077f6a2550584b2eaada3da0a1d7632ca 100644 (file)
@@ -272,7 +272,7 @@ static int rc_core_dvb_usb_remote_init(struct dvb_usb_device *d)
        dev->driver_name = d->props.rc.core.module_name;
        dev->map_name = d->props.rc.core.rc_codes;
        dev->change_protocol = d->props.rc.core.change_protocol;
-       rc_set_allowed_protocols(dev, d->props.rc.core.allowed_protos);
+       dev->allowed_protocols = d->props.rc.core.allowed_protos;
        dev->driver_type = d->props.rc.core.driver_type;
        usb_to_input_id(d->udev, &dev->input_id);
        dev->input_name = "IR-receiver inside an USB DVB receiver";
index 7f06ae59eca61b5e3c7b12bc3ae5e135a39ae5dc..ed843bd221eaec8a9bb3307d965a0b49275e50f1 100644 (file)
@@ -745,7 +745,7 @@ static int em28xx_ir_init(struct em28xx *dev)
                case EM2820_BOARD_HAUPPAUGE_WINTV_USB_2:
                        rc->map_name = RC_MAP_HAUPPAUGE;
                        ir->get_key_i2c = em28xx_get_key_em_haup;
-                       rc_set_allowed_protocols(rc, RC_BIT_RC5);
+                       rc->allowed_protocols = RC_BIT_RC5;
                        break;
                case EM2820_BOARD_LEADTEK_WINFAST_USBII_DELUXE:
                        rc->map_name = RC_MAP_WINFAST_USBII_DELUXE;
@@ -761,7 +761,7 @@ static int em28xx_ir_init(struct em28xx *dev)
                switch (dev->chip_id) {
                case CHIP_ID_EM2860:
                case CHIP_ID_EM2883:
-                       rc_set_allowed_protocols(rc, RC_BIT_RC5 | RC_BIT_NEC);
+                       rc->allowed_protocols = RC_BIT_RC5 | RC_BIT_NEC;
                        ir->get_key = default_polling_getkey;
                        break;
                case CHIP_ID_EM2884:
@@ -769,8 +769,8 @@ static int em28xx_ir_init(struct em28xx *dev)
                case CHIP_ID_EM28174:
                case CHIP_ID_EM28178:
                        ir->get_key = em2874_polling_getkey;
-                       rc_set_allowed_protocols(rc, RC_BIT_RC5 | RC_BIT_NEC |
-                                                RC_BIT_RC6_0);
+                       rc->allowed_protocols = RC_BIT_RC5 | RC_BIT_NEC |
+                                            RC_BIT_RC6_0;
                        break;
                default:
                        err = -ENODEV;
index 676c0232060e0d9a7c6a1ee2197122bd876d8080..8a519f51609a4a9463abcf02305fe47bdcbe09aa 100644 (file)
@@ -441,7 +441,7 @@ int tm6000_ir_init(struct tm6000_core *dev)
        ir->rc = rc;
 
        /* input setup */
-       rc_set_allowed_protocols(rc, RC_BIT_RC5 | RC_BIT_NEC);
+       rc->allowed_protocols = RC_BIT_RC5 | RC_BIT_NEC;
        /* Neded, in order to support NEC remotes with 24 or 32 bits */
        rc->scanmask = 0xffff;
        rc->priv = ir;
index 00811c9e22b0b90bc3d56ece2013c7f31f04fef5..4f9e187d05bf9866c6d1ddb29e6b1318f8f157f9 100644 (file)
@@ -74,10 +74,12 @@ enum rc_filter_type {
  * @input_dev: the input child device used to communicate events to userspace
  * @driver_type: specifies if protocol decoding is done in hardware or software
  * @idle: used to keep track of RX state
- * @allowed_protocols: bitmask with the supported RC_BIT_* protocols for each
- *     filter type
- * @enabled_protocols: bitmask with the enabled RC_BIT_* protocols for each
- *     filter type
+ * @allowed_protocols: bitmask with the supported RC_BIT_* protocols
+ * @enabled_protocols: bitmask with the enabled RC_BIT_* protocols
+ * @allowed_wakeup_protocols: bitmask with the supported RC_BIT_* wakeup protocols
+ * @enabled_wakeup_protocols: bitmask with the enabled RC_BIT_* wakeup protocols
+ * @scancode_filter: scancode filter
+ * @scancode_wakeup_filter: scancode wakeup filters
  * @scanmask: some hardware decoders are not capable of providing the full
  *     scancode to the application. As this is a hardware limit, we can't do
  *     anything with it. Yet, as the same keycode table can be used with other
@@ -97,7 +99,6 @@ enum rc_filter_type {
  * @max_timeout: maximum timeout supported by device
  * @rx_resolution : resolution (in ns) of input sampler
  * @tx_resolution: resolution (in ns) of output sampler
- * @scancode_filters: scancode filters (indexed by enum rc_filter_type)
  * @change_protocol: allow changing the protocol used on hardware decoders
  * @change_wakeup_protocol: allow changing the protocol used for wakeup
  *     filtering
@@ -132,8 +133,12 @@ struct rc_dev {
        struct input_dev                *input_dev;
        enum rc_driver_type             driver_type;
        bool                            idle;
-       u64                             allowed_protocols[RC_FILTER_MAX];
-       u64                             enabled_protocols[RC_FILTER_MAX];
+       u64                             allowed_protocols;
+       u64                             enabled_protocols;
+       u64                             allowed_wakeup_protocols;
+       u64                             enabled_wakeup_protocols;
+       struct rc_scancode_filter       scancode_filter;
+       struct rc_scancode_filter       scancode_wakeup_filter;
        u32                             users;
        u32                             scanmask;
        void                            *priv;
@@ -150,7 +155,6 @@ struct rc_dev {
        u32                             max_timeout;
        u32                             rx_resolution;
        u32                             tx_resolution;
-       struct rc_scancode_filter       scancode_filters[RC_FILTER_MAX];
        int                             (*change_protocol)(struct rc_dev *dev, u64 *rc_type);
        int                             (*change_wakeup_protocol)(struct rc_dev *dev, u64 *rc_type);
        int                             (*open)(struct rc_dev *dev);
@@ -171,42 +175,6 @@ struct rc_dev {
 
 #define to_rc_dev(d) container_of(d, struct rc_dev, dev)
 
-static inline bool rc_protocols_allowed(struct rc_dev *rdev, u64 protos)
-{
-       return rdev->allowed_protocols[RC_FILTER_NORMAL] & protos;
-}
-
-/* should be called prior to registration or with mutex held */
-static inline void rc_set_allowed_protocols(struct rc_dev *rdev, u64 protos)
-{
-       rdev->allowed_protocols[RC_FILTER_NORMAL] = protos;
-}
-
-static inline bool rc_protocols_enabled(struct rc_dev *rdev, u64 protos)
-{
-       return rdev->enabled_protocols[RC_FILTER_NORMAL] & protos;
-}
-
-/* should be called prior to registration or with mutex held */
-static inline void rc_set_enabled_protocols(struct rc_dev *rdev, u64 protos)
-{
-       rdev->enabled_protocols[RC_FILTER_NORMAL] = protos;
-}
-
-/* should be called prior to registration or with mutex held */
-static inline void rc_set_allowed_wakeup_protocols(struct rc_dev *rdev,
-                                                  u64 protos)
-{
-       rdev->allowed_protocols[RC_FILTER_WAKEUP] = protos;
-}
-
-/* should be called prior to registration or with mutex held */
-static inline void rc_set_enabled_wakeup_protocols(struct rc_dev *rdev,
-                                                  u64 protos)
-{
-       rdev->enabled_protocols[RC_FILTER_WAKEUP] = protos;
-}
-
 /*
  * From rc-main.c
  * Those functions can be used on any type of Remote Controller. They