[PATCH v2 1/5] Input: atkbd: Convert function_row_physmap to u16 array

From: Stephen Boyd
Date: Wed Feb 09 2022 - 17:56:23 EST


This is a u32 array because the device property is an array of u32s.
Convert this to a u16 array to save a little space and to ease the
transition to a common physmap function in the next patch.

Cc: Jiri Kosina <jikos@xxxxxxxxxx>
Cc: Dmitry Torokhov <dmitry.torokhov@xxxxxxxxx>
Cc: "Sean O'Brien" <seobrien@xxxxxxxxxxxx>
Cc: Douglas Anderson <dianders@xxxxxxxxxxxx>
Cc: Zhengqiao Xia <xiazhengqiao@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
Signed-off-by: Stephen Boyd <swboyd@xxxxxxxxxxxx>
---
drivers/input/keyboard/atkbd.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/input/keyboard/atkbd.c b/drivers/input/keyboard/atkbd.c
index fbdef95291e9..721cde982637 100644
--- a/drivers/input/keyboard/atkbd.c
+++ b/drivers/input/keyboard/atkbd.c
@@ -237,7 +237,7 @@ struct atkbd {
/* Serializes reconnect(), attr->set() and event work */
struct mutex mutex;

- u32 function_row_physmap[MAX_FUNCTION_ROW_KEYS];
+ u16 function_row_physmap[MAX_FUNCTION_ROW_KEYS];
int num_function_row_keys;
};

@@ -1202,14 +1202,17 @@ static void atkbd_parse_fwnode_data(struct serio *serio)
{
struct atkbd *atkbd = serio_get_drvdata(serio);
struct device *dev = &serio->dev;
- int n;
+ int i, n;
+ u32 physmap[MAX_FUNCTION_ROW_KEYS];

/* Parse "function-row-physmap" property */
n = device_property_count_u32(dev, "function-row-physmap");
if (n > 0 && n <= MAX_FUNCTION_ROW_KEYS &&
!device_property_read_u32_array(dev, "function-row-physmap",
- atkbd->function_row_physmap, n)) {
+ physmap, n)) {
atkbd->num_function_row_keys = n;
+ for (i = 0; i < n; i++)
+ atkbd->function_row_physmap[i] = physmap[i];
dev_dbg(dev, "FW reported %d function-row key locations\n", n);
}
}
--
https://chromeos.dev