[media] rc-main: assign driver type during allocation
authorAndi Shyti <andi.shyti@samsung.com>
Fri, 16 Dec 2016 08:50:58 +0000 (06:50 -0200)
committerMauro Carvalho Chehab <mchehab@s-opensource.com>
Mon, 30 Jan 2017 15:59:57 +0000 (13:59 -0200)
The driver type can be assigned immediately when an RC device
requests to the framework to allocate the device.

This is an 'enum rc_driver_type' data type and specifies whether
the device is a raw receiver or scancode receiver. The type will
be given as parameter to the rc_allocate_device device.

Change accordingly all the drivers calling rc_allocate_device()
so that the device type is specified during the rc device
allocation. Whenever the device type is not specified, it will be
set as RC_DRIVER_SCANCODE which was the default '0' value.

Suggested-by: Sean Young <sean@mess.org>
Signed-off-by: Andi Shyti <andi.shyti@samsung.com>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
42 files changed:
drivers/hid/hid-picolcd_cir.c
drivers/media/cec/cec-core.c
drivers/media/common/siano/smsir.c
drivers/media/i2c/ir-kbd-i2c.c
drivers/media/pci/bt8xx/bttv-input.c
drivers/media/pci/cx23885/cx23885-input.c
drivers/media/pci/cx88/cx88-input.c
drivers/media/pci/dm1105/dm1105.c
drivers/media/pci/mantis/mantis_input.c
drivers/media/pci/saa7134/saa7134-input.c
drivers/media/pci/smipcie/smipcie-ir.c
drivers/media/pci/ttpci/budget-ci.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/igorplugusb.c
drivers/media/rc/iguanair.c
drivers/media/rc/img-ir/img-ir-hw.c
drivers/media/rc/img-ir/img-ir-raw.c
drivers/media/rc/imon.c
drivers/media/rc/ir-hix5hd2.c
drivers/media/rc/ite-cir.c
drivers/media/rc/mceusb.c
drivers/media/rc/meson-ir.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/serial_ir.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/au0828/au0828-input.c
drivers/media/usb/cx231xx/cx231xx-input.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 90add97cc54dd535d54d9d6561018e2fba448ad8..8ffbb6f65a65a4befda7b2a1257400cab31c6e8b 100644 (file)
@@ -108,12 +108,11 @@ int picolcd_init_cir(struct picolcd_data *data, struct hid_report *report)
        struct rc_dev *rdev;
        int ret = 0;
 
-       rdev = rc_allocate_device();
+       rdev = rc_allocate_device(RC_DRIVER_IR_RAW);
        if (!rdev)
                return -ENOMEM;
 
        rdev->priv             = data;
-       rdev->driver_type      = RC_DRIVER_IR_RAW;
        rdev->allowed_protocols = RC_BIT_ALL_IR_DECODER;
        rdev->open             = picolcd_cir_open;
        rdev->close            = picolcd_cir_close;
index aca3ab83a8a142af696443857dcc1a8882689ac6..37217e205040e6748b5b8f7d955063d213ec94e6 100644 (file)
@@ -239,7 +239,7 @@ struct cec_adapter *cec_allocate_adapter(const struct cec_adap_ops *ops,
 
 #if IS_REACHABLE(CONFIG_RC_CORE)
        /* Prepare the RC input device */
-       adap->rc = rc_allocate_device();
+       adap->rc = rc_allocate_device(RC_DRIVER_SCANCODE);
        if (!adap->rc) {
                pr_err("cec-%s: failed to allocate memory for rc_dev\n",
                       name);
@@ -259,7 +259,6 @@ struct cec_adapter *cec_allocate_adapter(const struct cec_adap_ops *ops,
        adap->rc->input_id.vendor = 0;
        adap->rc->input_id.product = 0;
        adap->rc->input_id.version = 1;
-       adap->rc->driver_type = RC_DRIVER_SCANCODE;
        adap->rc->driver_name = CEC_NAME;
        adap->rc->allowed_protocols = RC_BIT_CEC;
        adap->rc->priv = adap;
index 480d8bf3d26a6fb40c2b074fa29c1942b32c431e..7c898b06d85c33ddcb92cfce60b22e7208e8b343 100644 (file)
@@ -58,7 +58,7 @@ int sms_ir_init(struct smscore_device_t *coredev)
        struct rc_dev *dev;
 
        pr_debug("Allocating rc device\n");
-       dev = rc_allocate_device();
+       dev = rc_allocate_device(RC_DRIVER_IR_RAW);
        if (!dev)
                return -ENOMEM;
 
@@ -86,7 +86,6 @@ int sms_ir_init(struct smscore_device_t *coredev)
 #endif
 
        dev->priv = coredev;
-       dev->driver_type = RC_DRIVER_IR_RAW;
        dev->allowed_protocols = RC_BIT_ALL_IR_DECODER;
        dev->map_name = sms_get_board(board_id)->rc_codes;
        dev->driver_name = MODULE_NAME;
index b2f39a2c0b6dfa9e8a22cf4102744a9bcd18097e..cee7fd9cf08b3fe1704902a9959392277d9c04ca 100644 (file)
@@ -424,7 +424,7 @@ static int ir_probe(struct i2c_client *client, const struct i2c_device_id *id)
                 * If platform_data doesn't specify rc_dev, initialize it
                 * internally
                 */
-               rc = rc_allocate_device();
+               rc = rc_allocate_device(RC_DRIVER_SCANCODE);
                if (!rc)
                        return -ENOMEM;
        }
index 57d26a78d410eaa520bd0df86d389db154bb96e8..2fd07a8afcd2500d641d72031075f5aebea151e2 100644 (file)
@@ -420,7 +420,7 @@ int bttv_input_init(struct bttv *btv)
                return -ENODEV;
 
        ir = kzalloc(sizeof(*ir),GFP_KERNEL);
-       rc = rc_allocate_device();
+       rc = rc_allocate_device(RC_DRIVER_SCANCODE);
        if (!ir || !rc)
                goto err_out_free;
 
index 2d4e703b689332eadd46987e104d1535893a2987..4367cb3162b659e9018ece20c39ba51979a321d2 100644 (file)
@@ -267,7 +267,6 @@ int cx23885_input_init(struct cx23885_dev *dev)
        struct cx23885_kernel_ir *kernel_ir;
        struct rc_dev *rc;
        char *rc_map;
-       enum rc_driver_type driver_type;
        u64 allowed_protos;
 
        int ret;
@@ -285,28 +284,24 @@ int cx23885_input_init(struct cx23885_dev *dev)
        case CX23885_BOARD_HAUPPAUGE_HVR1290:
        case CX23885_BOARD_HAUPPAUGE_HVR1250:
                /* Integrated CX2388[58] IR controller */
-               driver_type = RC_DRIVER_IR_RAW;
                allowed_protos = RC_BIT_ALL_IR_DECODER;
                /* The grey Hauppauge RC-5 remote */
                rc_map = RC_MAP_HAUPPAUGE;
                break;
        case CX23885_BOARD_TERRATEC_CINERGY_T_PCIE_DUAL:
                /* Integrated CX23885 IR controller */
-               driver_type = RC_DRIVER_IR_RAW;
                allowed_protos = RC_BIT_ALL_IR_DECODER;
                /* The grey Terratec remote with orange buttons */
                rc_map = RC_MAP_NEC_TERRATEC_CINERGY_XS;
                break;
        case CX23885_BOARD_TEVII_S470:
                /* Integrated CX23885 IR controller */
-               driver_type = RC_DRIVER_IR_RAW;
                allowed_protos = RC_BIT_ALL_IR_DECODER;
                /* A guess at the remote */
                rc_map = RC_MAP_TEVII_NEC;
                break;
        case CX23885_BOARD_MYGICA_X8507:
                /* Integrated CX23885 IR controller */
-               driver_type = RC_DRIVER_IR_RAW;
                allowed_protos = RC_BIT_ALL_IR_DECODER;
                /* A guess at the remote */
                rc_map = RC_MAP_TOTAL_MEDIA_IN_HAND_02;
@@ -314,7 +309,6 @@ int cx23885_input_init(struct cx23885_dev *dev)
        case CX23885_BOARD_TBS_6980:
        case CX23885_BOARD_TBS_6981:
                /* Integrated CX23885 IR controller */
-               driver_type = RC_DRIVER_IR_RAW;
                allowed_protos = RC_BIT_ALL_IR_DECODER;
                /* A guess at the remote */
                rc_map = RC_MAP_TBS_NEC;
@@ -326,13 +320,11 @@ int cx23885_input_init(struct cx23885_dev *dev)
        case CX23885_BOARD_DVBSKY_S952:
        case CX23885_BOARD_DVBSKY_T982:
                /* Integrated CX23885 IR controller */
-               driver_type = RC_DRIVER_IR_RAW;
                allowed_protos = RC_BIT_ALL_IR_DECODER;
                rc_map = RC_MAP_DVBSKY;
                break;
        case CX23885_BOARD_TT_CT2_4500_CI:
                /* Integrated CX23885 IR controller */
-               driver_type = RC_DRIVER_IR_RAW;
                allowed_protos = RC_BIT_ALL_IR_DECODER;
                rc_map = RC_MAP_TT_1500;
                break;
@@ -352,7 +344,7 @@ int cx23885_input_init(struct cx23885_dev *dev)
                                    pci_name(dev->pci));
 
        /* input device */
-       rc = rc_allocate_device();
+       rc = rc_allocate_device(RC_DRIVER_IR_RAW);
        if (!rc) {
                ret = -ENOMEM;
                goto err_out_free;
@@ -371,7 +363,6 @@ int cx23885_input_init(struct cx23885_dev *dev)
                rc->input_id.product = dev->pci->device;
        }
        rc->dev.parent = &dev->pci->dev;
-       rc->driver_type = driver_type;
        rc->allowed_protocols = allowed_protos;
        rc->priv = kernel_ir;
        rc->open = cx23885_input_ir_open;
index c7b3cb406499b0b7d0319f64cc0891e03bcd485a..01f2e472a2a09c9ba0bfd8b0d5bdb61f218c343f 100644 (file)
@@ -274,7 +274,7 @@ int cx88_ir_init(struct cx88_core *core, struct pci_dev *pci)
                                 */
 
        ir = kzalloc(sizeof(*ir), GFP_KERNEL);
-       dev = rc_allocate_device();
+       dev = rc_allocate_device(RC_DRIVER_IR_RAW);
        if (!ir || !dev)
                goto err_out_free;
 
@@ -484,7 +484,6 @@ int cx88_ir_init(struct cx88_core *core, struct pci_dev *pci)
        dev->scancode_mask = hardware_mask;
 
        if (ir->sampling) {
-               dev->driver_type = RC_DRIVER_IR_RAW;
                dev->timeout = 10 * 1000 * 1000; /* 10 ms */
        } else {
                dev->driver_type = RC_DRIVER_SCANCODE;
index 28dc1f8f1a5ad32e6808c07c349498e435f2602c..a7724b78fbb463e9be1cef92eb55cd31f96eaba8 100644 (file)
@@ -739,7 +739,7 @@ static int dm1105_ir_init(struct dm1105_dev *dm1105)
        struct rc_dev *dev;
        int err = -ENOMEM;
 
-       dev = rc_allocate_device();
+       dev = rc_allocate_device(RC_DRIVER_SCANCODE);
        if (!dev)
                return -ENOMEM;
 
@@ -748,7 +748,6 @@ static int dm1105_ir_init(struct dm1105_dev *dm1105)
 
        dev->driver_name = MODULE_NAME;
        dev->map_name = RC_MAP_DM1105_NEC;
-       dev->driver_type = RC_DRIVER_SCANCODE;
        dev->input_name = "DVB on-card IR receiver";
        dev->input_phys = dm1105->ir.input_phys;
        dev->input_id.bustype = BUS_PCI;
index 7f7f1d4d7bb1a98984ae03691a20c1d95445bc5e..50d10cb7d49de0fd5222fdf28d55fd3839440f09 100644 (file)
@@ -39,7 +39,7 @@ int mantis_input_init(struct mantis_pci *mantis)
        struct rc_dev *dev;
        int err;
 
-       dev = rc_allocate_device();
+       dev = rc_allocate_device(RC_DRIVER_SCANCODE);
        if (!dev) {
                dprintk(MANTIS_ERROR, 1, "Remote device allocation failed");
                err = -ENOMEM;
index 91b883765ce47daae68cbea09f410675af95d145..78849c19f68a97232c3fb02d549196c77e3937e8 100644 (file)
@@ -842,7 +842,7 @@ int saa7134_input_init1(struct saa7134_dev *dev)
        }
 
        ir = kzalloc(sizeof(*ir), GFP_KERNEL);
-       rc = rc_allocate_device();
+       rc = rc_allocate_device(RC_DRIVER_SCANCODE);
        if (!ir || !rc) {
                err = -ENOMEM;
                goto err_out_free;
index 826c7c75e64d13cdcea14a8c5c35981fc2085041..d2730c3fdbae5b60ae22a7fc8ac6af1ceb4ecbbc 100644 (file)
@@ -183,7 +183,7 @@ int smi_ir_init(struct smi_dev *dev)
        struct rc_dev *rc_dev;
        struct smi_rc *ir = &dev->ir;
 
-       rc_dev = rc_allocate_device();
+       rc_dev = rc_allocate_device(RC_DRIVER_SCANCODE);
        if (!rc_dev)
                return -ENOMEM;
 
@@ -202,7 +202,6 @@ int smi_ir_init(struct smi_dev *dev)
        rc_dev->input_id.product = dev->pci_dev->subsystem_device;
        rc_dev->dev.parent = &dev->pci_dev->dev;
 
-       rc_dev->driver_type = RC_DRIVER_SCANCODE;
        rc_dev->map_name = dev->info->rc_map;
 
        ir->rc_dev = rc_dev;
index 919d275b9712c30ad335c61ed4e61da10adfe2dd..68355484ba7d5bd828cd3a8d9ec5f2e51574f90d 100644 (file)
@@ -174,7 +174,7 @@ static int msp430_ir_init(struct budget_ci *budget_ci)
        struct rc_dev *dev;
        int error;
 
-       dev = rc_allocate_device();
+       dev = rc_allocate_device(RC_DRIVER_SCANCODE);
        if (!dev) {
                printk(KERN_ERR "budget_ci: IR interface initialisation failed\n");
                return -ENOMEM;
index 2f6699e7adcde789074066bdee749ab0f68e242b..9cf3e69de16a4cde23dcc4c166089223beae5f53 100644 (file)
@@ -760,7 +760,6 @@ static void ati_remote_rc_init(struct ati_remote *ati_remote)
        struct rc_dev *rdev = ati_remote->rdev;
 
        rdev->priv = ati_remote;
-       rdev->driver_type = RC_DRIVER_SCANCODE;
        rdev->allowed_protocols = RC_BIT_OTHER;
        rdev->driver_name = "ati_remote";
 
@@ -847,7 +846,7 @@ static int ati_remote_probe(struct usb_interface *interface,
        }
 
        ati_remote = kzalloc(sizeof (struct ati_remote), GFP_KERNEL);
-       rc_dev = rc_allocate_device();
+       rc_dev = rc_allocate_device(RC_DRIVER_SCANCODE);
        if (!ati_remote || !rc_dev)
                goto exit_free_dev_rdev;
 
index fbfefb7a5f7d5fa4fd9d08e7143e4e3f0f1565ec..60da963f40dca448b0cab7269de5e11724fa6a03 100644 (file)
@@ -1007,7 +1007,7 @@ static int ene_probe(struct pnp_dev *pnp_dev, const struct pnp_device_id *id)
 
        /* allocate memory */
        dev = kzalloc(sizeof(struct ene_device), GFP_KERNEL);
-       rdev = rc_allocate_device();
+       rdev = rc_allocate_device(RC_DRIVER_IR_RAW);
        if (!dev || !rdev)
                goto exit_free_dev_rdev;
 
@@ -1053,7 +1053,6 @@ static int ene_probe(struct pnp_dev *pnp_dev, const struct pnp_device_id *id)
        if (!dev->hw_learning_and_tx_capable)
                learning_mode_force = false;
 
-       rdev->driver_type = RC_DRIVER_IR_RAW;
        rdev->allowed_protocols = RC_BIT_ALL_IR_DECODER;
        rdev->priv = dev;
        rdev->open = ene_open;
index b391b2f8ab7990d7d8b5ec8f130ad5b774173a2a..0d3562712f273c968653b95aa5a0dc772a176391 100644 (file)
@@ -487,7 +487,7 @@ static int fintek_probe(struct pnp_dev *pdev, const struct pnp_device_id *dev_id
                return ret;
 
        /* input device for IR remote (and tx) */
-       rdev = rc_allocate_device();
+       rdev = rc_allocate_device(RC_DRIVER_IR_RAW);
        if (!rdev)
                goto exit_free_dev_rdev;
 
@@ -529,7 +529,6 @@ 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_protocols = RC_BIT_ALL_IR_DECODER;
        rdev->open = fintek_open;
        rdev->close = fintek_close;
index 0b5aec4b9c9d5b527fcb3e06342d4d09d031a589..4a4895e4d5993afddf0ef667ced79b055f21035b 100644 (file)
@@ -143,14 +143,13 @@ static int gpio_ir_recv_probe(struct platform_device *pdev)
        if (!gpio_dev)
                return -ENOMEM;
 
-       rcdev = rc_allocate_device();
+       rcdev = rc_allocate_device(RC_DRIVER_IR_RAW);
        if (!rcdev) {
                rc = -ENOMEM;
                goto err_allocate_device;
        }
 
        rcdev->priv = gpio_dev;
-       rcdev->driver_type = RC_DRIVER_IR_RAW;
        rcdev->input_name = GPIO_IR_DEVICE_NAME;
        rcdev->input_phys = GPIO_IR_DEVICE_NAME "/input0";
        rcdev->input_id.bustype = BUS_HOST;
index 4c4827c3408b6a1868cb3d149bec0092dfdaa14b..0f0ed4ea4d06bd3e4671d3ee6070eda2d496abbe 100644 (file)
@@ -190,7 +190,7 @@ static int igorplugusb_probe(struct usb_interface *intf,
 
        usb_make_path(udev, ir->phys, sizeof(ir->phys));
 
-       rc = rc_allocate_device();
+       rc = rc_allocate_device(RC_DRIVER_IR_RAW);
        if (!rc)
                goto fail;
 
@@ -198,7 +198,6 @@ static int igorplugusb_probe(struct usb_interface *intf,
        rc->input_phys = ir->phys;
        usb_to_input_id(udev, &rc->input_id);
        rc->dev.parent = &intf->dev;
-       rc->driver_type = RC_DRIVER_IR_RAW;
        /*
         * This device can only store 36 pulses + spaces, which is not enough
         * for the NEC protocol and many others.
index 75e1dfb1be26b469e2e592f5556d85ffc30dc4b0..ccf24fd7ec1bbc65b16ece57979b2025182617df 100644 (file)
@@ -427,7 +427,7 @@ static int iguanair_probe(struct usb_interface *intf,
        struct usb_host_interface *idesc;
 
        ir = kzalloc(sizeof(*ir), GFP_KERNEL);
-       rc = rc_allocate_device();
+       rc = rc_allocate_device(RC_DRIVER_IR_RAW);
        if (!ir || !rc) {
                ret = -ENOMEM;
                goto out;
@@ -490,7 +490,6 @@ static int iguanair_probe(struct usb_interface *intf,
        rc->input_phys = ir->phys;
        usb_to_input_id(ir->udev, &rc->input_id);
        rc->dev.parent = &intf->dev;
-       rc->driver_type = RC_DRIVER_IR_RAW;
        rc->allowed_protocols = RC_BIT_ALL_IR_DECODER;
        rc->priv = ir;
        rc->open = iguanair_open;
index 8e2b64135c3984c18d171d04348b2ba62bdd701c..431d33b36fb03d97f1379c45952563be806ffbf4 100644 (file)
@@ -1078,7 +1078,7 @@ int img_ir_probe_hw(struct img_ir_priv *priv)
        }
 
        /* Allocate hardware decoder */
-       hw->rdev = rdev = rc_allocate_device();
+       hw->rdev = rdev = rc_allocate_device(RC_DRIVER_SCANCODE);
        if (!rdev) {
                dev_err(priv->dev, "cannot allocate input device\n");
                error = -ENOMEM;
index 33f37ed87ad2909e5b53e1a4083c99e46d70d68d..8d2f8e2006e7bdce9ade9bc9fd3cb144d4d84126 100644 (file)
@@ -110,7 +110,7 @@ int img_ir_probe_raw(struct img_ir_priv *priv)
        setup_timer(&raw->timer, img_ir_echo_timer, (unsigned long)priv);
 
        /* Allocate raw decoder */
-       raw->rdev = rdev = rc_allocate_device();
+       raw->rdev = rdev = rc_allocate_device(RC_DRIVER_IR_RAW);
        if (!rdev) {
                dev_err(priv->dev, "cannot allocate raw input device\n");
                return -ENOMEM;
@@ -118,7 +118,6 @@ int img_ir_probe_raw(struct img_ir_priv *priv)
        rdev->priv = priv;
        rdev->map_name = RC_MAP_EMPTY;
        rdev->input_name = "IMG Infrared Decoder Raw";
-       rdev->driver_type = RC_DRIVER_IR_RAW;
 
        /* Register raw decoder */
        error = rc_register_device(rdev);
index 31ffc6a7b2eb9ca7e9fc8019ff86e2f2d470b785..ef1f33e962b62e356bbde01f0dbde25639e4b179 100644 (file)
@@ -1935,7 +1935,7 @@ static struct rc_dev *imon_init_rdev(struct imon_context *ictx)
        const unsigned char fp_packet[] = { 0x40, 0x00, 0x00, 0x00,
                                            0x00, 0x00, 0x00, 0x88 };
 
-       rdev = rc_allocate_device();
+       rdev = rc_allocate_device(RC_DRIVER_SCANCODE);
        if (!rdev) {
                dev_err(ictx->dev, "remote control dev allocation failed\n");
                goto out;
@@ -1953,7 +1953,6 @@ static struct rc_dev *imon_init_rdev(struct imon_context *ictx)
        rdev->dev.parent = ictx->dev;
 
        rdev->priv = ictx;
-       rdev->driver_type = RC_DRIVER_SCANCODE;
        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;
index d95056ad26dcb3f8206016db8b4fc13b252c86d9..50951f68685275985515c49841c5402141db006f 100644 (file)
@@ -229,7 +229,7 @@ static int hix5hd2_ir_probe(struct platform_device *pdev)
                return priv->irq;
        }
 
-       rdev = rc_allocate_device();
+       rdev = rc_allocate_device(RC_DRIVER_IR_RAW);
        if (!rdev)
                return -ENOMEM;
 
@@ -242,7 +242,6 @@ static int hix5hd2_ir_probe(struct platform_device *pdev)
        clk_prepare_enable(priv->clock);
        priv->rate = clk_get_rate(priv->clock);
 
-       rdev->driver_type = RC_DRIVER_IR_RAW;
        rdev->allowed_protocols = RC_BIT_ALL_IR_DECODER;
        rdev->priv = priv;
        rdev->open = hix5hd2_ir_open;
index 3bffc169b31e82d7fa2c21b9c71e1735c9b645f3..e9e4befbbebb8126220f02e79e9278e69b23fe5a 100644 (file)
@@ -1465,7 +1465,7 @@ static int ite_probe(struct pnp_dev *pdev, const struct pnp_device_id
                return ret;
 
        /* input device for IR remote (and tx) */
-       rdev = rc_allocate_device();
+       rdev = rc_allocate_device(RC_DRIVER_IR_RAW);
        if (!rdev)
                goto exit_free_dev_rdev;
        itdev->rdev = rdev;
@@ -1556,7 +1556,6 @@ 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_protocols = RC_BIT_ALL_IR_DECODER;
        rdev->open = ite_open;
        rdev->close = ite_close;
index 85b220435ff55056fbd74e51b1c5abc8edbf8cf0..238d8eaf7d94f8e2a1346b4c9889176d8a21e3b0 100644 (file)
@@ -1177,7 +1177,7 @@ static struct rc_dev *mceusb_init_rc_dev(struct mceusb_dev *ir)
        struct rc_dev *rc;
        int ret;
 
-       rc = rc_allocate_device();
+       rc = rc_allocate_device(RC_DRIVER_IR_RAW);
        if (!rc) {
                dev_err(dev, "remote dev allocation failed");
                goto out;
@@ -1197,7 +1197,6 @@ static struct rc_dev *mceusb_init_rc_dev(struct mceusb_dev *ir)
        usb_to_input_id(ir->usbdev, &rc->input_id);
        rc->dev.parent = dev;
        rc->priv = ir;
-       rc->driver_type = RC_DRIVER_IR_RAW;
        rc->allowed_protocols = RC_BIT_ALL_IR_DECODER;
        rc->timeout = MS_TO_NS(100);
        if (!ir->flags.no_tx) {
index 3e96e6f1b0c56e2c98ca26f971d12b47875a45e5..5576dbd6b1a4daa9fb5d96da7ee88e4bc056878c 100644 (file)
@@ -131,7 +131,7 @@ static int meson_ir_probe(struct platform_device *pdev)
                return ir->irq;
        }
 
-       ir->rc = rc_allocate_device();
+       ir->rc = rc_allocate_device(RC_DRIVER_IR_RAW);
        if (!ir->rc) {
                dev_err(dev, "failed to allocate rc device\n");
                return -ENOMEM;
@@ -144,7 +144,6 @@ static int meson_ir_probe(struct platform_device *pdev)
        map_name = of_get_property(node, "linux,rc-map-name", NULL);
        ir->rc->map_name = map_name ? map_name : RC_MAP_EMPTY;
        ir->rc->dev.parent = dev;
-       ir->rc->driver_type = RC_DRIVER_IR_RAW;
        ir->rc->allowed_protocols = RC_BIT_ALL_IR_DECODER;
        ir->rc->rx_resolution = US_TO_NS(MESON_TRATE);
        ir->rc->timeout = MS_TO_NS(200);
index a849eed43d419911cafcd9b8ea4f8490079676d1..b109f8246b968d99cacde9b6ee73719f554a4bfd 100644 (file)
@@ -1062,7 +1062,7 @@ static int nvt_probe(struct pnp_dev *pdev, const struct pnp_device_id *dev_id)
                return -ENOMEM;
 
        /* input device for IR remote (and tx) */
-       nvt->rdev = devm_rc_allocate_device(&pdev->dev);
+       nvt->rdev = devm_rc_allocate_device(&pdev->dev, RC_DRIVER_IR_RAW);
        if (!nvt->rdev)
                return -ENOMEM;
        rdev = nvt->rdev;
@@ -1125,7 +1125,6 @@ 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_protocols = RC_BIT_ALL_IR_DECODER;
        rdev->allowed_wakeup_protocols = RC_BIT_ALL_IR_ENCODER;
        rdev->encode_wakeup = true;
index 294c0fdbc5a9b99edf6e430ed91bd3c52e85c18e..62195af24fbe7769a8d806454a15329eb72fa8da 100644 (file)
@@ -213,7 +213,7 @@ static int __init loop_init(void)
        struct rc_dev *rc;
        int ret;
 
-       rc = rc_allocate_device();
+       rc = rc_allocate_device(RC_DRIVER_IR_RAW);
        if (!rc) {
                printk(KERN_ERR DRIVER_NAME ": rc_dev allocation failed\n");
                return -ENOMEM;
@@ -226,7 +226,6 @@ static int __init loop_init(void)
        rc->driver_name         = DRIVER_NAME;
        rc->map_name            = RC_MAP_EMPTY;
        rc->priv                = &loopdev;
-       rc->driver_type         = RC_DRIVER_IR_RAW;
        rc->allowed_protocols   = RC_BIT_ALL_IR_DECODER;
        rc->allowed_wakeup_protocols = RC_BIT_ALL_IR_ENCODER;
        rc->encode_wakeup       = true;
index d7a1d8cbdf045c0e8e707e3d3d1f389490de9002..aae9f1fc42541e1681bc5dc4f450ba4f92ab8a44 100644 (file)
@@ -1577,7 +1577,7 @@ static struct device_type rc_dev_type = {
        .uevent         = rc_dev_uevent,
 };
 
-struct rc_dev *rc_allocate_device(void)
+struct rc_dev *rc_allocate_device(enum rc_driver_type type)
 {
        struct rc_dev *dev;
 
@@ -1604,6 +1604,8 @@ struct rc_dev *rc_allocate_device(void)
        dev->dev.class = &rc_class;
        device_initialize(&dev->dev);
 
+       dev->driver_type = type;
+
        __module_get(THIS_MODULE);
        return dev;
 }
@@ -1630,7 +1632,8 @@ static void devm_rc_alloc_release(struct device *dev, void *res)
        rc_free_device(*(struct rc_dev **)res);
 }
 
-struct rc_dev *devm_rc_allocate_device(struct device *dev)
+struct rc_dev *devm_rc_allocate_device(struct device *dev,
+                                      enum rc_driver_type type)
 {
        struct rc_dev **dr, *rc;
 
@@ -1638,7 +1641,7 @@ struct rc_dev *devm_rc_allocate_device(struct device *dev)
        if (!dr)
                return NULL;
 
-       rc = rc_allocate_device();
+       rc = rc_allocate_device(type);
        if (!rc) {
                devres_free(dr);
                return NULL;
index 4ab0ea02a309be47e5caa826762d13c04289053f..56d43be2756b8c645e633cd9b03f6729a387a982 100644 (file)
@@ -941,7 +941,7 @@ static struct rc_dev *redrat3_init_rc_dev(struct redrat3_dev *rr3)
        int ret;
        u16 prod = le16_to_cpu(rr3->udev->descriptor.idProduct);
 
-       rc = rc_allocate_device();
+       rc = rc_allocate_device(RC_DRIVER_IR_RAW);
        if (!rc)
                return NULL;
 
@@ -956,7 +956,6 @@ static struct rc_dev *redrat3_init_rc_dev(struct redrat3_dev *rr3)
        usb_to_input_id(rr3->udev, &rc->input_id);
        rc->dev.parent = dev;
        rc->priv = rr3;
-       rc->driver_type = RC_DRIVER_IR_RAW;
        rc->allowed_protocols = RC_BIT_ALL_IR_DECODER;
        rc->min_timeout = MS_TO_NS(RR3_RX_MIN_TIMEOUT);
        rc->max_timeout = MS_TO_NS(RR3_RX_MAX_TIMEOUT);
index 408594ea896c347bab1bb7f429b0aec9b5a28d96..923fb2299553cb96c0db87368a322ea875da4652 100644 (file)
@@ -757,7 +757,7 @@ static int __init serial_ir_init_module(void)
        if (result)
                return result;
 
-       rcdev = devm_rc_allocate_device(&serial_ir.pdev->dev);
+       rcdev = devm_rc_allocate_device(&serial_ir.pdev->dev, RC_DRIVER_IR_RAW);
        if (!rcdev) {
                result = -ENOMEM;
                goto serial_cleanup;
@@ -796,7 +796,6 @@ static int __init serial_ir_init_module(void)
        rcdev->open = serial_ir_open;
        rcdev->close = serial_ir_close;
        rcdev->dev.parent = &serial_ir.pdev->dev;
-       rcdev->driver_type = RC_DRIVER_IR_RAW;
        rcdev->allowed_protocols = RC_BIT_ALL_IR_DECODER;
        rcdev->driver_name = KBUILD_MODNAME;
        rcdev->map_name = RC_MAP_RC6_MCE;
index 80a46e7a779f2b0400bd05ab5ea78272abc54b8c..f0d7190e391952be799b5265d8a78c217bbc9430 100644 (file)
@@ -235,7 +235,7 @@ static int st_rc_probe(struct platform_device *pdev)
        if (!rc_dev)
                return -ENOMEM;
 
-       rdev = rc_allocate_device();
+       rdev = rc_allocate_device(RC_DRIVER_IR_RAW);
 
        if (!rdev)
                return -ENOMEM;
@@ -290,7 +290,6 @@ static int st_rc_probe(struct platform_device *pdev)
        platform_set_drvdata(pdev, rc_dev);
        st_rc_hardware_init(rc_dev);
 
-       rdev->driver_type = RC_DRIVER_IR_RAW;
        rdev->allowed_protocols = RC_BIT_ALL_IR_DECODER;
        /* rx sampling rate is 10Mhz */
        rdev->rx_resolution = 100;
index f6391dd6e29f73d7e57c7bfae7178e23b8d54933..b09c45abb5f3280d2b2c474ea49528bf9333e35f 100644 (file)
@@ -287,7 +287,7 @@ static struct rc_dev *streamzap_init_rc_dev(struct streamzap_ir *sz)
        struct device *dev = sz->dev;
        int ret;
 
-       rdev = rc_allocate_device();
+       rdev = rc_allocate_device(RC_DRIVER_IR_RAW);
        if (!rdev) {
                dev_err(dev, "remote dev allocation failed\n");
                goto out;
@@ -304,7 +304,6 @@ static struct rc_dev *streamzap_init_rc_dev(struct streamzap_ir *sz)
        usb_to_input_id(sz->usbdev, &rdev->input_id);
        rdev->dev.parent = dev;
        rdev->priv = sz;
-       rdev->driver_type = RC_DRIVER_IR_RAW;
        rdev->allowed_protocols = RC_BIT_ALL_IR_DECODER;
        rdev->driver_name = DRIVER_NAME;
        rdev->map_name = RC_MAP_STREAMZAP;
index 42bca8d7b4514f67d78402addcc0bdc842149dbc..25b006167810221a26181e9128070ea12eb4ee15 100644 (file)
@@ -212,7 +212,7 @@ static int sunxi_ir_probe(struct platform_device *pdev)
                goto exit_clkdisable_clk;
        }
 
-       ir->rc = rc_allocate_device();
+       ir->rc = rc_allocate_device(RC_DRIVER_IR_RAW);
        if (!ir->rc) {
                dev_err(dev, "failed to allocate device\n");
                ret = -ENOMEM;
@@ -229,7 +229,6 @@ static int sunxi_ir_probe(struct platform_device *pdev)
        ir->map_name = of_get_property(dn, "linux,rc-map-name", NULL);
        ir->rc->map_name = ir->map_name ?: RC_MAP_EMPTY;
        ir->rc->dev.parent = dev;
-       ir->rc->driver_type = RC_DRIVER_IR_RAW;
        ir->rc->allowed_protocols = RC_BIT_ALL_IR_DECODER;
        ir->rc->rx_resolution = SUNXI_IR_SAMPLE;
        ir->rc->timeout = MS_TO_NS(SUNXI_IR_TIMEOUT);
index cf70e0403294cfec52f96b5c3726cd2e212e03fb..23be7702e2dfbf0ee4989cb968ed81288aef68cd 100644 (file)
@@ -201,7 +201,7 @@ static int ttusbir_probe(struct usb_interface *intf,
        int altsetting = -1;
 
        tt = kzalloc(sizeof(*tt), GFP_KERNEL);
-       rc = rc_allocate_device();
+       rc = rc_allocate_device(RC_DRIVER_IR_RAW);
        if (!tt || !rc) {
                ret = -ENOMEM;
                goto out;
@@ -313,7 +313,6 @@ static int ttusbir_probe(struct usb_interface *intf,
        rc->input_phys = tt->phys;
        usb_to_input_id(tt->udev, &rc->input_id);
        rc->dev.parent = &intf->dev;
-       rc->driver_type = RC_DRIVER_IR_RAW;
        rc->allowed_protocols = RC_BIT_ALL_IR_DECODER;
        rc->priv = tt;
        rc->driver_name = DRIVER_NAME;
index 068e81a78125f2d8c5427f9fbff92bfe585cf5eb..dc1c8305ad23572933f63caa1e340592e40c65a4 100644 (file)
@@ -1061,13 +1061,12 @@ wbcir_probe(struct pnp_dev *device, const struct pnp_device_id *dev_id)
        if (err)
                goto exit_free_data;
 
-       data->dev = rc_allocate_device();
+       data->dev = rc_allocate_device(RC_DRIVER_IR_RAW);
        if (!data->dev) {
                err = -ENOMEM;
                goto exit_unregister_led;
        }
 
-       data->dev->driver_type = RC_DRIVER_IR_RAW;
        data->dev->driver_name = DRVNAME;
        data->dev->input_name = WBCIR_NAME;
        data->dev->input_phys = "wbcir/cir0";
index 1e66e7828d8f2921ad954e5568534ebb55dbffde..9ec919c68482df5c5c97e4a41d421f71411422ee 100644 (file)
@@ -298,7 +298,7 @@ int au0828_rc_register(struct au0828_dev *dev)
                return -ENODEV;
 
        ir = kzalloc(sizeof(*ir), GFP_KERNEL);
-       rc = rc_allocate_device();
+       rc = rc_allocate_device(RC_DRIVER_IR_RAW);
        if (!ir || !rc)
                goto error;
 
@@ -343,7 +343,6 @@ int au0828_rc_register(struct au0828_dev *dev)
        rc->input_id.product = le16_to_cpu(dev->usbdev->descriptor.idProduct);
        rc->dev.parent = &dev->usbdev->dev;
        rc->driver_name = "au0828-input";
-       rc->driver_type = RC_DRIVER_IR_RAW;
        rc->allowed_protocols = RC_BIT_NEC | RC_BIT_NECX | RC_BIT_NEC32 |
                                                                RC_BIT_RC5;
 
index 15d8d1b5f05ca73feb8817e3b6c1132d45f17f04..6e80f3c573f36a623bf2b30309642cdd9dba25d3 100644 (file)
@@ -72,7 +72,7 @@ int cx231xx_ir_init(struct cx231xx *dev)
 
        memset(&info, 0, sizeof(struct i2c_board_info));
        memset(&dev->init_data, 0, sizeof(dev->init_data));
-       dev->init_data.rc_dev = rc_allocate_device();
+       dev->init_data.rc_dev = rc_allocate_device(RC_DRIVER_SCANCODE);
        if (!dev->init_data.rc_dev)
                return -ENOMEM;
 
index a8e6624fbe8347fb48055d0048cd4bf84575edc1..298c91a6f1f96bd6adb2b055a4e1ee7c7d8aabb7 100644 (file)
@@ -147,7 +147,7 @@ static int dvb_usbv2_remote_init(struct dvb_usb_device *d)
        if (!d->rc.map_name)
                return 0;
 
-       dev = rc_allocate_device();
+       dev = rc_allocate_device(d->rc.driver_type);
        if (!dev) {
                ret = -ENOMEM;
                goto err;
@@ -162,7 +162,6 @@ static int dvb_usbv2_remote_init(struct dvb_usb_device *d)
        /* TODO: likely RC-core should took const char * */
        dev->driver_name = (char *) d->props->driver_name;
        dev->map_name = d->rc.map_name;
-       dev->driver_type = d->rc.driver_type;
        dev->allowed_protocols = d->rc.allowed_protos;
        dev->change_protocol = d->rc.change_protocol;
        dev->priv = d;
index c259f9e43542970d87a32ca2e79806d87d193a8e..059ded59208e8af0275b064efd5c5659130ae228 100644 (file)
@@ -265,7 +265,7 @@ static int rc_core_dvb_usb_remote_init(struct dvb_usb_device *d)
        int err, rc_interval;
        struct rc_dev *dev;
 
-       dev = rc_allocate_device();
+       dev = rc_allocate_device(d->props.rc.core.driver_type);
        if (!dev)
                return -ENOMEM;
 
@@ -273,7 +273,6 @@ static int rc_core_dvb_usb_remote_init(struct dvb_usb_device *d)
        dev->map_name = d->props.rc.core.rc_codes;
        dev->change_protocol = d->props.rc.core.change_protocol;
        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";
        dev->input_phys = d->rc_phys;
index d1ba2c4706450419891b087063cd8cce0d60c8ec..eba75736e65406a39c547df442ebbb5835836cf6 100644 (file)
@@ -722,7 +722,7 @@ static int em28xx_ir_init(struct em28xx *dev)
        ir = kzalloc(sizeof(*ir), GFP_KERNEL);
        if (!ir)
                return -ENOMEM;
-       rc = rc_allocate_device();
+       rc = rc_allocate_device(RC_DRIVER_SCANCODE);
        if (!rc)
                goto error;
 
index 83d59456680abd6ddd6e260fb77b787bf50ee943..ef0dbd9c95f3ccd8653526036c3fc00f4dc34a98 100644 (file)
@@ -425,7 +425,7 @@ int tm6000_ir_init(struct tm6000_core *dev)
                return 0;
 
        ir = kzalloc(sizeof(*ir), GFP_ATOMIC);
-       rc = rc_allocate_device();
+       rc = rc_allocate_device(RC_DRIVER_SCANCODE);
        if (!ir || !rc)
                goto out;
 
@@ -452,7 +452,6 @@ int tm6000_ir_init(struct tm6000_core *dev)
                ir->polling = 50;
                INIT_DELAYED_WORK(&ir->work, tm6000_ir_handle_key);
        }
-       rc->driver_type = RC_DRIVER_SCANCODE;
 
        snprintf(ir->name, sizeof(ir->name), "tm5600/60x0 IR (%s)",
                                                dev->name);
index cf9fabcee33ec3576b00df587f580748b10ce6f5..8c2252686955e53ddc408d02d315728cf79b04d3 100644 (file)
@@ -203,17 +203,19 @@ struct rc_dev {
 /**
  * rc_allocate_device - Allocates a RC device
  *
+ * @rc_driver_type: specifies the type of the RC output to be allocated
  * returns a pointer to struct rc_dev.
  */
-struct rc_dev *rc_allocate_device(void);
+struct rc_dev *rc_allocate_device(enum rc_driver_type);
 
 /**
  * devm_rc_allocate_device - Managed RC device allocation
  *
  * @dev: pointer to struct device
+ * @rc_driver_type: specifies the type of the RC output to be allocated
  * returns a pointer to struct rc_dev.
  */
-struct rc_dev *devm_rc_allocate_device(struct device *dev);
+struct rc_dev *devm_rc_allocate_device(struct device *dev, enum rc_driver_type);
 
 /**
  * rc_free_device - Frees a RC device