Commit 1c4bfce1 authored by Gustavo A. R. Silva's avatar Gustavo A. R. Silva Committed by Dmitry Torokhov

Input: stmpe-keypad - remove VLA usage

In preparation to enabling -Wvla, remove VLA and replace it with a
fixed-length array instead.

Fixed as part of the directive to remove all VLAs from the kernel:
https://lkml.org/lkml/2018/3/7/621Signed-off-by: default avatarGustavo A. R. Silva <gustavo@embeddedor.com>
Signed-off-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
parent b56af54a
...@@ -48,6 +48,14 @@ ...@@ -48,6 +48,14 @@
#define STMPE_KEYPAD_KEYMAP_MAX_SIZE \ #define STMPE_KEYPAD_KEYMAP_MAX_SIZE \
(STMPE_KEYPAD_MAX_ROWS * STMPE_KEYPAD_MAX_COLS) (STMPE_KEYPAD_MAX_ROWS * STMPE_KEYPAD_MAX_COLS)
#define STMPE1601_NUM_DATA 5
#define STMPE2401_NUM_DATA 3
#define STMPE2403_NUM_DATA 5
/* Make sure it covers all cases above */
#define MAX_NUM_DATA 5
/** /**
* struct stmpe_keypad_variant - model-specific attributes * struct stmpe_keypad_variant - model-specific attributes
* @auto_increment: whether the KPC_DATA_BYTE register address * @auto_increment: whether the KPC_DATA_BYTE register address
...@@ -74,7 +82,7 @@ struct stmpe_keypad_variant { ...@@ -74,7 +82,7 @@ struct stmpe_keypad_variant {
static const struct stmpe_keypad_variant stmpe_keypad_variants[] = { static const struct stmpe_keypad_variant stmpe_keypad_variants[] = {
[STMPE1601] = { [STMPE1601] = {
.auto_increment = true, .auto_increment = true,
.num_data = 5, .num_data = STMPE1601_NUM_DATA,
.num_normal_data = 3, .num_normal_data = 3,
.max_cols = 8, .max_cols = 8,
.max_rows = 8, .max_rows = 8,
...@@ -84,7 +92,7 @@ static const struct stmpe_keypad_variant stmpe_keypad_variants[] = { ...@@ -84,7 +92,7 @@ static const struct stmpe_keypad_variant stmpe_keypad_variants[] = {
[STMPE2401] = { [STMPE2401] = {
.auto_increment = false, .auto_increment = false,
.set_pullup = true, .set_pullup = true,
.num_data = 3, .num_data = STMPE2401_NUM_DATA,
.num_normal_data = 2, .num_normal_data = 2,
.max_cols = 8, .max_cols = 8,
.max_rows = 12, .max_rows = 12,
...@@ -94,7 +102,7 @@ static const struct stmpe_keypad_variant stmpe_keypad_variants[] = { ...@@ -94,7 +102,7 @@ static const struct stmpe_keypad_variant stmpe_keypad_variants[] = {
[STMPE2403] = { [STMPE2403] = {
.auto_increment = true, .auto_increment = true,
.set_pullup = true, .set_pullup = true,
.num_data = 5, .num_data = STMPE2403_NUM_DATA,
.num_normal_data = 3, .num_normal_data = 3,
.max_cols = 8, .max_cols = 8,
.max_rows = 12, .max_rows = 12,
...@@ -156,7 +164,7 @@ static irqreturn_t stmpe_keypad_irq(int irq, void *dev) ...@@ -156,7 +164,7 @@ static irqreturn_t stmpe_keypad_irq(int irq, void *dev)
struct stmpe_keypad *keypad = dev; struct stmpe_keypad *keypad = dev;
struct input_dev *input = keypad->input; struct input_dev *input = keypad->input;
const struct stmpe_keypad_variant *variant = keypad->variant; const struct stmpe_keypad_variant *variant = keypad->variant;
u8 fifo[variant->num_data]; u8 fifo[MAX_NUM_DATA];
int ret; int ret;
int i; int i;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment