summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndi Shyti <andi.shyti@samsung.com>2016-12-16 03:50:58 -0500
committerMauro Carvalho Chehab <mchehab@s-opensource.com>2017-01-30 10:59:57 -0500
commit0f7499fddb153a333dff3c1dc4280c178b9b5a80 (patch)
tree23d954a3eeb12d98f0978715d3d10753163a0efe
parent97c129747af52c23a4dd9c6fc8c73ab8be3b9038 (diff)
[media] rc-main: assign driver type during allocation
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>
-rw-r--r--drivers/hid/hid-picolcd_cir.c3
-rw-r--r--drivers/media/cec/cec-core.c3
-rw-r--r--drivers/media/common/siano/smsir.c3
-rw-r--r--drivers/media/i2c/ir-kbd-i2c.c2
-rw-r--r--drivers/media/pci/bt8xx/bttv-input.c2
-rw-r--r--drivers/media/pci/cx23885/cx23885-input.c11
-rw-r--r--drivers/media/pci/cx88/cx88-input.c3
-rw-r--r--drivers/media/pci/dm1105/dm1105.c3
-rw-r--r--drivers/media/pci/mantis/mantis_input.c2
-rw-r--r--drivers/media/pci/saa7134/saa7134-input.c2
-rw-r--r--drivers/media/pci/smipcie/smipcie-ir.c3
-rw-r--r--drivers/media/pci/ttpci/budget-ci.c2
-rw-r--r--drivers/media/rc/ati_remote.c3
-rw-r--r--drivers/media/rc/ene_ir.c3
-rw-r--r--drivers/media/rc/fintek-cir.c3
-rw-r--r--drivers/media/rc/gpio-ir-recv.c3
-rw-r--r--drivers/media/rc/igorplugusb.c3
-rw-r--r--drivers/media/rc/iguanair.c3
-rw-r--r--drivers/media/rc/img-ir/img-ir-hw.c2
-rw-r--r--drivers/media/rc/img-ir/img-ir-raw.c3
-rw-r--r--drivers/media/rc/imon.c3
-rw-r--r--drivers/media/rc/ir-hix5hd2.c3
-rw-r--r--drivers/media/rc/ite-cir.c3
-rw-r--r--drivers/media/rc/mceusb.c3
-rw-r--r--drivers/media/rc/meson-ir.c3
-rw-r--r--drivers/media/rc/nuvoton-cir.c3
-rw-r--r--drivers/media/rc/rc-loopback.c3
-rw-r--r--drivers/media/rc/rc-main.c9
-rw-r--r--drivers/media/rc/redrat3.c3
-rw-r--r--drivers/media/rc/serial_ir.c3
-rw-r--r--drivers/media/rc/st_rc.c3
-rw-r--r--drivers/media/rc/streamzap.c3
-rw-r--r--drivers/media/rc/sunxi-cir.c3
-rw-r--r--drivers/media/rc/ttusbir.c3
-rw-r--r--drivers/media/rc/winbond-cir.c3
-rw-r--r--drivers/media/usb/au0828/au0828-input.c3
-rw-r--r--drivers/media/usb/cx231xx/cx231xx-input.c2
-rw-r--r--drivers/media/usb/dvb-usb-v2/dvb_usb_core.c3
-rw-r--r--drivers/media/usb/dvb-usb/dvb-usb-remote.c3
-rw-r--r--drivers/media/usb/em28xx/em28xx-input.c2
-rw-r--r--drivers/media/usb/tm6000/tm6000-input.c3
-rw-r--r--include/media/rc-core.h6
42 files changed, 50 insertions, 85 deletions
diff --git a/drivers/hid/hid-picolcd_cir.c b/drivers/hid/hid-picolcd_cir.c
index 90add97cc54d..8ffbb6f65a65 100644
--- a/drivers/hid/hid-picolcd_cir.c
+++ b/drivers/hid/hid-picolcd_cir.c
@@ -108,12 +108,11 @@ int picolcd_init_cir(struct picolcd_data *data, struct hid_report *report)
108 struct rc_dev *rdev; 108 struct rc_dev *rdev;
109 int ret = 0; 109 int ret = 0;
110 110
111 rdev = rc_allocate_device(); 111 rdev = rc_allocate_device(RC_DRIVER_IR_RAW);
112 if (!rdev) 112 if (!rdev)
113 return -ENOMEM; 113 return -ENOMEM;
114 114
115 rdev->priv = data; 115 rdev->priv = data;
116 rdev->driver_type = RC_DRIVER_IR_RAW;
117 rdev->allowed_protocols = RC_BIT_ALL_IR_DECODER; 116 rdev->allowed_protocols = RC_BIT_ALL_IR_DECODER;
118 rdev->open = picolcd_cir_open; 117 rdev->open = picolcd_cir_open;
119 rdev->close = picolcd_cir_close; 118 rdev->close = picolcd_cir_close;
diff --git a/drivers/media/cec/cec-core.c b/drivers/media/cec/cec-core.c
index aca3ab83a8a1..37217e205040 100644
--- a/drivers/media/cec/cec-core.c
+++ b/drivers/media/cec/cec-core.c
@@ -239,7 +239,7 @@ struct cec_adapter *cec_allocate_adapter(const struct cec_adap_ops *ops,
239 239
240#if IS_REACHABLE(CONFIG_RC_CORE) 240#if IS_REACHABLE(CONFIG_RC_CORE)
241 /* Prepare the RC input device */ 241 /* Prepare the RC input device */
242 adap->rc = rc_allocate_device(); 242 adap->rc = rc_allocate_device(RC_DRIVER_SCANCODE);
243 if (!adap->rc) { 243 if (!adap->rc) {
244 pr_err("cec-%s: failed to allocate memory for rc_dev\n", 244 pr_err("cec-%s: failed to allocate memory for rc_dev\n",
245 name); 245 name);
@@ -259,7 +259,6 @@ struct cec_adapter *cec_allocate_adapter(const struct cec_adap_ops *ops,
259 adap->rc->input_id.vendor = 0; 259 adap->rc->input_id.vendor = 0;
260 adap->rc->input_id.product = 0; 260 adap->rc->input_id.product = 0;
261 adap->rc->input_id.version = 1; 261 adap->rc->input_id.version = 1;
262 adap->rc->driver_type = RC_DRIVER_SCANCODE;
263 adap->rc->driver_name = CEC_NAME; 262 adap->rc->driver_name = CEC_NAME;
264 adap->rc->allowed_protocols = RC_BIT_CEC; 263 adap->rc->allowed_protocols = RC_BIT_CEC;
265 adap->rc->priv = adap; 264 adap->rc->priv = adap;
diff --git a/drivers/media/common/siano/smsir.c b/drivers/media/common/siano/smsir.c
index 480d8bf3d26a..7c898b06d85c 100644
--- a/drivers/media/common/siano/smsir.c
+++ b/drivers/media/common/siano/smsir.c
@@ -58,7 +58,7 @@ int sms_ir_init(struct smscore_device_t *coredev)
58 struct rc_dev *dev; 58 struct rc_dev *dev;
59 59
60 pr_debug("Allocating rc device\n"); 60 pr_debug("Allocating rc device\n");
61 dev = rc_allocate_device(); 61 dev = rc_allocate_device(RC_DRIVER_IR_RAW);
62 if (!dev) 62 if (!dev)
63 return -ENOMEM; 63 return -ENOMEM;
64 64
@@ -86,7 +86,6 @@ int sms_ir_init(struct smscore_device_t *coredev)
86#endif 86#endif
87 87
88 dev->priv = coredev; 88 dev->priv = coredev;
89 dev->driver_type = RC_DRIVER_IR_RAW;
90 dev->allowed_protocols = RC_BIT_ALL_IR_DECODER; 89 dev->allowed_protocols = RC_BIT_ALL_IR_DECODER;
91 dev->map_name = sms_get_board(board_id)->rc_codes; 90 dev->map_name = sms_get_board(board_id)->rc_codes;
92 dev->driver_name = MODULE_NAME; 91 dev->driver_name = MODULE_NAME;
diff --git a/drivers/media/i2c/ir-kbd-i2c.c b/drivers/media/i2c/ir-kbd-i2c.c
index b2f39a2c0b6d..cee7fd9cf08b 100644
--- a/drivers/media/i2c/ir-kbd-i2c.c
+++ b/drivers/media/i2c/ir-kbd-i2c.c
@@ -424,7 +424,7 @@ static int ir_probe(struct i2c_client *client, const struct i2c_device_id *id)
424 * If platform_data doesn't specify rc_dev, initialize it 424 * If platform_data doesn't specify rc_dev, initialize it
425 * internally 425 * internally
426 */ 426 */
427 rc = rc_allocate_device(); 427 rc = rc_allocate_device(RC_DRIVER_SCANCODE);
428 if (!rc) 428 if (!rc)
429 return -ENOMEM; 429 return -ENOMEM;
430 } 430 }
diff --git a/drivers/media/pci/bt8xx/bttv-input.c b/drivers/media/pci/bt8xx/bttv-input.c
index 57d26a78d410..2fd07a8afcd2 100644
--- a/drivers/media/pci/bt8xx/bttv-input.c
+++ b/drivers/media/pci/bt8xx/bttv-input.c
@@ -420,7 +420,7 @@ int bttv_input_init(struct bttv *btv)
420 return -ENODEV; 420 return -ENODEV;
421 421
422 ir = kzalloc(sizeof(*ir),GFP_KERNEL); 422 ir = kzalloc(sizeof(*ir),GFP_KERNEL);
423 rc = rc_allocate_device(); 423 rc = rc_allocate_device(RC_DRIVER_SCANCODE);
424 if (!ir || !rc) 424 if (!ir || !rc)
425 goto err_out_free; 425 goto err_out_free;
426 426
diff --git a/drivers/media/pci/cx23885/cx23885-input.c b/drivers/media/pci/cx23885/cx23885-input.c
index 2d4e703b6893..4367cb3162b6 100644
--- a/drivers/media/pci/cx23885/cx23885-input.c
+++ b/drivers/media/pci/cx23885/cx23885-input.c
@@ -267,7 +267,6 @@ int cx23885_input_init(struct cx23885_dev *dev)
267 struct cx23885_kernel_ir *kernel_ir; 267 struct cx23885_kernel_ir *kernel_ir;
268 struct rc_dev *rc; 268 struct rc_dev *rc;
269 char *rc_map; 269 char *rc_map;
270 enum rc_driver_type driver_type;
271 u64 allowed_protos; 270 u64 allowed_protos;
272 271
273 int ret; 272 int ret;
@@ -285,28 +284,24 @@ int cx23885_input_init(struct cx23885_dev *dev)
285 case CX23885_BOARD_HAUPPAUGE_HVR1290: 284 case CX23885_BOARD_HAUPPAUGE_HVR1290:
286 case CX23885_BOARD_HAUPPAUGE_HVR1250: 285 case CX23885_BOARD_HAUPPAUGE_HVR1250:
287 /* Integrated CX2388[58] IR controller */ 286 /* Integrated CX2388[58] IR controller */
288 driver_type = RC_DRIVER_IR_RAW;
289 allowed_protos = RC_BIT_ALL_IR_DECODER; 287 allowed_protos = RC_BIT_ALL_IR_DECODER;
290 /* The grey Hauppauge RC-5 remote */ 288 /* The grey Hauppauge RC-5 remote */
291 rc_map = RC_MAP_HAUPPAUGE; 289 rc_map = RC_MAP_HAUPPAUGE;
292 break; 290 break;
293 case CX23885_BOARD_TERRATEC_CINERGY_T_PCIE_DUAL: 291 case CX23885_BOARD_TERRATEC_CINERGY_T_PCIE_DUAL:
294 /* Integrated CX23885 IR controller */ 292 /* Integrated CX23885 IR controller */
295 driver_type = RC_DRIVER_IR_RAW;
296 allowed_protos = RC_BIT_ALL_IR_DECODER; 293 allowed_protos = RC_BIT_ALL_IR_DECODER;
297 /* The grey Terratec remote with orange buttons */ 294 /* The grey Terratec remote with orange buttons */
298 rc_map = RC_MAP_NEC_TERRATEC_CINERGY_XS; 295 rc_map = RC_MAP_NEC_TERRATEC_CINERGY_XS;
299 break; 296 break;
300 case CX23885_BOARD_TEVII_S470: 297 case CX23885_BOARD_TEVII_S470:
301 /* Integrated CX23885 IR controller */ 298 /* Integrated CX23885 IR controller */
302 driver_type = RC_DRIVER_IR_RAW;
303 allowed_protos = RC_BIT_ALL_IR_DECODER; 299 allowed_protos = RC_BIT_ALL_IR_DECODER;
304 /* A guess at the remote */ 300 /* A guess at the remote */
305 rc_map = RC_MAP_TEVII_NEC; 301 rc_map = RC_MAP_TEVII_NEC;
306 break; 302 break;
307 case CX23885_BOARD_MYGICA_X8507: 303 case CX23885_BOARD_MYGICA_X8507:
308 /* Integrated CX23885 IR controller */ 304 /* Integrated CX23885 IR controller */
309 driver_type = RC_DRIVER_IR_RAW;
310 allowed_protos = RC_BIT_ALL_IR_DECODER; 305 allowed_protos = RC_BIT_ALL_IR_DECODER;
311 /* A guess at the remote */ 306 /* A guess at the remote */
312 rc_map = RC_MAP_TOTAL_MEDIA_IN_HAND_02; 307 rc_map = RC_MAP_TOTAL_MEDIA_IN_HAND_02;
@@ -314,7 +309,6 @@ int cx23885_input_init(struct cx23885_dev *dev)
314 case CX23885_BOARD_TBS_6980: 309 case CX23885_BOARD_TBS_6980:
315 case CX23885_BOARD_TBS_6981: 310 case CX23885_BOARD_TBS_6981:
316 /* Integrated CX23885 IR controller */ 311 /* Integrated CX23885 IR controller */
317 driver_type = RC_DRIVER_IR_RAW;
318 allowed_protos = RC_BIT_ALL_IR_DECODER; 312 allowed_protos = RC_BIT_ALL_IR_DECODER;
319 /* A guess at the remote */ 313 /* A guess at the remote */
320 rc_map = RC_MAP_TBS_NEC; 314 rc_map = RC_MAP_TBS_NEC;
@@ -326,13 +320,11 @@ int cx23885_input_init(struct cx23885_dev *dev)
326 case CX23885_BOARD_DVBSKY_S952: 320 case CX23885_BOARD_DVBSKY_S952:
327 case CX23885_BOARD_DVBSKY_T982: 321 case CX23885_BOARD_DVBSKY_T982:
328 /* Integrated CX23885 IR controller */ 322 /* Integrated CX23885 IR controller */
329 driver_type = RC_DRIVER_IR_RAW;
330 allowed_protos = RC_BIT_ALL_IR_DECODER; 323 allowed_protos = RC_BIT_ALL_IR_DECODER;
331 rc_map = RC_MAP_DVBSKY; 324 rc_map = RC_MAP_DVBSKY;
332 break; 325 break;
333 case CX23885_BOARD_TT_CT2_4500_CI: 326 case CX23885_BOARD_TT_CT2_4500_CI:
334 /* Integrated CX23885 IR controller */ 327 /* Integrated CX23885 IR controller */
335 driver_type = RC_DRIVER_IR_RAW;
336 allowed_protos = RC_BIT_ALL_IR_DECODER; 328 allowed_protos = RC_BIT_ALL_IR_DECODER;
337 rc_map = RC_MAP_TT_1500; 329 rc_map = RC_MAP_TT_1500;
338 break; 330 break;
@@ -352,7 +344,7 @@ int cx23885_input_init(struct cx23885_dev *dev)
352 pci_name(dev->pci)); 344 pci_name(dev->pci));
353 345
354 /* input device */ 346 /* input device */
355 rc = rc_allocate_device(); 347 rc = rc_allocate_device(RC_DRIVER_IR_RAW);
356 if (!rc) { 348 if (!rc) {
357 ret = -ENOMEM; 349 ret = -ENOMEM;
358 goto err_out_free; 350 goto err_out_free;
@@ -371,7 +363,6 @@ int cx23885_input_init(struct cx23885_dev *dev)
371 rc->input_id.product = dev->pci->device; 363 rc->input_id.product = dev->pci->device;
372 } 364 }
373 rc->dev.parent = &dev->pci->dev; 365 rc->dev.parent = &dev->pci->dev;
374 rc->driver_type = driver_type;
375 rc->allowed_protocols = allowed_protos; 366 rc->allowed_protocols = allowed_protos;
376 rc->priv = kernel_ir; 367 rc->priv = kernel_ir;
377 rc->open = cx23885_input_ir_open; 368 rc->open = cx23885_input_ir_open;
diff --git a/drivers/media/pci/cx88/cx88-input.c b/drivers/media/pci/cx88/cx88-input.c
index c7b3cb406499..01f2e472a2a0 100644
--- a/drivers/media/pci/cx88/cx88-input.c
+++ b/drivers/media/pci/cx88/cx88-input.c
@@ -274,7 +274,7 @@ int cx88_ir_init(struct cx88_core *core, struct pci_dev *pci)
274 */ 274 */
275 275
276 ir = kzalloc(sizeof(*ir), GFP_KERNEL); 276 ir = kzalloc(sizeof(*ir), GFP_KERNEL);
277 dev = rc_allocate_device(); 277 dev = rc_allocate_device(RC_DRIVER_IR_RAW);
278 if (!ir || !dev) 278 if (!ir || !dev)
279 goto err_out_free; 279 goto err_out_free;
280 280
@@ -484,7 +484,6 @@ int cx88_ir_init(struct cx88_core *core, struct pci_dev *pci)
484 dev->scancode_mask = hardware_mask; 484 dev->scancode_mask = hardware_mask;
485 485
486 if (ir->sampling) { 486 if (ir->sampling) {
487 dev->driver_type = RC_DRIVER_IR_RAW;
488 dev->timeout = 10 * 1000 * 1000; /* 10 ms */ 487 dev->timeout = 10 * 1000 * 1000; /* 10 ms */
489 } else { 488 } else {
490 dev->driver_type = RC_DRIVER_SCANCODE; 489 dev->driver_type = RC_DRIVER_SCANCODE;
diff --git a/drivers/media/pci/dm1105/dm1105.c b/drivers/media/pci/dm1105/dm1105.c
index 28dc1f8f1a5a..a7724b78fbb4 100644
--- a/drivers/media/pci/dm1105/dm1105.c
+++ b/drivers/media/pci/dm1105/dm1105.c
@@ -739,7 +739,7 @@ static int dm1105_ir_init(struct dm1105_dev *dm1105)
739 struct rc_dev *dev; 739 struct rc_dev *dev;
740 int err = -ENOMEM; 740 int err = -ENOMEM;
741 741
742 dev = rc_allocate_device(); 742 dev = rc_allocate_device(RC_DRIVER_SCANCODE);
743 if (!dev) 743 if (!dev)
744 return -ENOMEM; 744 return -ENOMEM;
745 745
@@ -748,7 +748,6 @@ static int dm1105_ir_init(struct dm1105_dev *dm1105)
748 748
749 dev->driver_name = MODULE_NAME; 749 dev->driver_name = MODULE_NAME;
750 dev->map_name = RC_MAP_DM1105_NEC; 750 dev->map_name = RC_MAP_DM1105_NEC;
751 dev->driver_type = RC_DRIVER_SCANCODE;
752 dev->input_name = "DVB on-card IR receiver"; 751 dev->input_name = "DVB on-card IR receiver";
753 dev->input_phys = dm1105->ir.input_phys; 752 dev->input_phys = dm1105->ir.input_phys;
754 dev->input_id.bustype = BUS_PCI; 753 dev->input_id.bustype = BUS_PCI;
diff --git a/drivers/media/pci/mantis/mantis_input.c b/drivers/media/pci/mantis/mantis_input.c
index 7f7f1d4d7bb1..50d10cb7d49d 100644
--- a/drivers/media/pci/mantis/mantis_input.c
+++ b/drivers/media/pci/mantis/mantis_input.c
@@ -39,7 +39,7 @@ int mantis_input_init(struct mantis_pci *mantis)
39 struct rc_dev *dev; 39 struct rc_dev *dev;
40 int err; 40 int err;
41 41
42 dev = rc_allocate_device(); 42 dev = rc_allocate_device(RC_DRIVER_SCANCODE);
43 if (!dev) { 43 if (!dev) {
44 dprintk(MANTIS_ERROR, 1, "Remote device allocation failed"); 44 dprintk(MANTIS_ERROR, 1, "Remote device allocation failed");
45 err = -ENOMEM; 45 err = -ENOMEM;
diff --git a/drivers/media/pci/saa7134/saa7134-input.c b/drivers/media/pci/saa7134/saa7134-input.c
index 91b883765ce4..78849c19f68a 100644
--- a/drivers/media/pci/saa7134/saa7134-input.c
+++ b/drivers/media/pci/saa7134/saa7134-input.c
@@ -842,7 +842,7 @@ int saa7134_input_init1(struct saa7134_dev *dev)
842 } 842 }
843 843
844 ir = kzalloc(sizeof(*ir), GFP_KERNEL); 844 ir = kzalloc(sizeof(*ir), GFP_KERNEL);
845 rc = rc_allocate_device(); 845 rc = rc_allocate_device(RC_DRIVER_SCANCODE);
846 if (!ir || !rc) { 846 if (!ir || !rc) {
847 err = -ENOMEM; 847 err = -ENOMEM;
848 goto err_out_free; 848 goto err_out_free;
diff --git a/drivers/media/pci/smipcie/smipcie-ir.c b/drivers/media/pci/smipcie/smipcie-ir.c
index 826c7c75e64d..d2730c3fdbae 100644
--- a/drivers/media/pci/smipcie/smipcie-ir.c
+++ b/drivers/media/pci/smipcie/smipcie-ir.c
@@ -183,7 +183,7 @@ int smi_ir_init(struct smi_dev *dev)
183 struct rc_dev *rc_dev; 183 struct rc_dev *rc_dev;
184 struct smi_rc *ir = &dev->ir; 184 struct smi_rc *ir = &dev->ir;
185 185
186 rc_dev = rc_allocate_device(); 186 rc_dev = rc_allocate_device(RC_DRIVER_SCANCODE);
187 if (!rc_dev) 187 if (!rc_dev)
188 return -ENOMEM; 188 return -ENOMEM;
189 189
@@ -202,7 +202,6 @@ int smi_ir_init(struct smi_dev *dev)
202 rc_dev->input_id.product = dev->pci_dev->subsystem_device; 202 rc_dev->input_id.product = dev->pci_dev->subsystem_device;
203 rc_dev->dev.parent = &dev->pci_dev->dev; 203 rc_dev->dev.parent = &dev->pci_dev->dev;
204 204
205 rc_dev->driver_type = RC_DRIVER_SCANCODE;
206 rc_dev->map_name = dev->info->rc_map; 205 rc_dev->map_name = dev->info->rc_map;
207 206
208 ir->rc_dev = rc_dev; 207 ir->rc_dev = rc_dev;
diff --git a/drivers/media/pci/ttpci/budget-ci.c b/drivers/media/pci/ttpci/budget-ci.c
index 919d275b9712..68355484ba7d 100644
--- a/drivers/media/pci/ttpci/budget-ci.c
+++ b/drivers/media/pci/ttpci/budget-ci.c
@@ -174,7 +174,7 @@ static int msp430_ir_init(struct budget_ci *budget_ci)
174 struct rc_dev *dev; 174 struct rc_dev *dev;
175 int error; 175 int error;
176 176
177 dev = rc_allocate_device(); 177 dev = rc_allocate_device(RC_DRIVER_SCANCODE);
178 if (!dev) { 178 if (!dev) {
179 printk(KERN_ERR "budget_ci: IR interface initialisation failed\n"); 179 printk(KERN_ERR "budget_ci: IR interface initialisation failed\n");
180 return -ENOMEM; 180 return -ENOMEM;
diff --git a/drivers/media/rc/ati_remote.c b/drivers/media/rc/ati_remote.c
index 2f6699e7adcd..9cf3e69de16a 100644
--- a/drivers/media/rc/ati_remote.c
+++ b/drivers/media/rc/ati_remote.c
@@ -760,7 +760,6 @@ static void ati_remote_rc_init(struct ati_remote *ati_remote)
760 struct rc_dev *rdev = ati_remote->rdev; 760 struct rc_dev *rdev = ati_remote->rdev;
761 761
762 rdev->priv = ati_remote; 762 rdev->priv = ati_remote;
763 rdev->driver_type = RC_DRIVER_SCANCODE;
764 rdev->allowed_protocols = RC_BIT_OTHER; 763 rdev->allowed_protocols = RC_BIT_OTHER;
765 rdev->driver_name = "ati_remote"; 764 rdev->driver_name = "ati_remote";
766 765
@@ -847,7 +846,7 @@ static int ati_remote_probe(struct usb_interface *interface,
847 } 846 }
848 847
849 ati_remote = kzalloc(sizeof (struct ati_remote), GFP_KERNEL); 848 ati_remote = kzalloc(sizeof (struct ati_remote), GFP_KERNEL);
850 rc_dev = rc_allocate_device(); 849 rc_dev = rc_allocate_device(RC_DRIVER_SCANCODE);
851 if (!ati_remote || !rc_dev) 850 if (!ati_remote || !rc_dev)
852 goto exit_free_dev_rdev; 851 goto exit_free_dev_rdev;
853 852
diff --git a/drivers/media/rc/ene_ir.c b/drivers/media/rc/ene_ir.c
index fbfefb7a5f7d..60da963f40dc 100644
--- a/drivers/media/rc/ene_ir.c
+++ b/drivers/media/rc/ene_ir.c
@@ -1007,7 +1007,7 @@ static int ene_probe(struct pnp_dev *pnp_dev, const struct pnp_device_id *id)
1007 1007
1008 /* allocate memory */ 1008 /* allocate memory */
1009 dev = kzalloc(sizeof(struct ene_device), GFP_KERNEL); 1009 dev = kzalloc(sizeof(struct ene_device), GFP_KERNEL);
1010 rdev = rc_allocate_device(); 1010 rdev = rc_allocate_device(RC_DRIVER_IR_RAW);
1011 if (!dev || !rdev) 1011 if (!dev || !rdev)
1012 goto exit_free_dev_rdev; 1012 goto exit_free_dev_rdev;
1013 1013
@@ -1053,7 +1053,6 @@ static int ene_probe(struct pnp_dev *pnp_dev, const struct pnp_device_id *id)
1053 if (!dev->hw_learning_and_tx_capable) 1053 if (!dev->hw_learning_and_tx_capable)
1054 learning_mode_force = false; 1054 learning_mode_force = false;
1055 1055
1056 rdev->driver_type = RC_DRIVER_IR_RAW;
1057 rdev->allowed_protocols = RC_BIT_ALL_IR_DECODER; 1056 rdev->allowed_protocols = RC_BIT_ALL_IR_DECODER;
1058 rdev->priv = dev; 1057 rdev->priv = dev;
1059 rdev->open = ene_open; 1058 rdev->open = ene_open;
diff --git a/drivers/media/rc/fintek-cir.c b/drivers/media/rc/fintek-cir.c
index b391b2f8ab79..0d3562712f27 100644
--- a/drivers/media/rc/fintek-cir.c
+++ b/drivers/media/rc/fintek-cir.c
@@ -487,7 +487,7 @@ static int fintek_probe(struct pnp_dev *pdev, const struct pnp_device_id *dev_id
487 return ret; 487 return ret;
488 488
489 /* input device for IR remote (and tx) */ 489 /* input device for IR remote (and tx) */
490 rdev = rc_allocate_device(); 490 rdev = rc_allocate_device(RC_DRIVER_IR_RAW);
491 if (!rdev) 491 if (!rdev)
492 goto exit_free_dev_rdev; 492 goto exit_free_dev_rdev;
493 493
@@ -529,7 +529,6 @@ static int fintek_probe(struct pnp_dev *pdev, const struct pnp_device_id *dev_id
529 529
530 /* Set up the rc device */ 530 /* Set up the rc device */
531 rdev->priv = fintek; 531 rdev->priv = fintek;
532 rdev->driver_type = RC_DRIVER_IR_RAW;
533 rdev->allowed_protocols = RC_BIT_ALL_IR_DECODER; 532 rdev->allowed_protocols = RC_BIT_ALL_IR_DECODER;
534 rdev->open = fintek_open; 533 rdev->open = fintek_open;
535 rdev->close = fintek_close; 534 rdev->close = fintek_close;
diff --git a/drivers/media/rc/gpio-ir-recv.c b/drivers/media/rc/gpio-ir-recv.c
index 0b5aec4b9c9d..4a4895e4d599 100644
--- a/drivers/media/rc/gpio-ir-recv.c
+++ b/drivers/media/rc/gpio-ir-recv.c
@@ -143,14 +143,13 @@ static int gpio_ir_recv_probe(struct platform_device *pdev)
143 if (!gpio_dev) 143 if (!gpio_dev)
144 return -ENOMEM; 144 return -ENOMEM;
145 145
146 rcdev = rc_allocate_device(); 146 rcdev = rc_allocate_device(RC_DRIVER_IR_RAW);
147 if (!rcdev) { 147 if (!rcdev) {
148 rc = -ENOMEM; 148 rc = -ENOMEM;
149 goto err_allocate_device; 149 goto err_allocate_device;
150 } 150 }
151 151
152 rcdev->priv = gpio_dev; 152 rcdev->priv = gpio_dev;
153 rcdev->driver_type = RC_DRIVER_IR_RAW;
154 rcdev->input_name = GPIO_IR_DEVICE_NAME; 153 rcdev->input_name = GPIO_IR_DEVICE_NAME;
155 rcdev->input_phys = GPIO_IR_DEVICE_NAME "/input0"; 154 rcdev->input_phys = GPIO_IR_DEVICE_NAME "/input0";
156 rcdev->input_id.bustype = BUS_HOST; 155 rcdev->input_id.bustype = BUS_HOST;
diff --git a/drivers/media/rc/igorplugusb.c b/drivers/media/rc/igorplugusb.c
index 4c4827c3408b..0f0ed4ea4d06 100644
--- a/drivers/media/rc/igorplugusb.c
+++ b/drivers/media/rc/igorplugusb.c
@@ -190,7 +190,7 @@ static int igorplugusb_probe(struct usb_interface *intf,
190 190
191 usb_make_path(udev, ir->phys, sizeof(ir->phys)); 191 usb_make_path(udev, ir->phys, sizeof(ir->phys));
192 192
193 rc = rc_allocate_device(); 193 rc = rc_allocate_device(RC_DRIVER_IR_RAW);
194 if (!rc) 194 if (!rc)
195 goto fail; 195 goto fail;
196 196
@@ -198,7 +198,6 @@ static int igorplugusb_probe(struct usb_interface *intf,
198 rc->input_phys = ir->phys; 198 rc->input_phys = ir->phys;
199 usb_to_input_id(udev, &rc->input_id); 199 usb_to_input_id(udev, &rc->input_id);
200 rc->dev.parent = &intf->dev; 200 rc->dev.parent = &intf->dev;
201 rc->driver_type = RC_DRIVER_IR_RAW;
202 /* 201 /*
203 * This device can only store 36 pulses + spaces, which is not enough 202 * This device can only store 36 pulses + spaces, which is not enough
204 * for the NEC protocol and many others. 203 * for the NEC protocol and many others.
diff --git a/drivers/media/rc/iguanair.c b/drivers/media/rc/iguanair.c
index 75e1dfb1be26..ccf24fd7ec1b 100644
--- a/drivers/media/rc/iguanair.c
+++ b/drivers/media/rc/iguanair.c
@@ -427,7 +427,7 @@ static int iguanair_probe(struct usb_interface *intf,
427 struct usb_host_interface *idesc; 427 struct usb_host_interface *idesc;
428 428
429 ir = kzalloc(sizeof(*ir), GFP_KERNEL); 429 ir = kzalloc(sizeof(*ir), GFP_KERNEL);
430 rc = rc_allocate_device(); 430 rc = rc_allocate_device(RC_DRIVER_IR_RAW);
431 if (!ir || !rc) { 431 if (!ir || !rc) {
432 ret = -ENOMEM; 432 ret = -ENOMEM;
433 goto out; 433 goto out;
@@ -490,7 +490,6 @@ static int iguanair_probe(struct usb_interface *intf,
490 rc->input_phys = ir->phys; 490 rc->input_phys = ir->phys;
491 usb_to_input_id(ir->udev, &rc->input_id); 491 usb_to_input_id(ir->udev, &rc->input_id);
492 rc->dev.parent = &intf->dev; 492 rc->dev.parent = &intf->dev;
493 rc->driver_type = RC_DRIVER_IR_RAW;
494 rc->allowed_protocols = RC_BIT_ALL_IR_DECODER; 493 rc->allowed_protocols = RC_BIT_ALL_IR_DECODER;
495 rc->priv = ir; 494 rc->priv = ir;
496 rc->open = iguanair_open; 495 rc->open = iguanair_open;
diff --git a/drivers/media/rc/img-ir/img-ir-hw.c b/drivers/media/rc/img-ir/img-ir-hw.c
index 8e2b64135c39..431d33b36fb0 100644
--- a/drivers/media/rc/img-ir/img-ir-hw.c
+++ b/drivers/media/rc/img-ir/img-ir-hw.c
@@ -1078,7 +1078,7 @@ int img_ir_probe_hw(struct img_ir_priv *priv)
1078 } 1078 }
1079 1079
1080 /* Allocate hardware decoder */ 1080 /* Allocate hardware decoder */
1081 hw->rdev = rdev = rc_allocate_device(); 1081 hw->rdev = rdev = rc_allocate_device(RC_DRIVER_SCANCODE);
1082 if (!rdev) { 1082 if (!rdev) {
1083 dev_err(priv->dev, "cannot allocate input device\n"); 1083 dev_err(priv->dev, "cannot allocate input device\n");
1084 error = -ENOMEM; 1084 error = -ENOMEM;
diff --git a/drivers/media/rc/img-ir/img-ir-raw.c b/drivers/media/rc/img-ir/img-ir-raw.c
index 33f37ed87ad2..8d2f8e2006e7 100644
--- a/drivers/media/rc/img-ir/img-ir-raw.c
+++ b/drivers/media/rc/img-ir/img-ir-raw.c
@@ -110,7 +110,7 @@ int img_ir_probe_raw(struct img_ir_priv *priv)
110 setup_timer(&raw->timer, img_ir_echo_timer, (unsigned long)priv); 110 setup_timer(&raw->timer, img_ir_echo_timer, (unsigned long)priv);
111 111
112 /* Allocate raw decoder */ 112 /* Allocate raw decoder */
113 raw->rdev = rdev = rc_allocate_device(); 113 raw->rdev = rdev = rc_allocate_device(RC_DRIVER_IR_RAW);
114 if (!rdev) { 114 if (!rdev) {
115 dev_err(priv->dev, "cannot allocate raw input device\n"); 115 dev_err(priv->dev, "cannot allocate raw input device\n");
116 return -ENOMEM; 116 return -ENOMEM;
@@ -118,7 +118,6 @@ int img_ir_probe_raw(struct img_ir_priv *priv)
118 rdev->priv = priv; 118 rdev->priv = priv;
119 rdev->map_name = RC_MAP_EMPTY; 119 rdev->map_name = RC_MAP_EMPTY;
120 rdev->input_name = "IMG Infrared Decoder Raw"; 120 rdev->input_name = "IMG Infrared Decoder Raw";
121 rdev->driver_type = RC_DRIVER_IR_RAW;
122 121
123 /* Register raw decoder */ 122 /* Register raw decoder */
124 error = rc_register_device(rdev); 123 error = rc_register_device(rdev);
diff --git a/drivers/media/rc/imon.c b/drivers/media/rc/imon.c
index 31ffc6a7b2eb..ef1f33e962b6 100644
--- a/drivers/media/rc/imon.c
+++ b/drivers/media/rc/imon.c
@@ -1935,7 +1935,7 @@ static struct rc_dev *imon_init_rdev(struct imon_context *ictx)
1935 const unsigned char fp_packet[] = { 0x40, 0x00, 0x00, 0x00, 1935 const unsigned char fp_packet[] = { 0x40, 0x00, 0x00, 0x00,
1936 0x00, 0x00, 0x00, 0x88 }; 1936 0x00, 0x00, 0x00, 0x88 };
1937 1937
1938 rdev = rc_allocate_device(); 1938 rdev = rc_allocate_device(RC_DRIVER_SCANCODE);
1939 if (!rdev) { 1939 if (!rdev) {
1940 dev_err(ictx->dev, "remote control dev allocation failed\n"); 1940 dev_err(ictx->dev, "remote control dev allocation failed\n");
1941 goto out; 1941 goto out;
@@ -1953,7 +1953,6 @@ static struct rc_dev *imon_init_rdev(struct imon_context *ictx)
1953 rdev->dev.parent = ictx->dev; 1953 rdev->dev.parent = ictx->dev;
1954 1954
1955 rdev->priv = ictx; 1955 rdev->priv = ictx;
1956 rdev->driver_type = RC_DRIVER_SCANCODE;
1957 rdev->allowed_protocols = RC_BIT_OTHER | RC_BIT_RC6_MCE; /* iMON PAD or MCE */ 1956 rdev->allowed_protocols = RC_BIT_OTHER | RC_BIT_RC6_MCE; /* iMON PAD or MCE */
1958 rdev->change_protocol = imon_ir_change_protocol; 1957 rdev->change_protocol = imon_ir_change_protocol;
1959 rdev->driver_name = MOD_NAME; 1958 rdev->driver_name = MOD_NAME;
diff --git a/drivers/media/rc/ir-hix5hd2.c b/drivers/media/rc/ir-hix5hd2.c
index d95056ad26dc..50951f686852 100644
--- a/drivers/media/rc/ir-hix5hd2.c
+++ b/drivers/media/rc/ir-hix5hd2.c
@@ -229,7 +229,7 @@ static int hix5hd2_ir_probe(struct platform_device *pdev)
229 return priv->irq; 229 return priv->irq;
230 } 230 }
231 231
232 rdev = rc_allocate_device(); 232 rdev = rc_allocate_device(RC_DRIVER_IR_RAW);
233 if (!rdev) 233 if (!rdev)
234 return -ENOMEM; 234 return -ENOMEM;
235 235
@@ -242,7 +242,6 @@ static int hix5hd2_ir_probe(struct platform_device *pdev)
242 clk_prepare_enable(priv->clock); 242 clk_prepare_enable(priv->clock);
243 priv->rate = clk_get_rate(priv->clock); 243 priv->rate = clk_get_rate(priv->clock);
244 244
245 rdev->driver_type = RC_DRIVER_IR_RAW;
246 rdev->allowed_protocols = RC_BIT_ALL_IR_DECODER; 245 rdev->allowed_protocols = RC_BIT_ALL_IR_DECODER;
247 rdev->priv = priv; 246 rdev->priv = priv;
248 rdev->open = hix5hd2_ir_open; 247 rdev->open = hix5hd2_ir_open;
diff --git a/drivers/media/rc/ite-cir.c b/drivers/media/rc/ite-cir.c
index 3bffc169b31e..e9e4befbbebb 100644
--- a/drivers/media/rc/ite-cir.c
+++ b/drivers/media/rc/ite-cir.c
@@ -1465,7 +1465,7 @@ static int ite_probe(struct pnp_dev *pdev, const struct pnp_device_id
1465 return ret; 1465 return ret;
1466 1466
1467 /* input device for IR remote (and tx) */ 1467 /* input device for IR remote (and tx) */
1468 rdev = rc_allocate_device(); 1468 rdev = rc_allocate_device(RC_DRIVER_IR_RAW);
1469 if (!rdev) 1469 if (!rdev)
1470 goto exit_free_dev_rdev; 1470 goto exit_free_dev_rdev;
1471 itdev->rdev = rdev; 1471 itdev->rdev = rdev;
@@ -1556,7 +1556,6 @@ static int ite_probe(struct pnp_dev *pdev, const struct pnp_device_id
1556 1556
1557 /* set up ir-core props */ 1557 /* set up ir-core props */
1558 rdev->priv = itdev; 1558 rdev->priv = itdev;
1559 rdev->driver_type = RC_DRIVER_IR_RAW;
1560 rdev->allowed_protocols = RC_BIT_ALL_IR_DECODER; 1559 rdev->allowed_protocols = RC_BIT_ALL_IR_DECODER;
1561 rdev->open = ite_open; 1560 rdev->open = ite_open;
1562 rdev->close = ite_close; 1561 rdev->close = ite_close;
diff --git a/drivers/media/rc/mceusb.c b/drivers/media/rc/mceusb.c
index 85b220435ff5..238d8eaf7d94 100644
--- a/drivers/media/rc/mceusb.c
+++ b/drivers/media/rc/mceusb.c
@@ -1177,7 +1177,7 @@ static struct rc_dev *mceusb_init_rc_dev(struct mceusb_dev *ir)
1177 struct rc_dev *rc; 1177 struct rc_dev *rc;
1178 int ret; 1178 int ret;
1179 1179
1180 rc = rc_allocate_device(); 1180 rc = rc_allocate_device(RC_DRIVER_IR_RAW);
1181 if (!rc) { 1181 if (!rc) {
1182 dev_err(dev, "remote dev allocation failed"); 1182 dev_err(dev, "remote dev allocation failed");
1183 goto out; 1183 goto out;
@@ -1197,7 +1197,6 @@ static struct rc_dev *mceusb_init_rc_dev(struct mceusb_dev *ir)
1197 usb_to_input_id(ir->usbdev, &rc->input_id); 1197 usb_to_input_id(ir->usbdev, &rc->input_id);
1198 rc->dev.parent = dev; 1198 rc->dev.parent = dev;
1199 rc->priv = ir; 1199 rc->priv = ir;
1200 rc->driver_type = RC_DRIVER_IR_RAW;
1201 rc->allowed_protocols = RC_BIT_ALL_IR_DECODER; 1200 rc->allowed_protocols = RC_BIT_ALL_IR_DECODER;
1202 rc->timeout = MS_TO_NS(100); 1201 rc->timeout = MS_TO_NS(100);
1203 if (!ir->flags.no_tx) { 1202 if (!ir->flags.no_tx) {
diff --git a/drivers/media/rc/meson-ir.c b/drivers/media/rc/meson-ir.c
index 3e96e6f1b0c5..5576dbd6b1a4 100644
--- a/drivers/media/rc/meson-ir.c
+++ b/drivers/media/rc/meson-ir.c
@@ -131,7 +131,7 @@ static int meson_ir_probe(struct platform_device *pdev)
131 return ir->irq; 131 return ir->irq;
132 } 132 }
133 133
134 ir->rc = rc_allocate_device(); 134 ir->rc = rc_allocate_device(RC_DRIVER_IR_RAW);
135 if (!ir->rc) { 135 if (!ir->rc) {
136 dev_err(dev, "failed to allocate rc device\n"); 136 dev_err(dev, "failed to allocate rc device\n");
137 return -ENOMEM; 137 return -ENOMEM;
@@ -144,7 +144,6 @@ static int meson_ir_probe(struct platform_device *pdev)
144 map_name = of_get_property(node, "linux,rc-map-name", NULL); 144 map_name = of_get_property(node, "linux,rc-map-name", NULL);
145 ir->rc->map_name = map_name ? map_name : RC_MAP_EMPTY; 145 ir->rc->map_name = map_name ? map_name : RC_MAP_EMPTY;
146 ir->rc->dev.parent = dev; 146 ir->rc->dev.parent = dev;
147 ir->rc->driver_type = RC_DRIVER_IR_RAW;
148 ir->rc->allowed_protocols = RC_BIT_ALL_IR_DECODER; 147 ir->rc->allowed_protocols = RC_BIT_ALL_IR_DECODER;
149 ir->rc->rx_resolution = US_TO_NS(MESON_TRATE); 148 ir->rc->rx_resolution = US_TO_NS(MESON_TRATE);
150 ir->rc->timeout = MS_TO_NS(200); 149 ir->rc->timeout = MS_TO_NS(200);
diff --git a/drivers/media/rc/nuvoton-cir.c b/drivers/media/rc/nuvoton-cir.c
index a849eed43d41..b109f8246b96 100644
--- a/drivers/media/rc/nuvoton-cir.c
+++ b/drivers/media/rc/nuvoton-cir.c
@@ -1062,7 +1062,7 @@ static int nvt_probe(struct pnp_dev *pdev, const struct pnp_device_id *dev_id)
1062 return -ENOMEM; 1062 return -ENOMEM;
1063 1063
1064 /* input device for IR remote (and tx) */ 1064 /* input device for IR remote (and tx) */
1065 nvt->rdev = devm_rc_allocate_device(&pdev->dev); 1065 nvt->rdev = devm_rc_allocate_device(&pdev->dev, RC_DRIVER_IR_RAW);
1066 if (!nvt->rdev) 1066 if (!nvt->rdev)
1067 return -ENOMEM; 1067 return -ENOMEM;
1068 rdev = nvt->rdev; 1068 rdev = nvt->rdev;
@@ -1125,7 +1125,6 @@ static int nvt_probe(struct pnp_dev *pdev, const struct pnp_device_id *dev_id)
1125 1125
1126 /* Set up the rc device */ 1126 /* Set up the rc device */
1127 rdev->priv = nvt; 1127 rdev->priv = nvt;
1128 rdev->driver_type = RC_DRIVER_IR_RAW;
1129 rdev->allowed_protocols = RC_BIT_ALL_IR_DECODER; 1128 rdev->allowed_protocols = RC_BIT_ALL_IR_DECODER;
1130 rdev->allowed_wakeup_protocols = RC_BIT_ALL_IR_ENCODER; 1129 rdev->allowed_wakeup_protocols = RC_BIT_ALL_IR_ENCODER;
1131 rdev->encode_wakeup = true; 1130 rdev->encode_wakeup = true;
diff --git a/drivers/media/rc/rc-loopback.c b/drivers/media/rc/rc-loopback.c
index 294c0fdbc5a9..62195af24fbe 100644
--- a/drivers/media/rc/rc-loopback.c
+++ b/drivers/media/rc/rc-loopback.c
@@ -213,7 +213,7 @@ static int __init loop_init(void)
213 struct rc_dev *rc; 213 struct rc_dev *rc;
214 int ret; 214 int ret;
215 215
216 rc = rc_allocate_device(); 216 rc = rc_allocate_device(RC_DRIVER_IR_RAW);
217 if (!rc) { 217 if (!rc) {
218 printk(KERN_ERR DRIVER_NAME ": rc_dev allocation failed\n"); 218 printk(KERN_ERR DRIVER_NAME ": rc_dev allocation failed\n");
219 return -ENOMEM; 219 return -ENOMEM;
@@ -226,7 +226,6 @@ static int __init loop_init(void)
226 rc->driver_name = DRIVER_NAME; 226 rc->driver_name = DRIVER_NAME;
227 rc->map_name = RC_MAP_EMPTY; 227 rc->map_name = RC_MAP_EMPTY;
228 rc->priv = &loopdev; 228 rc->priv = &loopdev;
229 rc->driver_type = RC_DRIVER_IR_RAW;
230 rc->allowed_protocols = RC_BIT_ALL_IR_DECODER; 229 rc->allowed_protocols = RC_BIT_ALL_IR_DECODER;
231 rc->allowed_wakeup_protocols = RC_BIT_ALL_IR_ENCODER; 230 rc->allowed_wakeup_protocols = RC_BIT_ALL_IR_ENCODER;
232 rc->encode_wakeup = true; 231 rc->encode_wakeup = true;
diff --git a/drivers/media/rc/rc-main.c b/drivers/media/rc/rc-main.c
index d7a1d8cbdf04..aae9f1fc4254 100644
--- a/drivers/media/rc/rc-main.c
+++ b/drivers/media/rc/rc-main.c
@@ -1577,7 +1577,7 @@ static struct device_type rc_dev_type = {
1577 .uevent = rc_dev_uevent, 1577 .uevent = rc_dev_uevent,
1578}; 1578};
1579 1579
1580struct rc_dev *rc_allocate_device(void) 1580struct rc_dev *rc_allocate_device(enum rc_driver_type type)
1581{ 1581{
1582 struct rc_dev *dev; 1582 struct rc_dev *dev;
1583 1583
@@ -1604,6 +1604,8 @@ struct rc_dev *rc_allocate_device(void)
1604 dev->dev.class = &rc_class; 1604 dev->dev.class = &rc_class;
1605 device_initialize(&dev->dev); 1605 device_initialize(&dev->dev);
1606 1606
1607 dev->driver_type = type;
1608
1607 __module_get(THIS_MODULE); 1609 __module_get(THIS_MODULE);
1608 return dev; 1610 return dev;
1609} 1611}
@@ -1630,7 +1632,8 @@ static void devm_rc_alloc_release(struct device *dev, void *res)
1630 rc_free_device(*(struct rc_dev **)res); 1632 rc_free_device(*(struct rc_dev **)res);
1631} 1633}
1632 1634
1633struct rc_dev *devm_rc_allocate_device(struct device *dev) 1635struct rc_dev *devm_rc_allocate_device(struct device *dev,
1636 enum rc_driver_type type)
1634{ 1637{
1635 struct rc_dev **dr, *rc; 1638 struct rc_dev **dr, *rc;
1636 1639
@@ -1638,7 +1641,7 @@ struct rc_dev *devm_rc_allocate_device(struct device *dev)
1638 if (!dr) 1641 if (!dr)
1639 return NULL; 1642 return NULL;
1640 1643
1641 rc = rc_allocate_device(); 1644 rc = rc_allocate_device(type);
1642 if (!rc) { 1645 if (!rc) {
1643 devres_free(dr); 1646 devres_free(dr);
1644 return NULL; 1647 return NULL;
diff --git a/drivers/media/rc/redrat3.c b/drivers/media/rc/redrat3.c
index 4ab0ea02a309..56d43be2756b 100644
--- a/drivers/media/rc/redrat3.c
+++ b/drivers/media/rc/redrat3.c
@@ -941,7 +941,7 @@ static struct rc_dev *redrat3_init_rc_dev(struct redrat3_dev *rr3)
941 int ret; 941 int ret;
942 u16 prod = le16_to_cpu(rr3->udev->descriptor.idProduct); 942 u16 prod = le16_to_cpu(rr3->udev->descriptor.idProduct);
943 943
944 rc = rc_allocate_device(); 944 rc = rc_allocate_device(RC_DRIVER_IR_RAW);
945 if (!rc) 945 if (!rc)
946 return NULL; 946 return NULL;
947 947
@@ -956,7 +956,6 @@ static struct rc_dev *redrat3_init_rc_dev(struct redrat3_dev *rr3)
956 usb_to_input_id(rr3->udev, &rc->input_id); 956 usb_to_input_id(rr3->udev, &rc->input_id);
957 rc->dev.parent = dev; 957 rc->dev.parent = dev;
958 rc->priv = rr3; 958 rc->priv = rr3;
959 rc->driver_type = RC_DRIVER_IR_RAW;
960 rc->allowed_protocols = RC_BIT_ALL_IR_DECODER; 959 rc->allowed_protocols = RC_BIT_ALL_IR_DECODER;
961 rc->min_timeout = MS_TO_NS(RR3_RX_MIN_TIMEOUT); 960 rc->min_timeout = MS_TO_NS(RR3_RX_MIN_TIMEOUT);
962 rc->max_timeout = MS_TO_NS(RR3_RX_MAX_TIMEOUT); 961 rc->max_timeout = MS_TO_NS(RR3_RX_MAX_TIMEOUT);
diff --git a/drivers/media/rc/serial_ir.c b/drivers/media/rc/serial_ir.c
index 408594ea896c..923fb2299553 100644
--- a/drivers/media/rc/serial_ir.c
+++ b/drivers/media/rc/serial_ir.c
@@ -757,7 +757,7 @@ static int __init serial_ir_init_module(void)
757 if (result) 757 if (result)
758 return result; 758 return result;
759 759
760 rcdev = devm_rc_allocate_device(&serial_ir.pdev->dev); 760 rcdev = devm_rc_allocate_device(&serial_ir.pdev->dev, RC_DRIVER_IR_RAW);
761 if (!rcdev) { 761 if (!rcdev) {
762 result = -ENOMEM; 762 result = -ENOMEM;
763 goto serial_cleanup; 763 goto serial_cleanup;
@@ -796,7 +796,6 @@ static int __init serial_ir_init_module(void)
796 rcdev->open = serial_ir_open; 796 rcdev->open = serial_ir_open;
797 rcdev->close = serial_ir_close; 797 rcdev->close = serial_ir_close;
798 rcdev->dev.parent = &serial_ir.pdev->dev; 798 rcdev->dev.parent = &serial_ir.pdev->dev;
799 rcdev->driver_type = RC_DRIVER_IR_RAW;
800 rcdev->allowed_protocols = RC_BIT_ALL_IR_DECODER; 799 rcdev->allowed_protocols = RC_BIT_ALL_IR_DECODER;
801 rcdev->driver_name = KBUILD_MODNAME; 800 rcdev->driver_name = KBUILD_MODNAME;
802 rcdev->map_name = RC_MAP_RC6_MCE; 801 rcdev->map_name = RC_MAP_RC6_MCE;
diff --git a/drivers/media/rc/st_rc.c b/drivers/media/rc/st_rc.c
index 80a46e7a779f..f0d7190e3919 100644
--- a/drivers/media/rc/st_rc.c
+++ b/drivers/media/rc/st_rc.c
@@ -235,7 +235,7 @@ static int st_rc_probe(struct platform_device *pdev)
235 if (!rc_dev) 235 if (!rc_dev)
236 return -ENOMEM; 236 return -ENOMEM;
237 237
238 rdev = rc_allocate_device(); 238 rdev = rc_allocate_device(RC_DRIVER_IR_RAW);
239 239
240 if (!rdev) 240 if (!rdev)
241 return -ENOMEM; 241 return -ENOMEM;
@@ -290,7 +290,6 @@ static int st_rc_probe(struct platform_device *pdev)
290 platform_set_drvdata(pdev, rc_dev); 290 platform_set_drvdata(pdev, rc_dev);
291 st_rc_hardware_init(rc_dev); 291 st_rc_hardware_init(rc_dev);
292 292
293 rdev->driver_type = RC_DRIVER_IR_RAW;
294 rdev->allowed_protocols = RC_BIT_ALL_IR_DECODER; 293 rdev->allowed_protocols = RC_BIT_ALL_IR_DECODER;
295 /* rx sampling rate is 10Mhz */ 294 /* rx sampling rate is 10Mhz */
296 rdev->rx_resolution = 100; 295 rdev->rx_resolution = 100;
diff --git a/drivers/media/rc/streamzap.c b/drivers/media/rc/streamzap.c
index f6391dd6e29f..b09c45abb5f3 100644
--- a/drivers/media/rc/streamzap.c
+++ b/drivers/media/rc/streamzap.c
@@ -287,7 +287,7 @@ static struct rc_dev *streamzap_init_rc_dev(struct streamzap_ir *sz)
287 struct device *dev = sz->dev; 287 struct device *dev = sz->dev;
288 int ret; 288 int ret;
289 289
290 rdev = rc_allocate_device(); 290 rdev = rc_allocate_device(RC_DRIVER_IR_RAW);
291 if (!rdev) { 291 if (!rdev) {
292 dev_err(dev, "remote dev allocation failed\n"); 292 dev_err(dev, "remote dev allocation failed\n");
293 goto out; 293 goto out;
@@ -304,7 +304,6 @@ static struct rc_dev *streamzap_init_rc_dev(struct streamzap_ir *sz)
304 usb_to_input_id(sz->usbdev, &rdev->input_id); 304 usb_to_input_id(sz->usbdev, &rdev->input_id);
305 rdev->dev.parent = dev; 305 rdev->dev.parent = dev;
306 rdev->priv = sz; 306 rdev->priv = sz;
307 rdev->driver_type = RC_DRIVER_IR_RAW;
308 rdev->allowed_protocols = RC_BIT_ALL_IR_DECODER; 307 rdev->allowed_protocols = RC_BIT_ALL_IR_DECODER;
309 rdev->driver_name = DRIVER_NAME; 308 rdev->driver_name = DRIVER_NAME;
310 rdev->map_name = RC_MAP_STREAMZAP; 309 rdev->map_name = RC_MAP_STREAMZAP;
diff --git a/drivers/media/rc/sunxi-cir.c b/drivers/media/rc/sunxi-cir.c
index 42bca8d7b451..25b006167810 100644
--- a/drivers/media/rc/sunxi-cir.c
+++ b/drivers/media/rc/sunxi-cir.c
@@ -212,7 +212,7 @@ static int sunxi_ir_probe(struct platform_device *pdev)
212 goto exit_clkdisable_clk; 212 goto exit_clkdisable_clk;
213 } 213 }
214 214
215 ir->rc = rc_allocate_device(); 215 ir->rc = rc_allocate_device(RC_DRIVER_IR_RAW);
216 if (!ir->rc) { 216 if (!ir->rc) {
217 dev_err(dev, "failed to allocate device\n"); 217 dev_err(dev, "failed to allocate device\n");
218 ret = -ENOMEM; 218 ret = -ENOMEM;
@@ -229,7 +229,6 @@ static int sunxi_ir_probe(struct platform_device *pdev)
229 ir->map_name = of_get_property(dn, "linux,rc-map-name", NULL); 229 ir->map_name = of_get_property(dn, "linux,rc-map-name", NULL);
230 ir->rc->map_name = ir->map_name ?: RC_MAP_EMPTY; 230 ir->rc->map_name = ir->map_name ?: RC_MAP_EMPTY;
231 ir->rc->dev.parent = dev; 231 ir->rc->dev.parent = dev;
232 ir->rc->driver_type = RC_DRIVER_IR_RAW;
233 ir->rc->allowed_protocols = RC_BIT_ALL_IR_DECODER; 232 ir->rc->allowed_protocols = RC_BIT_ALL_IR_DECODER;
234 ir->rc->rx_resolution = SUNXI_IR_SAMPLE; 233 ir->rc->rx_resolution = SUNXI_IR_SAMPLE;
235 ir->rc->timeout = MS_TO_NS(SUNXI_IR_TIMEOUT); 234 ir->rc->timeout = MS_TO_NS(SUNXI_IR_TIMEOUT);
diff --git a/drivers/media/rc/ttusbir.c b/drivers/media/rc/ttusbir.c
index cf70e0403294..23be7702e2df 100644
--- a/drivers/media/rc/ttusbir.c
+++ b/drivers/media/rc/ttusbir.c
@@ -201,7 +201,7 @@ static int ttusbir_probe(struct usb_interface *intf,
201 int altsetting = -1; 201 int altsetting = -1;
202 202
203 tt = kzalloc(sizeof(*tt), GFP_KERNEL); 203 tt = kzalloc(sizeof(*tt), GFP_KERNEL);
204 rc = rc_allocate_device(); 204 rc = rc_allocate_device(RC_DRIVER_IR_RAW);
205 if (!tt || !rc) { 205 if (!tt || !rc) {
206 ret = -ENOMEM; 206 ret = -ENOMEM;
207 goto out; 207 goto out;
@@ -313,7 +313,6 @@ static int ttusbir_probe(struct usb_interface *intf,
313 rc->input_phys = tt->phys; 313 rc->input_phys = tt->phys;
314 usb_to_input_id(tt->udev, &rc->input_id); 314 usb_to_input_id(tt->udev, &rc->input_id);
315 rc->dev.parent = &intf->dev; 315 rc->dev.parent = &intf->dev;
316 rc->driver_type = RC_DRIVER_IR_RAW;
317 rc->allowed_protocols = RC_BIT_ALL_IR_DECODER; 316 rc->allowed_protocols = RC_BIT_ALL_IR_DECODER;
318 rc->priv = tt; 317 rc->priv = tt;
319 rc->driver_name = DRIVER_NAME; 318 rc->driver_name = DRIVER_NAME;
diff --git a/drivers/media/rc/winbond-cir.c b/drivers/media/rc/winbond-cir.c
index 068e81a78125..dc1c8305ad23 100644
--- a/drivers/media/rc/winbond-cir.c
+++ b/drivers/media/rc/winbond-cir.c
@@ -1061,13 +1061,12 @@ wbcir_probe(struct pnp_dev *device, const struct pnp_device_id *dev_id)
1061 if (err) 1061 if (err)
1062 goto exit_free_data; 1062 goto exit_free_data;
1063 1063
1064 data->dev = rc_allocate_device(); 1064 data->dev = rc_allocate_device(RC_DRIVER_IR_RAW);
1065 if (!data->dev) { 1065 if (!data->dev) {
1066 err = -ENOMEM; 1066 err = -ENOMEM;
1067 goto exit_unregister_led; 1067 goto exit_unregister_led;
1068 } 1068 }
1069 1069
1070 data->dev->driver_type = RC_DRIVER_IR_RAW;
1071 data->dev->driver_name = DRVNAME; 1070 data->dev->driver_name = DRVNAME;
1072 data->dev->input_name = WBCIR_NAME; 1071 data->dev->input_name = WBCIR_NAME;
1073 data->dev->input_phys = "wbcir/cir0"; 1072 data->dev->input_phys = "wbcir/cir0";
diff --git a/drivers/media/usb/au0828/au0828-input.c b/drivers/media/usb/au0828/au0828-input.c
index 1e66e7828d8f..9ec919c68482 100644
--- a/drivers/media/usb/au0828/au0828-input.c
+++ b/drivers/media/usb/au0828/au0828-input.c
@@ -298,7 +298,7 @@ int au0828_rc_register(struct au0828_dev *dev)
298 return -ENODEV; 298 return -ENODEV;
299 299
300 ir = kzalloc(sizeof(*ir), GFP_KERNEL); 300 ir = kzalloc(sizeof(*ir), GFP_KERNEL);
301 rc = rc_allocate_device(); 301 rc = rc_allocate_device(RC_DRIVER_IR_RAW);
302 if (!ir || !rc) 302 if (!ir || !rc)
303 goto error; 303 goto error;
304 304
@@ -343,7 +343,6 @@ int au0828_rc_register(struct au0828_dev *dev)
343 rc->input_id.product = le16_to_cpu(dev->usbdev->descriptor.idProduct); 343 rc->input_id.product = le16_to_cpu(dev->usbdev->descriptor.idProduct);
344 rc->dev.parent = &dev->usbdev->dev; 344 rc->dev.parent = &dev->usbdev->dev;
345 rc->driver_name = "au0828-input"; 345 rc->driver_name = "au0828-input";
346 rc->driver_type = RC_DRIVER_IR_RAW;
347 rc->allowed_protocols = RC_BIT_NEC | RC_BIT_NECX | RC_BIT_NEC32 | 346 rc->allowed_protocols = RC_BIT_NEC | RC_BIT_NECX | RC_BIT_NEC32 |
348 RC_BIT_RC5; 347 RC_BIT_RC5;
349 348
diff --git a/drivers/media/usb/cx231xx/cx231xx-input.c b/drivers/media/usb/cx231xx/cx231xx-input.c
index 15d8d1b5f05c..6e80f3c573f3 100644
--- a/drivers/media/usb/cx231xx/cx231xx-input.c
+++ b/drivers/media/usb/cx231xx/cx231xx-input.c
@@ -72,7 +72,7 @@ int cx231xx_ir_init(struct cx231xx *dev)
72 72
73 memset(&info, 0, sizeof(struct i2c_board_info)); 73 memset(&info, 0, sizeof(struct i2c_board_info));
74 memset(&dev->init_data, 0, sizeof(dev->init_data)); 74 memset(&dev->init_data, 0, sizeof(dev->init_data));
75 dev->init_data.rc_dev = rc_allocate_device(); 75 dev->init_data.rc_dev = rc_allocate_device(RC_DRIVER_SCANCODE);
76 if (!dev->init_data.rc_dev) 76 if (!dev->init_data.rc_dev)
77 return -ENOMEM; 77 return -ENOMEM;
78 78
diff --git a/drivers/media/usb/dvb-usb-v2/dvb_usb_core.c b/drivers/media/usb/dvb-usb-v2/dvb_usb_core.c
index a8e6624fbe83..298c91a6f1f9 100644
--- a/drivers/media/usb/dvb-usb-v2/dvb_usb_core.c
+++ b/drivers/media/usb/dvb-usb-v2/dvb_usb_core.c
@@ -147,7 +147,7 @@ static int dvb_usbv2_remote_init(struct dvb_usb_device *d)
147 if (!d->rc.map_name) 147 if (!d->rc.map_name)
148 return 0; 148 return 0;
149 149
150 dev = rc_allocate_device(); 150 dev = rc_allocate_device(d->rc.driver_type);
151 if (!dev) { 151 if (!dev) {
152 ret = -ENOMEM; 152 ret = -ENOMEM;
153 goto err; 153 goto err;
@@ -162,7 +162,6 @@ static int dvb_usbv2_remote_init(struct dvb_usb_device *d)
162 /* TODO: likely RC-core should took const char * */ 162 /* TODO: likely RC-core should took const char * */
163 dev->driver_name = (char *) d->props->driver_name; 163 dev->driver_name = (char *) d->props->driver_name;
164 dev->map_name = d->rc.map_name; 164 dev->map_name = d->rc.map_name;
165 dev->driver_type = d->rc.driver_type;
166 dev->allowed_protocols = d->rc.allowed_protos; 165 dev->allowed_protocols = d->rc.allowed_protos;
167 dev->change_protocol = d->rc.change_protocol; 166 dev->change_protocol = d->rc.change_protocol;
168 dev->priv = d; 167 dev->priv = d;
diff --git a/drivers/media/usb/dvb-usb/dvb-usb-remote.c b/drivers/media/usb/dvb-usb/dvb-usb-remote.c
index c259f9e43542..059ded59208e 100644
--- a/drivers/media/usb/dvb-usb/dvb-usb-remote.c
+++ b/drivers/media/usb/dvb-usb/dvb-usb-remote.c
@@ -265,7 +265,7 @@ static int rc_core_dvb_usb_remote_init(struct dvb_usb_device *d)
265 int err, rc_interval; 265 int err, rc_interval;
266 struct rc_dev *dev; 266 struct rc_dev *dev;
267 267
268 dev = rc_allocate_device(); 268 dev = rc_allocate_device(d->props.rc.core.driver_type);
269 if (!dev) 269 if (!dev)
270 return -ENOMEM; 270 return -ENOMEM;
271 271
@@ -273,7 +273,6 @@ static int rc_core_dvb_usb_remote_init(struct dvb_usb_device *d)
273 dev->map_name = d->props.rc.core.rc_codes; 273 dev->map_name = d->props.rc.core.rc_codes;
274 dev->change_protocol = d->props.rc.core.change_protocol; 274 dev->change_protocol = d->props.rc.core.change_protocol;
275 dev->allowed_protocols = d->props.rc.core.allowed_protos; 275 dev->allowed_protocols = d->props.rc.core.allowed_protos;
276 dev->driver_type = d->props.rc.core.driver_type;
277 usb_to_input_id(d->udev, &dev->input_id); 276 usb_to_input_id(d->udev, &dev->input_id);
278 dev->input_name = "IR-receiver inside an USB DVB receiver"; 277 dev->input_name = "IR-receiver inside an USB DVB receiver";
279 dev->input_phys = d->rc_phys; 278 dev->input_phys = d->rc_phys;
diff --git a/drivers/media/usb/em28xx/em28xx-input.c b/drivers/media/usb/em28xx/em28xx-input.c
index d1ba2c470645..eba75736e654 100644
--- a/drivers/media/usb/em28xx/em28xx-input.c
+++ b/drivers/media/usb/em28xx/em28xx-input.c
@@ -722,7 +722,7 @@ static int em28xx_ir_init(struct em28xx *dev)
722 ir = kzalloc(sizeof(*ir), GFP_KERNEL); 722 ir = kzalloc(sizeof(*ir), GFP_KERNEL);
723 if (!ir) 723 if (!ir)
724 return -ENOMEM; 724 return -ENOMEM;
725 rc = rc_allocate_device(); 725 rc = rc_allocate_device(RC_DRIVER_SCANCODE);
726 if (!rc) 726 if (!rc)
727 goto error; 727 goto error;
728 728
diff --git a/drivers/media/usb/tm6000/tm6000-input.c b/drivers/media/usb/tm6000/tm6000-input.c
index 83d59456680a..ef0dbd9c95f3 100644
--- a/drivers/media/usb/tm6000/tm6000-input.c
+++ b/drivers/media/usb/tm6000/tm6000-input.c
@@ -425,7 +425,7 @@ int tm6000_ir_init(struct tm6000_core *dev)
425 return 0; 425 return 0;
426 426
427 ir = kzalloc(sizeof(*ir), GFP_ATOMIC); 427 ir = kzalloc(sizeof(*ir), GFP_ATOMIC);
428 rc = rc_allocate_device(); 428 rc = rc_allocate_device(RC_DRIVER_SCANCODE);
429 if (!ir || !rc) 429 if (!ir || !rc)
430 goto out; 430 goto out;
431 431
@@ -452,7 +452,6 @@ int tm6000_ir_init(struct tm6000_core *dev)
452 ir->polling = 50; 452 ir->polling = 50;
453 INIT_DELAYED_WORK(&ir->work, tm6000_ir_handle_key); 453 INIT_DELAYED_WORK(&ir->work, tm6000_ir_handle_key);
454 } 454 }
455 rc->driver_type = RC_DRIVER_SCANCODE;
456 455
457 snprintf(ir->name, sizeof(ir->name), "tm5600/60x0 IR (%s)", 456 snprintf(ir->name, sizeof(ir->name), "tm5600/60x0 IR (%s)",
458 dev->name); 457 dev->name);
diff --git a/include/media/rc-core.h b/include/media/rc-core.h
index cf9fabcee33e..8c2252686955 100644
--- a/include/media/rc-core.h
+++ b/include/media/rc-core.h
@@ -203,17 +203,19 @@ struct rc_dev {
203/** 203/**
204 * rc_allocate_device - Allocates a RC device 204 * rc_allocate_device - Allocates a RC device
205 * 205 *
206 * @rc_driver_type: specifies the type of the RC output to be allocated
206 * returns a pointer to struct rc_dev. 207 * returns a pointer to struct rc_dev.
207 */ 208 */
208struct rc_dev *rc_allocate_device(void); 209struct rc_dev *rc_allocate_device(enum rc_driver_type);
209 210
210/** 211/**
211 * devm_rc_allocate_device - Managed RC device allocation 212 * devm_rc_allocate_device - Managed RC device allocation
212 * 213 *
213 * @dev: pointer to struct device 214 * @dev: pointer to struct device
215 * @rc_driver_type: specifies the type of the RC output to be allocated
214 * returns a pointer to struct rc_dev. 216 * returns a pointer to struct rc_dev.
215 */ 217 */
216struct rc_dev *devm_rc_allocate_device(struct device *dev); 218struct rc_dev *devm_rc_allocate_device(struct device *dev, enum rc_driver_type);
217 219
218/** 220/**
219 * rc_free_device - Frees a RC device 221 * rc_free_device - Frees a RC device