Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Input: cros_ec_keyb - do not allocate keyboard state separately

Now that we know the upper bound for the number of columns, and know
that it is pretty small, there is no point in allocating it separately.
We are wasting more memory tracking the allocations.

Embed valid_keys and old_kb_state directly into cros_ec_keyb structure.

Reviewed-by: Tzung-Bi Shih <tzungbi@kernel.org>
Link: https://patch.msgid.link/20260222003717.471977-6-dmitry.torokhov@gmail.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>

+2 -10
+2 -10
drivers/input/keyboard/cros_ec_keyb.c
··· 59 59 unsigned int cols; 60 60 int row_shift; 61 61 bool ghost_filter; 62 - u8 *valid_keys; 63 - u8 *old_kb_state; 62 + u8 valid_keys[CROS_EC_KEYBOARD_COLS_MAX]; 63 + u8 old_kb_state[CROS_EC_KEYBOARD_COLS_MAX]; 64 64 65 65 struct device *dev; 66 66 struct cros_ec_device *ec; ··· 749 749 ckdev->cols, CROS_EC_KEYBOARD_COLS_MAX); 750 750 return -EINVAL; 751 751 } 752 - 753 - ckdev->valid_keys = devm_kzalloc(dev, ckdev->cols, GFP_KERNEL); 754 - if (!ckdev->valid_keys) 755 - return -ENOMEM; 756 - 757 - ckdev->old_kb_state = devm_kzalloc(dev, ckdev->cols, GFP_KERNEL); 758 - if (!ckdev->old_kb_state) 759 - return -ENOMEM; 760 752 761 753 /* 762 754 * We call the keyboard matrix 'input0'. Allocate phys before input