| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Driver for keys on TCA6416 I2C IO expander |
|---|
| 3 | 4 | * |
|---|
| 4 | 5 | * Copyright (C) 2010 Texas Instruments |
|---|
| 5 | 6 | * |
|---|
| 6 | 7 | * 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. |
|---|
| 11 | 8 | */ |
|---|
| 12 | 9 | |
|---|
| 13 | 10 | #include <linux/types.h> |
|---|
| .. | .. |
|---|
| 36 | 33 | |
|---|
| 37 | 34 | struct tca6416_drv_data { |
|---|
| 38 | 35 | struct input_dev *input; |
|---|
| 39 | | - struct tca6416_button data[0]; |
|---|
| 36 | + struct tca6416_button data[]; |
|---|
| 40 | 37 | }; |
|---|
| 41 | 38 | |
|---|
| 42 | 39 | struct tca6416_keypad_chip { |
|---|
| .. | .. |
|---|
| 51 | 48 | int irqnum; |
|---|
| 52 | 49 | u16 pinmask; |
|---|
| 53 | 50 | bool use_polling; |
|---|
| 54 | | - struct tca6416_button buttons[0]; |
|---|
| 51 | + struct tca6416_button buttons[]; |
|---|
| 55 | 52 | }; |
|---|
| 56 | 53 | |
|---|
| 57 | 54 | static int tca6416_write_reg(struct tca6416_keypad_chip *chip, int reg, u16 val) |
|---|
| .. | .. |
|---|
| 219 | 216 | return -EINVAL; |
|---|
| 220 | 217 | } |
|---|
| 221 | 218 | |
|---|
| 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); |
|---|
| 225 | 220 | input = input_allocate_device(); |
|---|
| 226 | 221 | if (!chip || !input) { |
|---|
| 227 | 222 | error = -ENOMEM; |
|---|
| .. | .. |
|---|
| 379 | 374 | module_exit(tca6416_keypad_exit); |
|---|
| 380 | 375 | |
|---|
| 381 | 376 | MODULE_AUTHOR("Sriramakrishnan <srk@ti.com>"); |
|---|
| 382 | | -MODULE_DESCRIPTION("Keypad driver over tca6146 IO expander"); |
|---|
| 377 | +MODULE_DESCRIPTION("Keypad driver over tca6416 IO expander"); |
|---|
| 383 | 378 | MODULE_LICENSE("GPL"); |
|---|