2
0
mirror of https://github.com/edk2-porting/linux-next.git synced 2024-12-16 01:04:08 +08:00

[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>
This commit is contained in:
Jarod Wilson 2011-01-06 16:57:14 -03:00 committed by Mauro Carvalho Chehab
parent e95342f168
commit 7d2edfc23e

View File

@ -1756,7 +1756,6 @@ static void imon_get_ffdc_type(struct imon_context *ictx)
printk(KERN_CONT " (id 0x%02x)\n", ffdc_cfg_byte); printk(KERN_CONT " (id 0x%02x)\n", ffdc_cfg_byte);
ictx->display_type = detected_display_type; ictx->display_type = detected_display_type;
ictx->rdev->allowed_protos = allowed_protos;
ictx->rc_type = allowed_protos; ictx->rc_type = allowed_protos;
} }
@ -1839,10 +1838,6 @@ static struct rc_dev *imon_init_rdev(struct imon_context *ictx)
rdev->allowed_protos = RC_TYPE_OTHER | RC_TYPE_RC6; /* iMON PAD or MCE */ rdev->allowed_protos = RC_TYPE_OTHER | RC_TYPE_RC6; /* iMON PAD or MCE */
rdev->change_protocol = imon_ir_change_protocol; rdev->change_protocol = imon_ir_change_protocol;
rdev->driver_name = MOD_NAME; rdev->driver_name = MOD_NAME;
if (ictx->rc_type == RC_TYPE_RC6)
rdev->map_name = RC_MAP_IMON_MCE;
else
rdev->map_name = RC_MAP_IMON_PAD;
/* Enable front-panel buttons and/or knobs */ /* Enable front-panel buttons and/or knobs */
memcpy(ictx->usb_tx_buf, &fp_packet, sizeof(fp_packet)); 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)
if (ret) if (ret)
dev_info(ictx->dev, "panel buttons/knobs setup failed\n"); dev_info(ictx->dev, "panel buttons/knobs setup failed\n");
if (ictx->product == 0xffdc) if (ictx->product == 0xffdc) {
imon_get_ffdc_type(ictx); imon_get_ffdc_type(ictx);
rdev->allowed_protos = ictx->rc_type;
}
imon_set_display_type(ictx); imon_set_display_type(ictx);
if (ictx->rc_type == RC_TYPE_RC6)
rdev->map_name = RC_MAP_IMON_MCE;
else
rdev->map_name = RC_MAP_IMON_PAD;
ret = rc_register_device(rdev); ret = rc_register_device(rdev);
if (ret < 0) { if (ret < 0) {
dev_err(ictx->dev, "remote input dev register failed\n"); dev_err(ictx->dev, "remote input dev register failed\n");