hc
2023-12-11 d2ccde1c8e90d38cee87a1b0309ad2827f3fd30d
kernel/drivers/input/keyboard/tca6416-keypad.c
....@@ -1,13 +1,10 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * Driver for keys on TCA6416 I2C IO expander
34 *
45 * Copyright (C) 2010 Texas Instruments
56 *
67 * Author : Sriramakrishnan.A.G. <srk@ti.com>
7
- *
8
- * This program is free software; you can redistribute it and/or modify
9
- * it under the terms of the GNU General Public License version 2 as
10
- * published by the Free Software Foundation.
118 */
129
1310 #include <linux/types.h>
....@@ -36,7 +33,7 @@
3633
3734 struct tca6416_drv_data {
3835 struct input_dev *input;
39
- struct tca6416_button data[0];
36
+ struct tca6416_button data[];
4037 };
4138
4239 struct tca6416_keypad_chip {
....@@ -51,7 +48,7 @@
5148 int irqnum;
5249 u16 pinmask;
5350 bool use_polling;
54
- struct tca6416_button buttons[0];
51
+ struct tca6416_button buttons[];
5552 };
5653
5754 static int tca6416_write_reg(struct tca6416_keypad_chip *chip, int reg, u16 val)
....@@ -219,9 +216,7 @@
219216 return -EINVAL;
220217 }
221218
222
- chip = kzalloc(sizeof(struct tca6416_keypad_chip) +
223
- pdata->nbuttons * sizeof(struct tca6416_button),
224
- GFP_KERNEL);
219
+ chip = kzalloc(struct_size(chip, buttons, pdata->nbuttons), GFP_KERNEL);
225220 input = input_allocate_device();
226221 if (!chip || !input) {
227222 error = -ENOMEM;
....@@ -379,5 +374,5 @@
379374 module_exit(tca6416_keypad_exit);
380375
381376 MODULE_AUTHOR("Sriramakrishnan <srk@ti.com>");
382
-MODULE_DESCRIPTION("Keypad driver over tca6146 IO expander");
377
+MODULE_DESCRIPTION("Keypad driver over tca6416 IO expander");
383378 MODULE_LICENSE("GPL");