aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/rc/imon.c
diff options
context:
space:
mode:
authorJarod Wilson <jarod@redhat.com>2011-01-06 14:57:14 -0500
committerMauro Carvalho Chehab <mchehab@redhat.com>2011-01-19 08:45:49 -0500
commit7d2edfc23e9852591cb031a26093cdcd07a34a90 (patch)
treeef8716911d93743d0378552498203db6194dfb5c /drivers/media/rc/imon.c
parente95342f168f7a02441cec51b222bb7ae62df364d (diff)
[media] rc/imon: fix ffdc device detection oops
There's a nasty bug that slipped in when the rc device interface was altered, only affecting the older 0xffdc imon devices. We were trying to access ictx->rdev->allowed_protos before ictx->rdev had been set. There's also an issue with call ordering that meant the correct keymap wasn't getting loaded for MCE IR type 0xffdc devices. Signed-off-by: Jarod Wilson <jarod@redhat.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/rc/imon.c')
-rw-r--r--drivers/media/rc/imon.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/drivers/media/rc/imon.c b/drivers/media/rc/imon.c
index 6811512b4e8..a30bd99c5ca 100644
--- a/drivers/media/rc/imon.c
+++ b/drivers/media/rc/imon.c
@@ -1756,7 +1756,6 @@ static void imon_get_ffdc_type(struct imon_context *ictx)
1756 printk(KERN_CONT " (id 0x%02x)\n", ffdc_cfg_byte); 1756 printk(KERN_CONT " (id 0x%02x)\n", ffdc_cfg_byte);
1757 1757
1758 ictx->display_type = detected_display_type; 1758 ictx->display_type = detected_display_type;
1759 ictx->rdev->allowed_protos = allowed_protos;
1760 ictx->rc_type = allowed_protos; 1759 ictx->rc_type = allowed_protos;
1761} 1760}
1762 1761
@@ -1839,10 +1838,6 @@ static struct rc_dev *imon_init_rdev(struct imon_context *ictx)
1839 rdev->allowed_protos = RC_TYPE_OTHER | RC_TYPE_RC6; /* iMON PAD or MCE */ 1838 rdev->allowed_protos = RC_TYPE_OTHER | RC_TYPE_RC6; /* iMON PAD or MCE */
1840 rdev->change_protocol = imon_ir_change_protocol; 1839 rdev->change_protocol = imon_ir_change_protocol;
1841 rdev->driver_name = MOD_NAME; 1840 rdev->driver_name = MOD_NAME;
1842 if (ictx->rc_type == RC_TYPE_RC6)
1843 rdev->map_name = RC_MAP_IMON_MCE;
1844 else
1845 rdev->map_name = RC_MAP_IMON_PAD;
1846 1841
1847 /* Enable front-panel buttons and/or knobs */ 1842 /* Enable front-panel buttons and/or knobs */
1848 memcpy(ictx->usb_tx_buf, &fp_packet, sizeof(fp_packet)); 1843 memcpy(ictx->usb_tx_buf, &fp_packet, sizeof(fp_packet));
@@ -1851,11 +1846,18 @@ static struct rc_dev *imon_init_rdev(struct imon_context *ictx)
1851 if (ret) 1846 if (ret)
1852 dev_info(ictx->dev, "panel buttons/knobs setup failed\n"); 1847 dev_info(ictx->dev, "panel buttons/knobs setup failed\n");
1853 1848
1854 if (ictx->product == 0xffdc) 1849 if (ictx->product == 0xffdc) {
1855 imon_get_ffdc_type(ictx); 1850 imon_get_ffdc_type(ictx);
1851 rdev->allowed_protos = ictx->rc_type;
1852 }
1856 1853
1857 imon_set_display_type(ictx); 1854 imon_set_display_type(ictx);
1858 1855
1856 if (ictx->rc_type == RC_TYPE_RC6)
1857 rdev->map_name = RC_MAP_IMON_MCE;
1858 else
1859 rdev->map_name = RC_MAP_IMON_PAD;
1860
1859 ret = rc_register_device(rdev); 1861 ret = rc_register_device(rdev);
1860 if (ret < 0) { 1862 if (ret < 0) {
1861 dev_err(ictx->dev, "remote input dev register failed\n"); 1863 dev_err(ictx->dev, "remote input dev register failed\n");