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> --- Note this makes a large array on the stack (32 * 24 = 768 bytes). It could be moved to the heap with a kmalloc or we could accept the extra 16 * 24 = 384 bytes for the vivaldi_data struct if it has a u32, or we can be more precise and make that a u16 pointer in vivaldi_data and move the array to the heap. 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