[media] rc: abstract access to allowed/enabled protocols
authorJames Hogan <james.hogan@imgtec.com>
Fri, 28 Feb 2014 23:17:03 +0000 (20:17 -0300)
committerMauro Carvalho Chehab <m.chehab@samsung.com>
Tue, 11 Mar 2014 16:24:39 +0000 (13:24 -0300)
The allowed and enabled protocol masks need to be expanded to be per
filter type in order to support wakeup filter protocol selection. To
ease that process abstract access to the rc_dev::allowed_protos and
rc_dev::enabled_protocols members with inline functions.

Signed-off-by: James Hogan <james.hogan@imgtec.com>
Reviewed-by: Antti Seppälä <a.seppala@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
36 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/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/redrat3.c
drivers/media/rc/st_rc.c
drivers/media/rc/streamzap.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 59d5eb1e742c98b8721f14a100528b587c25e3ef..cf1a9f1c12170542bca294c9706911532bb224f9 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;
-       rdev->allowed_protos   = RC_BIT_ALL;
+       rc_set_allowed_protocols(rdev, RC_BIT_ALL);
        rdev->open             = picolcd_cir_open;
        rdev->close            = picolcd_cir_close;
        rdev->input_name       = data->hdev->name;
index b8c5cad78537209b2409e687a4a5eb23b4c51b93..6d7c0c858bd04b708d5eae6dab636f814fd2f63a 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;
-       dev->allowed_protos = RC_BIT_ALL;
+       rc_set_allowed_protocols(dev, RC_BIT_ALL);
        dev->map_name = sms_get_board(board_id)->rc_codes;
        dev->driver_name = MODULE_NAME;
 
index 99ee456700f4972ef53888d692aa5f4b19930bce..c8fe1358ec9e14b24db0d465878104f730e407c9 100644 (file)
@@ -431,8 +431,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->allowed_protos = rc_type;
-       rc->enabled_protocols = rc_type;
+       rc_set_allowed_protocols(rc, rc_type);
+       rc_set_enabled_protocols(rc, rc_type);
        if (!rc->driver_name)
                rc->driver_name = MODULE_NAME;
 
index 8a49e7c9eddd76f508f8131a8533f552ad7db98b..097d0a0b5f57ada60fd50ae78b6c2ffd654b7b37 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->allowed_protos = allowed_protos;
+       rc_set_allowed_protocols(rc, allowed_protos);
        rc->priv = kernel_ir;
        rc->open = cx23885_input_ir_open;
        rc->close = cx23885_input_ir_close;
index f29e18c72f44ffa6462c09ae870445a67326431b..f991696a6c5923a99f2fe654932331b42cb7036f 100644 (file)
@@ -469,7 +469,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;
-               dev->allowed_protos = rc_type;
+               rc_set_allowed_protocols(dev, rc_type);
        }
 
        ir->core = core;
index 4d6a63fe6c5e210f878b132c6f6ea386e185fa66..2df7c5516013bd079d39bf5b248cf8270dbabaff 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;
-       rdev->allowed_protos = RC_BIT_OTHER;
+       rc_set_allowed_protocols(rdev, RC_BIT_OTHER);
        rdev->driver_name = "ati_remote";
 
        rdev->open = ati_remote_rc_open;
index c1444f84717d725a7dd3e93048b6ff7a7b7e5831..fc9d23f2ed3f4c9922fd3ee57df56d47ee73a19f 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;
-       rdev->allowed_protos = RC_BIT_ALL;
+       rc_set_allowed_protocols(rdev, RC_BIT_ALL);
        rdev->priv = dev;
        rdev->open = ene_open;
        rdev->close = ene_close;
index d6fa441655d29de5945133c0e383cc4a29176c98..46b66e59438f51cc910f54ce8b659247a766cca5 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;
-       rdev->allowed_protos = RC_BIT_ALL;
+       rc_set_allowed_protocols(rdev, RC_BIT_ALL);
        rdev->open = fintek_open;
        rdev->close = fintek_close;
        rdev->input_name = FINTEK_DESCRIPTION;
index 80c611c2e8c28fabd83b0383d19670cf1cbe0faf..29b5f89813b4692a58e1dde5793bbef8902175a4 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)
-               rcdev->allowed_protos = pdata->allowed_protos;
+               rc_set_allowed_protocols(rcdev, pdata->allowed_protos);
        else
-               rcdev->allowed_protos = RC_BIT_ALL;
+               rc_set_allowed_protocols(rcdev, RC_BIT_ALL);
        rcdev->map_name = pdata->map_name ?: RC_MAP_EMPTY;
 
        gpio_dev->rcdev = rcdev;
index a83519a6a158d769b370a62642d6fda23abc413c..627ddfd61980b5738219d8d1454784b53fdd6750 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->allowed_protos = RC_BIT_ALL;
+       rc_set_allowed_protocols(rc, RC_BIT_ALL);
        rc->priv = ir;
        rc->open = iguanair_open;
        rc->close = iguanair_close;
index 822b9f47ca729aa6cd769fc262fa98a3fa3616ef..6f24e77b1488aab6073e3f7709e1845918d5fcf1 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_type & rc->allowed_protos))
+       if (*rc_type && !rc_protocols_allowed(rc, *rc_type))
                dev_warn(dev, "Looks like you're trying to use an IR protocol "
                         "this device does not support\n");
 
@@ -1867,7 +1867,8 @@ static struct rc_dev *imon_init_rdev(struct imon_context *ictx)
 
        rdev->priv = ictx;
        rdev->driver_type = RC_DRIVER_SCANCODE;
-       rdev->allowed_protos = RC_BIT_OTHER | RC_BIT_RC6_MCE; /* iMON PAD or MCE */
+                                       /* iMON PAD or MCE */
+       rc_set_allowed_protocols(rdev, RC_BIT_OTHER | RC_BIT_RC6_MCE);
        rdev->change_protocol = imon_ir_change_protocol;
        rdev->driver_name = MOD_NAME;
 
@@ -1880,7 +1881,7 @@ static struct rc_dev *imon_init_rdev(struct imon_context *ictx)
 
        if (ictx->product == 0xffdc) {
                imon_get_ffdc_type(ictx);
-               rdev->allowed_protos = ictx->rc_type;
+               rc_set_allowed_protocols(rdev, ictx->rc_type);
        }
 
        imon_set_display_type(ictx);
index 3948138ca870cbe21b6638dd5e89fb5574cf5d72..4ea62a1dcfdaebedd61523dd6451bab70445b016 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 (!(dev->enabled_protocols & RC_BIT_JVC))
+       if (!rc_protocols_enabled(dev, RC_BIT_JVC))
                return 0;
 
        if (!is_timing_event(ev)) {
index ed2c8a1ed8caf39ee9eae20c8ec5b5f534c33c0a..d731da6c414da0a2b7bfc9dde18cd816c8d2f80a 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 (!(dev->enabled_protocols & RC_BIT_LIRC))
+       if (!rc_protocols_enabled(dev, RC_BIT_LIRC))
                return 0;
 
        if (!dev->raw->lirc.drv || !dev->raw->lirc.drv->rbuf)
index 9f3c9b59f30ccf27bf96b00b9d9142057f5148cf..0c55f794c8cf85b9906f21ddf4194972419aed54 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 (!(dev->enabled_protocols & RC_BIT_MCE_KBD))
+       if (!rc_protocols_enabled(dev, RC_BIT_MCE_KBD))
                return 0;
 
        if (!is_timing_event(ev)) {
index e687a42470524f4ce049578d934ed1f9446818a4..9de1791d24946fcd43f89705b11c7d0f7a90b4bb 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 (!(dev->enabled_protocols & RC_BIT_NEC))
+       if (!rc_protocols_enabled(dev, RC_BIT_NEC))
                return 0;
 
        if (!is_timing_event(ev)) {
index f0656fa1a01a8a00e1c490236967a6d1b525b3ca..763c9d131d0fc6c7573c5c1ee9e8ce2bbe266ef6 100644 (file)
@@ -256,7 +256,7 @@ int ir_raw_event_register(struct rc_dev *dev)
                return -ENOMEM;
 
        dev->raw->dev = dev;
-       dev->enabled_protocols = ~0;
+       rc_set_enabled_protocols(dev, ~0);
        rc = kfifo_alloc(&dev->raw->kfifo,
                         sizeof(struct ir_raw_event) * MAX_IR_EVENT_SIZE,
                         GFP_KERNEL);
index 1085e173270a1e8494fdae4e595dc2aaa64e66f9..4295d9b250c836e23a811675bca15781d338079d 100644 (file)
@@ -52,7 +52,7 @@ static int ir_rc5_decode(struct rc_dev *dev, struct ir_raw_event ev)
        u8 toggle;
        u32 scancode;
 
-       if (!(dev->enabled_protocols & (RC_BIT_RC5 | RC_BIT_RC5X)))
+       if (!rc_protocols_enabled(dev, RC_BIT_RC5 | RC_BIT_RC5X))
                return 0;
 
        if (!is_timing_event(ev)) {
@@ -128,7 +128,7 @@ again:
                if (data->wanted_bits == RC5X_NBITS) {
                        /* RC5X */
                        u8 xdata, command, system;
-                       if (!(dev->enabled_protocols & RC_BIT_RC5X)) {
+                       if (!rc_protocols_enabled(dev, RC_BIT_RC5X)) {
                                data->state = STATE_INACTIVE;
                                return 0;
                        }
@@ -145,7 +145,7 @@ again:
                } else {
                        /* RC5 */
                        u8 command, system;
-                       if (!(dev->enabled_protocols & RC_BIT_RC5)) {
+                       if (!rc_protocols_enabled(dev, RC_BIT_RC5)) {
                                data->state = STATE_INACTIVE;
                                return 0;
                        }
index 984e5b9f5bc3c7e8fb78623307f4a713170abd31..dc18b7434db8806c5874a2f1e9b8df1f4a603d4a 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 (!(dev->enabled_protocols & RC_BIT_RC5_SZ))
+       if (!rc_protocols_enabled(dev, RC_BIT_RC5_SZ))
                return 0;
 
        if (!is_timing_event(ev)) {
index 7cba7d33a3fac886b7ba8379275499f9c285f24b..cfbd64e3999c4a5fae91f4b4d4e395eb41f77a5c 100644 (file)
@@ -89,9 +89,9 @@ static int ir_rc6_decode(struct rc_dev *dev, struct ir_raw_event ev)
        u32 scancode;
        u8 toggle;
 
-       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)))
+       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))
                return 0;
 
        if (!is_timing_event(ev)) {
index e1351ed61629c1387809b2f39e2caab182ac145e..eb715f04dc27954af4bf458bbdcb6bd2a25e3bdc 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 (!(dev->enabled_protocols & RC_BIT_SANYO))
+       if (!rc_protocols_enabled(dev, RC_BIT_SANYO))
                return 0;
 
        if (!is_timing_event(ev)) {
index 4895bc752f97ce1d47e19e67bfbc62bcb4e87b93..66d20394ceaa0d61c0b8f3ee5d102a0e86befc2a 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 (!(dev->enabled_protocols & RC_BIT_SHARP))
+       if (!rc_protocols_enabled(dev, RC_BIT_SHARP))
                return 0;
 
        if (!is_timing_event(ev)) {
index 29ab9c2db060c6831536579d4cbc50fad33120d5..599c19a7336041eef4622563f99cbd3341915a2a 100644 (file)
@@ -45,8 +45,8 @@ static int ir_sony_decode(struct rc_dev *dev, struct ir_raw_event ev)
        u32 scancode;
        u8 device, subdevice, function;
 
-       if (!(dev->enabled_protocols &
-             (RC_BIT_SONY12 | RC_BIT_SONY15 | RC_BIT_SONY20)))
+       if (!rc_protocols_enabled(dev, RC_BIT_SONY12 | RC_BIT_SONY15 |
+                                 RC_BIT_SONY20))
                return 0;
 
        if (!is_timing_event(ev)) {
@@ -124,7 +124,7 @@ static int ir_sony_decode(struct rc_dev *dev, struct ir_raw_event ev)
 
                switch (data->count) {
                case 12:
-                       if (!(dev->enabled_protocols & RC_BIT_SONY12)) {
+                       if (!rc_protocols_enabled(dev, RC_BIT_SONY12)) {
                                data->state = STATE_INACTIVE;
                                return 0;
                        }
@@ -133,7 +133,7 @@ static int ir_sony_decode(struct rc_dev *dev, struct ir_raw_event ev)
                        function  = bitrev8((data->bits >>  4) & 0xFE);
                        break;
                case 15:
-                       if (!(dev->enabled_protocols & RC_BIT_SONY15)) {
+                       if (!rc_protocols_enabled(dev, RC_BIT_SONY15)) {
                                data->state = STATE_INACTIVE;
                                return 0;
                        }
@@ -142,7 +142,7 @@ static int ir_sony_decode(struct rc_dev *dev, struct ir_raw_event ev)
                        function  = bitrev8((data->bits >>  7) & 0xFE);
                        break;
                case 20:
-                       if (!(dev->enabled_protocols & RC_BIT_SONY20)) {
+                       if (!rc_protocols_enabled(dev, RC_BIT_SONY20)) {
                                data->state = STATE_INACTIVE;
                                return 0;
                        }
index 63b42252166a744fc2275b0b538a69bd4232f98d..ab24cc6d365560778a2ded716b5a0d1d978fb3d3 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;
-       rdev->allowed_protos = RC_BIT_ALL;
+       rc_set_allowed_protocols(rdev, RC_BIT_ALL);
        rdev->open = ite_open;
        rdev->close = ite_close;
        rdev->s_idle = ite_s_idle;
index c01b4c1f64ca0ec9d241dbd3bd05d1806bdfba91..5d8f3d40d820ba4059ad97291cf06904074b0381 100644 (file)
@@ -1211,7 +1211,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->allowed_protos = RC_BIT_ALL;
+       rc_set_allowed_protocols(rc, RC_BIT_ALL);
        rc->timeout = MS_TO_NS(100);
        if (!ir->flags.no_tx) {
                rc->s_tx_mask = mceusb_set_tx_mask;
index b81325d7948f75c89ffe5c08808b68de363e27a2..d244e1a83f43f67f9c2f77156a920a42af591e9a 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;
-       rdev->allowed_protos = RC_BIT_ALL;
+       rc_set_allowed_protocols(rdev, RC_BIT_ALL);
        rdev->open = nvt_open;
        rdev->close = nvt_close;
        rdev->tx_ir = nvt_tx_ir;
index 53d02827a4724f8e5dfeb1eeea19895f42b7fbba..0a88e0cf964f945f26c6515f7540a5b1c9174700 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->allowed_protos      = RC_BIT_ALL;
+       rc_set_allowed_protocols(rc, RC_BIT_ALL);
        rc->timeout             = 100 * 1000 * 1000; /* 100 ms */
        rc->min_timeout         = 1;
        rc->max_timeout         = UINT_MAX;
index a5d4f883d053a7b0ebca0543ac82d29d216ec26a..47cd373e2295a3550f09e1b5643f58205abead92 100644 (file)
@@ -922,7 +922,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->allowed_protos = RC_BIT_ALL;
+       rc_set_allowed_protocols(rc, RC_BIT_ALL);
        rc->timeout = US_TO_NS(2750);
        rc->tx_ir = redrat3_transmit_ir;
        rc->s_tx_carrier = redrat3_set_tx_carrier;
index 8f0cddb9e8f2f4ce0076a9f7a4d4ba0cada0d7b4..22e4c1f28ab414b6cea761e0be22013bd6d4f08a 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;
-       rdev->allowed_protos = RC_BIT_ALL;
+       rc_set_allowed_protocols(rdev, RC_BIT_ALL);
        /* rx sampling rate is 10Mhz */
        rdev->rx_resolution = 100;
        rdev->timeout = US_TO_NS(MAX_SYMB_TIME);
index d7b11e6a998253dd362654ed468edcb11cfef103..f4e0bc3d382ce92d65f7876ad4101a579e157762 100644 (file)
@@ -322,7 +322,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;
-       rdev->allowed_protos = RC_BIT_ALL;
+       rc_set_allowed_protocols(rdev, RC_BIT_ALL);
        rdev->driver_name = DRIVER_NAME;
        rdev->map_name = RC_MAP_STREAMZAP;
 
index d8de2056a4f69cedc179c2dfa206595909f3458f..c5be38e2a2fea7454c7e80a0cb312772d867d8aa 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->allowed_protos = RC_BIT_ALL;
+       rc_set_allowed_protocols(rc, RC_BIT_ALL);
        rc->priv = tt;
        rc->driver_name = DRIVER_NAME;
        rc->map_name = RC_MAP_TT_1500;
index 904baf4eec28ac902731d90bb78ae6f73632c4cc..a8b981f5ce2ea13aa7f44635fe30ba5171bd3af9 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);
-       data->dev->allowed_protos = RC_BIT_ALL;
+       rc_set_allowed_protocols(data->dev, RC_BIT_ALL);
 
        err = rc_register_device(data->dev);
        if (err)
index 8a054d66e708449ce6417135eaf4e20e675ac3aa..de02db802acea6bc47caacab100d6481eb639f8f 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;
-       dev->allowed_protos = d->rc.allowed_protos;
+       rc_set_allowed_protocols(dev, d->rc.allowed_protos);
        dev->change_protocol = d->rc.change_protocol;
        dev->priv = d;
 
index 41bacff24960b7b7262d435ac575a147fac8c511..4058aea9272faad2667961776ca7a42957e639fc 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;
-       dev->allowed_protos = d->props.rc.core.allowed_protos;
+       rc_set_allowed_protocols(dev, 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 2a9bf667f208495340890941b582d354e3cebac7..56ef49df4f8d65e2df5d52abf547bcc63cc42ff2 100644 (file)
@@ -727,7 +727,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->allowed_protos = RC_BIT_RC5;
+                       rc_set_allowed_protocols(rc, RC_BIT_RC5);
                        break;
                case EM2820_BOARD_LEADTEK_WINFAST_USBII_DELUXE:
                        rc->map_name = RC_MAP_WINFAST_USBII_DELUXE;
@@ -743,7 +743,7 @@ static int em28xx_ir_init(struct em28xx *dev)
                switch (dev->chip_id) {
                case CHIP_ID_EM2860:
                case CHIP_ID_EM2883:
-                       rc->allowed_protos = RC_BIT_RC5 | RC_BIT_NEC;
+                       rc_set_allowed_protocols(rc, RC_BIT_RC5 | RC_BIT_NEC);
                        ir->get_key = default_polling_getkey;
                        break;
                case CHIP_ID_EM2884:
@@ -751,8 +751,8 @@ static int em28xx_ir_init(struct em28xx *dev)
                case CHIP_ID_EM28174:
                case CHIP_ID_EM28178:
                        ir->get_key = em2874_polling_getkey;
-                       rc->allowed_protos = RC_BIT_RC5 | RC_BIT_NEC |
-                                            RC_BIT_RC6_0;
+                       rc_set_allowed_protocols(rc, RC_BIT_RC5 | RC_BIT_NEC |
+                                                RC_BIT_RC6_0);
                        break;
                default:
                        err = -ENODEV;
index 8a6bbf1d80e1a484956bf655c9a1df75752a3b63..d1af5438c16859ba29db75b91e83dc9cb89e180f 100644 (file)
@@ -422,7 +422,7 @@ int tm6000_ir_init(struct tm6000_core *dev)
        ir->rc = rc;
 
        /* input setup */
-       rc->allowed_protos = RC_BIT_RC5 | RC_BIT_NEC;
+       rc_set_allowed_protocols(rc, 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 5e7197e40c14ed35dea813de1dfb4e5b48b89b7d..6f3c3d977c81cbf2aee61101902fa9734faec400 100644 (file)
@@ -160,6 +160,28 @@ 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_protos & 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_protos = protos;
+}
+
+static inline bool rc_protocols_enabled(struct rc_dev *rdev, u64 protos)
+{
+       return rdev->enabled_protocols & 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 = protos;
+}
+
 /*
  * From rc-main.c
  * Those functions can be used on any type of Remote Controller. They