Re: [HID Patchsets for Samsung driver v4 2/6] HID: Samsung : Fix the checkpatch complain. Rewritten code using memcmp where applicable.

From: Joe Perches
Date: Thu Jan 25 2024 - 17:00:29 EST


On Thu, 2024-01-25 at 10:06 +0530, Sandeep C S wrote:
> Resolved warnings found by checkpatch.pl script.
[]
> diff --git a/drivers/hid/hid-samsung.c b/drivers/hid/hid-samsung.c
> @@ -107,17 +99,39 @@ static int samsung_kbd_mouse_input_mapping(struct hid_device *hdev,
>
> switch (usage->hid & HID_USAGE) {
> /* report 2 */
> - case 0x183: samsung_kbd_mouse_map_key_clear(KEY_MEDIA); break;
> - case 0x195: samsung_kbd_mouse_map_key_clear(KEY_EMAIL); break;
> - case 0x196: samsung_kbd_mouse_map_key_clear(KEY_CALC); break;
> - case 0x197: samsung_kbd_mouse_map_key_clear(KEY_COMPUTER); break;
> - case 0x22b: samsung_kbd_mouse_map_key_clear(KEY_SEARCH); break;
> - case 0x22c: samsung_kbd_mouse_map_key_clear(KEY_WWW); break;
> - case 0x22d: samsung_kbd_mouse_map_key_clear(KEY_BACK); break;
> - case 0x22e: samsung_kbd_mouse_map_key_clear(KEY_FORWARD); break;
> - case 0x22f: samsung_kbd_mouse_map_key_clear(KEY_FAVORITES); break;
> - case 0x230: samsung_kbd_mouse_map_key_clear(KEY_REFRESH); break;
> - case 0x231: samsung_kbd_mouse_map_key_clear(KEY_STOP); break;


It's rather smaller code to remove the call duplication and use
a static const struct and for loop as suggested here:

https://lore.kernel.org/lkml/10aeef4ddd523b85ab34327bf384119d0d4b6567.camel@xxxxxxxxxxx/