From 8c175150aa1a94f0dd650f418a39f6a3b90ce1cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Jirman?= Date: Sat, 28 Sep 2019 14:46:11 +0200 Subject: [PATCH 062/464] input: cyttsp4: De-obfuscate platform data for keys Signed-off-by: Ondrej Jirman --- drivers/input/touchscreen/cyttsp4_core.c | 22 +++------------------- include/linux/platform_data/cyttsp4.h | 12 ++++++------ 2 files changed, 9 insertions(+), 25 deletions(-) diff --git a/drivers/input/touchscreen/cyttsp4_core.c b/drivers/input/touchscreen/cyttsp4_core.c index 7cb26929dc73..f2dd87cdeb8f 100644 --- a/drivers/input/touchscreen/cyttsp4_core.c +++ b/drivers/input/touchscreen/cyttsp4_core.c @@ -541,8 +541,6 @@ static int cyttsp4_si_get_btn_data(struct cyttsp4 *cd) { struct cyttsp4_sysinfo *si = &cd->sysinfo; int btn; - int num_defined_keys; - u16 *key_table; void *p; int rc = 0; @@ -559,24 +557,10 @@ static int cyttsp4_si_get_btn_data(struct cyttsp4 *cd) } si->btn = p; - if (cd->cpdata->sett[CY_IC_GRPNUM_BTN_KEYS] == NULL) - num_defined_keys = 0; - else if (cd->cpdata->sett[CY_IC_GRPNUM_BTN_KEYS]->data == NULL) - num_defined_keys = 0; - else - num_defined_keys = cd->cpdata->sett - [CY_IC_GRPNUM_BTN_KEYS]->size; - - for (btn = 0; btn < si->si_ofs.num_btns && - btn < num_defined_keys; btn++) { - key_table = (u16 *)cd->cpdata->sett - [CY_IC_GRPNUM_BTN_KEYS]->data; - si->btn[btn].key_code = key_table[btn]; - si->btn[btn].state = CY_BTN_RELEASED; - si->btn[btn].enabled = true; - } - for (; btn < si->si_ofs.num_btns; btn++) { + for (btn = 0; btn < si->si_ofs.num_btns; btn++) { si->btn[btn].key_code = KEY_RESERVED; + if (btn < cd->cpdata->n_keys) + si->btn[btn].key_code = cd->cpdata->keys[btn].code; si->btn[btn].state = CY_BTN_RELEASED; si->btn[btn].enabled = true; } diff --git a/include/linux/platform_data/cyttsp4.h b/include/linux/platform_data/cyttsp4.h index 5dc9d2be384b..c54160c17b0b 100644 --- a/include/linux/platform_data/cyttsp4.h +++ b/include/linux/platform_data/cyttsp4.h @@ -33,11 +33,9 @@ struct cyttsp4_mt_platform_data { char const *inp_dev_name; }; -struct touch_settings { - const uint8_t *data; - uint32_t size; - uint8_t tag; -} __packed; +struct cyttsp4_virtual_key { + int code; +}; struct cyttsp4_core_platform_data { int irq_gpio; @@ -51,7 +49,9 @@ struct cyttsp4_core_platform_data { int on, struct device *dev, atomic_t *ignore_irq); int (*irq_stat)(struct cyttsp4_core_platform_data *pdata, struct device *dev); - struct touch_settings *sett[CY_TOUCH_SETTINGS_MAX]; + + int n_keys; + struct cyttsp4_virtual_key* keys; }; struct cyttsp4_platform_data { -- 2.34.1