2022-09-23 18:48:36

by Andy Shevchenko

[permalink] [raw]
Subject: [PATCH v1 1/2] Input: matrix_keypad - add missed header inclusion

The gpiod_count() API is defined in gpio/consumer.h. Include it.

Fixes: f8f7f47d576f ("Input: matrix_keypad - replace of_gpio_named_count() by gpiod_count()")
Signed-off-by: Andy Shevchenko <[email protected]>
---
drivers/input/keyboard/matrix_keypad.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/drivers/input/keyboard/matrix_keypad.c b/drivers/input/keyboard/matrix_keypad.c
index 63f078f2bc4a..7dd3f3eda834 100644
--- a/drivers/input/keyboard/matrix_keypad.c
+++ b/drivers/input/keyboard/matrix_keypad.c
@@ -9,6 +9,7 @@

#include <linux/types.h>
#include <linux/delay.h>
+#include <linux/gpio/consumer.h>
#include <linux/platform_device.h>
#include <linux/input.h>
#include <linux/irq.h>
--
2.35.1


2022-09-23 18:58:17

by Andy Shevchenko

[permalink] [raw]
Subject: [PATCH v1 2/2] Input: matrix_keypad - replace header inclusions by forward declarations

When the data structure is only referred by pointer, compiler may not need
to see the contents of the data type. Thus, we may replace header inclusions
by respective forward declarations.

Signed-off-by: Andy Shevchenko <[email protected]>
---
include/linux/input/matrix_keypad.h | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/include/linux/input/matrix_keypad.h b/include/linux/input/matrix_keypad.h
index 9476768c3b90..b8d8d69eba29 100644
--- a/include/linux/input/matrix_keypad.h
+++ b/include/linux/input/matrix_keypad.h
@@ -3,8 +3,9 @@
#define _MATRIX_KEYPAD_H

#include <linux/types.h>
-#include <linux/input.h>
-#include <linux/of.h>
+
+struct device;
+struct input_dev;

#define MATRIX_MAX_ROWS 32
#define MATRIX_MAX_COLS 32
--
2.35.1

2022-09-23 19:10:55

by Dmitry Torokhov

[permalink] [raw]
Subject: Re: [PATCH v1 1/2] Input: matrix_keypad - add missed header inclusion

On Fri, Sep 23, 2022 at 09:46:31PM +0300, Andy Shevchenko wrote:
> The gpiod_count() API is defined in gpio/consumer.h. Include it.
>
> Fixes: f8f7f47d576f ("Input: matrix_keypad - replace of_gpio_named_count() by gpiod_count()")
> Signed-off-by: Andy Shevchenko <[email protected]>

Applied, thank you.

--
Dmitry

2022-09-23 19:13:14

by Dmitry Torokhov

[permalink] [raw]
Subject: Re: [PATCH v1 2/2] Input: matrix_keypad - replace header inclusions by forward declarations

On Fri, Sep 23, 2022 at 09:46:32PM +0300, Andy Shevchenko wrote:
> When the data structure is only referred by pointer, compiler may not need
> to see the contents of the data type. Thus, we may replace header inclusions
> by respective forward declarations.
>
> Signed-off-by: Andy Shevchenko <[email protected]>
> ---
> include/linux/input/matrix_keypad.h | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/include/linux/input/matrix_keypad.h b/include/linux/input/matrix_keypad.h
> index 9476768c3b90..b8d8d69eba29 100644
> --- a/include/linux/input/matrix_keypad.h
> +++ b/include/linux/input/matrix_keypad.h
> @@ -3,8 +3,9 @@
> #define _MATRIX_KEYPAD_H
>
> #include <linux/types.h>
> -#include <linux/input.h>
> -#include <linux/of.h>
> +
> +struct device;
> +struct input_dev;

This results in a ton of compile errors. While I believe this change is
a good one, we need to fix users of this include first.

Thanks.

--
Dmitry

2022-09-23 23:19:03

by kernel test robot

[permalink] [raw]
Subject: Re: [PATCH v1 2/2] Input: matrix_keypad - replace header inclusions by forward declarations

Hi Andy,

I love your patch! Yet something to improve:

[auto build test ERROR on dtor-input/next]
[also build test ERROR on hid/for-next linus/master v6.0-rc6 next-20220923]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url: https://github.com/intel-lab-lkp/linux/commits/Andy-Shevchenko/Input-matrix_keypad-add-missed-header-inclusion/20220924-024709
base: https://git.kernel.org/pub/scm/linux/kernel/git/dtor/input.git next
config: s390-allmodconfig
compiler: s390-linux-gcc (GCC) 12.1.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/intel-lab-lkp/linux/commit/baec96dd9b994bf310565d1eca5eb476fa9c0fd3
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Andy-Shevchenko/Input-matrix_keypad-add-missed-header-inclusion/20220924-024709
git checkout baec96dd9b994bf310565d1eca5eb476fa9c0fd3
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=s390 SHELL=/bin/bash drivers/input/keyboard/

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <[email protected]>

All error/warnings (new ones prefixed by >>):

drivers/input/keyboard/lm8333.c: In function 'lm8333_key_handler':
>> drivers/input/keyboard/lm8333.c:95:17: error: implicit declaration of function 'input_event' [-Werror=implicit-function-declaration]
95 | input_event(input, EV_MSC, MSC_SCAN, code);
| ^~~~~~~~~~~
>> drivers/input/keyboard/lm8333.c:95:36: error: 'EV_MSC' undeclared (first use in this function)
95 | input_event(input, EV_MSC, MSC_SCAN, code);
| ^~~~~~
drivers/input/keyboard/lm8333.c:95:36: note: each undeclared identifier is reported only once for each function it appears in
>> drivers/input/keyboard/lm8333.c:95:44: error: 'MSC_SCAN' undeclared (first use in this function)
95 | input_event(input, EV_MSC, MSC_SCAN, code);
| ^~~~~~~~
>> drivers/input/keyboard/lm8333.c:96:17: error: implicit declaration of function 'input_report_key' [-Werror=implicit-function-declaration]
96 | input_report_key(input, lm8333->keycodes[code], pressed);
| ^~~~~~~~~~~~~~~~
>> drivers/input/keyboard/lm8333.c:99:9: error: implicit declaration of function 'input_sync'; did you mean 'mmput_async'? [-Werror=implicit-function-declaration]
99 | input_sync(input);
| ^~~~~~~~~~
| mmput_async
drivers/input/keyboard/lm8333.c: In function 'lm8333_probe':
>> drivers/input/keyboard/lm8333.c:147:17: error: implicit declaration of function 'input_allocate_device' [-Werror=implicit-function-declaration]
147 | input = input_allocate_device();
| ^~~~~~~~~~~~~~~~~~~~~
>> drivers/input/keyboard/lm8333.c:147:15: warning: assignment to 'struct input_dev *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
147 | input = input_allocate_device();
| ^
>> drivers/input/keyboard/lm8333.c:156:14: error: invalid use of undefined type 'struct input_dev'
156 | input->name = client->name;
| ^~
drivers/input/keyboard/lm8333.c:157:14: error: invalid use of undefined type 'struct input_dev'
157 | input->dev.parent = &client->dev;
| ^~
drivers/input/keyboard/lm8333.c:158:14: error: invalid use of undefined type 'struct input_dev'
158 | input->id.bustype = BUS_I2C;
| ^~
>> drivers/input/keyboard/lm8333.c:158:29: error: 'BUS_I2C' undeclared (first use in this function)
158 | input->id.bustype = BUS_I2C;
| ^~~~~~~
>> drivers/input/keyboard/lm8333.c:160:9: error: implicit declaration of function 'input_set_capability' [-Werror=implicit-function-declaration]
160 | input_set_capability(input, EV_MSC, MSC_SCAN);
| ^~~~~~~~~~~~~~~~~~~~
drivers/input/keyboard/lm8333.c:160:37: error: 'EV_MSC' undeclared (first use in this function)
160 | input_set_capability(input, EV_MSC, MSC_SCAN);
| ^~~~~~
drivers/input/keyboard/lm8333.c:160:45: error: 'MSC_SCAN' undeclared (first use in this function)
160 | input_set_capability(input, EV_MSC, MSC_SCAN);
| ^~~~~~~~
>> drivers/input/keyboard/lm8333.c:188:15: error: implicit declaration of function 'input_register_device'; did you mean 'i2c_unregister_device'? [-Werror=implicit-function-declaration]
188 | err = input_register_device(input);
| ^~~~~~~~~~~~~~~~~~~~~
| i2c_unregister_device
>> drivers/input/keyboard/lm8333.c:198:9: error: implicit declaration of function 'input_free_device'; did you mean 'put_swap_device'? [-Werror=implicit-function-declaration]
198 | input_free_device(input);
| ^~~~~~~~~~~~~~~~~
| put_swap_device
drivers/input/keyboard/lm8333.c: In function 'lm8333_remove':
>> drivers/input/keyboard/lm8333.c:208:9: error: implicit declaration of function 'input_unregister_device'; did you mean 'i2c_unregister_device'? [-Werror=implicit-function-declaration]
208 | input_unregister_device(lm8333->input);
| ^~~~~~~~~~~~~~~~~~~~~~~
| i2c_unregister_device
cc1: some warnings being treated as errors


vim +156 drivers/input/keyboard/lm8333.c

0bf25a45386f28 Wolfram Sang 2012-04-03 75
0bf25a45386f28 Wolfram Sang 2012-04-03 76 static void lm8333_key_handler(struct lm8333 *lm8333)
0bf25a45386f28 Wolfram Sang 2012-04-03 77 {
0bf25a45386f28 Wolfram Sang 2012-04-03 78 struct input_dev *input = lm8333->input;
0bf25a45386f28 Wolfram Sang 2012-04-03 79 u8 keys[LM8333_FIFO_TRANSFER_SIZE];
0bf25a45386f28 Wolfram Sang 2012-04-03 80 u8 code, pressed;
0bf25a45386f28 Wolfram Sang 2012-04-03 81 int i, ret;
0bf25a45386f28 Wolfram Sang 2012-04-03 82
0bf25a45386f28 Wolfram Sang 2012-04-03 83 ret = lm8333_read_block(lm8333, LM8333_FIFO_READ,
0bf25a45386f28 Wolfram Sang 2012-04-03 84 LM8333_FIFO_TRANSFER_SIZE, keys);
0bf25a45386f28 Wolfram Sang 2012-04-03 85 if (ret != LM8333_FIFO_TRANSFER_SIZE) {
0bf25a45386f28 Wolfram Sang 2012-04-03 86 dev_err(&lm8333->client->dev,
0bf25a45386f28 Wolfram Sang 2012-04-03 87 "Error %d while reading FIFO\n", ret);
0bf25a45386f28 Wolfram Sang 2012-04-03 88 return;
0bf25a45386f28 Wolfram Sang 2012-04-03 89 }
0bf25a45386f28 Wolfram Sang 2012-04-03 90
954bd6d1c9f6a5 Alan Cox 2012-06-27 91 for (i = 0; i < LM8333_FIFO_TRANSFER_SIZE && keys[i]; i++) {
0bf25a45386f28 Wolfram Sang 2012-04-03 92 pressed = keys[i] & 0x80;
0bf25a45386f28 Wolfram Sang 2012-04-03 93 code = keys[i] & 0x7f;
0bf25a45386f28 Wolfram Sang 2012-04-03 94
0bf25a45386f28 Wolfram Sang 2012-04-03 @95 input_event(input, EV_MSC, MSC_SCAN, code);
0bf25a45386f28 Wolfram Sang 2012-04-03 @96 input_report_key(input, lm8333->keycodes[code], pressed);
0bf25a45386f28 Wolfram Sang 2012-04-03 97 }
0bf25a45386f28 Wolfram Sang 2012-04-03 98
0bf25a45386f28 Wolfram Sang 2012-04-03 @99 input_sync(input);
0bf25a45386f28 Wolfram Sang 2012-04-03 100 }
0bf25a45386f28 Wolfram Sang 2012-04-03 101
0bf25a45386f28 Wolfram Sang 2012-04-03 102 static irqreturn_t lm8333_irq_thread(int irq, void *data)
0bf25a45386f28 Wolfram Sang 2012-04-03 103 {
0bf25a45386f28 Wolfram Sang 2012-04-03 104 struct lm8333 *lm8333 = data;
0bf25a45386f28 Wolfram Sang 2012-04-03 105 u8 status = lm8333_read8(lm8333, LM8333_READ_INT);
0bf25a45386f28 Wolfram Sang 2012-04-03 106
0bf25a45386f28 Wolfram Sang 2012-04-03 107 if (!status)
0bf25a45386f28 Wolfram Sang 2012-04-03 108 return IRQ_NONE;
0bf25a45386f28 Wolfram Sang 2012-04-03 109
0bf25a45386f28 Wolfram Sang 2012-04-03 110 if (status & LM8333_ERROR_IRQ) {
0bf25a45386f28 Wolfram Sang 2012-04-03 111 u8 err = lm8333_read8(lm8333, LM8333_READ_ERROR);
0bf25a45386f28 Wolfram Sang 2012-04-03 112
0bf25a45386f28 Wolfram Sang 2012-04-03 113 if (err & (LM8333_ERROR_KEYOVR | LM8333_ERROR_FIFOOVR)) {
0bf25a45386f28 Wolfram Sang 2012-04-03 114 u8 dummy[LM8333_FIFO_TRANSFER_SIZE];
0bf25a45386f28 Wolfram Sang 2012-04-03 115
0bf25a45386f28 Wolfram Sang 2012-04-03 116 lm8333_read_block(lm8333, LM8333_FIFO_READ,
0bf25a45386f28 Wolfram Sang 2012-04-03 117 LM8333_FIFO_TRANSFER_SIZE, dummy);
0bf25a45386f28 Wolfram Sang 2012-04-03 118 }
0bf25a45386f28 Wolfram Sang 2012-04-03 119 dev_err(&lm8333->client->dev, "Got error %02x\n", err);
0bf25a45386f28 Wolfram Sang 2012-04-03 120 }
0bf25a45386f28 Wolfram Sang 2012-04-03 121
0bf25a45386f28 Wolfram Sang 2012-04-03 122 if (status & LM8333_KEYPAD_IRQ)
0bf25a45386f28 Wolfram Sang 2012-04-03 123 lm8333_key_handler(lm8333);
0bf25a45386f28 Wolfram Sang 2012-04-03 124
0bf25a45386f28 Wolfram Sang 2012-04-03 125 return IRQ_HANDLED;
0bf25a45386f28 Wolfram Sang 2012-04-03 126 }
0bf25a45386f28 Wolfram Sang 2012-04-03 127
5298cc4cc753bb Bill Pemberton 2012-11-23 128 static int lm8333_probe(struct i2c_client *client,
0bf25a45386f28 Wolfram Sang 2012-04-03 129 const struct i2c_device_id *id)
0bf25a45386f28 Wolfram Sang 2012-04-03 130 {
c838cb3d477f79 Jingoo Han 2013-12-05 131 const struct lm8333_platform_data *pdata =
c838cb3d477f79 Jingoo Han 2013-12-05 132 dev_get_platdata(&client->dev);
0bf25a45386f28 Wolfram Sang 2012-04-03 133 struct lm8333 *lm8333;
0bf25a45386f28 Wolfram Sang 2012-04-03 134 struct input_dev *input;
0bf25a45386f28 Wolfram Sang 2012-04-03 135 int err, active_time;
0bf25a45386f28 Wolfram Sang 2012-04-03 136
0bf25a45386f28 Wolfram Sang 2012-04-03 137 if (!pdata)
0bf25a45386f28 Wolfram Sang 2012-04-03 138 return -EINVAL;
0bf25a45386f28 Wolfram Sang 2012-04-03 139
0bf25a45386f28 Wolfram Sang 2012-04-03 140 active_time = pdata->active_time ?: 500;
0bf25a45386f28 Wolfram Sang 2012-04-03 141 if (active_time / 3 <= pdata->debounce_time / 3) {
0bf25a45386f28 Wolfram Sang 2012-04-03 142 dev_err(&client->dev, "Active time not big enough!\n");
0bf25a45386f28 Wolfram Sang 2012-04-03 143 return -EINVAL;
0bf25a45386f28 Wolfram Sang 2012-04-03 144 }
0bf25a45386f28 Wolfram Sang 2012-04-03 145
0bf25a45386f28 Wolfram Sang 2012-04-03 146 lm8333 = kzalloc(sizeof(*lm8333), GFP_KERNEL);
0bf25a45386f28 Wolfram Sang 2012-04-03 @147 input = input_allocate_device();
0bf25a45386f28 Wolfram Sang 2012-04-03 148 if (!lm8333 || !input) {
0bf25a45386f28 Wolfram Sang 2012-04-03 149 err = -ENOMEM;
0bf25a45386f28 Wolfram Sang 2012-04-03 150 goto free_mem;
0bf25a45386f28 Wolfram Sang 2012-04-03 151 }
0bf25a45386f28 Wolfram Sang 2012-04-03 152
0bf25a45386f28 Wolfram Sang 2012-04-03 153 lm8333->client = client;
0bf25a45386f28 Wolfram Sang 2012-04-03 154 lm8333->input = input;
0bf25a45386f28 Wolfram Sang 2012-04-03 155
0bf25a45386f28 Wolfram Sang 2012-04-03 @156 input->name = client->name;
0bf25a45386f28 Wolfram Sang 2012-04-03 @157 input->dev.parent = &client->dev;
0bf25a45386f28 Wolfram Sang 2012-04-03 @158 input->id.bustype = BUS_I2C;
0bf25a45386f28 Wolfram Sang 2012-04-03 159
0bf25a45386f28 Wolfram Sang 2012-04-03 @160 input_set_capability(input, EV_MSC, MSC_SCAN);
0bf25a45386f28 Wolfram Sang 2012-04-03 161
1932811f426fee Dmitry Torokhov 2012-05-10 162 err = matrix_keypad_build_keymap(pdata->matrix_data, NULL,
1932811f426fee Dmitry Torokhov 2012-05-10 163 LM8333_NUM_ROWS, LM8333_NUM_COLS,
1932811f426fee Dmitry Torokhov 2012-05-10 164 lm8333->keycodes, input);
1932811f426fee Dmitry Torokhov 2012-05-10 165 if (err)
1932811f426fee Dmitry Torokhov 2012-05-10 166 goto free_mem;
0bf25a45386f28 Wolfram Sang 2012-04-03 167
0bf25a45386f28 Wolfram Sang 2012-04-03 168 if (pdata->debounce_time) {
0bf25a45386f28 Wolfram Sang 2012-04-03 169 err = lm8333_write8(lm8333, LM8333_DEBOUNCE,
0bf25a45386f28 Wolfram Sang 2012-04-03 170 pdata->debounce_time / 3);
0bf25a45386f28 Wolfram Sang 2012-04-03 171 if (err)
0bf25a45386f28 Wolfram Sang 2012-04-03 172 dev_warn(&client->dev, "Unable to set debounce time\n");
0bf25a45386f28 Wolfram Sang 2012-04-03 173 }
0bf25a45386f28 Wolfram Sang 2012-04-03 174
0bf25a45386f28 Wolfram Sang 2012-04-03 175 if (pdata->active_time) {
0bf25a45386f28 Wolfram Sang 2012-04-03 176 err = lm8333_write8(lm8333, LM8333_ACTIVE,
0bf25a45386f28 Wolfram Sang 2012-04-03 177 pdata->active_time / 3);
0bf25a45386f28 Wolfram Sang 2012-04-03 178 if (err)
0bf25a45386f28 Wolfram Sang 2012-04-03 179 dev_warn(&client->dev, "Unable to set active time\n");
0bf25a45386f28 Wolfram Sang 2012-04-03 180 }
0bf25a45386f28 Wolfram Sang 2012-04-03 181
0bf25a45386f28 Wolfram Sang 2012-04-03 182 err = request_threaded_irq(client->irq, NULL, lm8333_irq_thread,
0bf25a45386f28 Wolfram Sang 2012-04-03 183 IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
0bf25a45386f28 Wolfram Sang 2012-04-03 184 "lm8333", lm8333);
0bf25a45386f28 Wolfram Sang 2012-04-03 185 if (err)
0bf25a45386f28 Wolfram Sang 2012-04-03 186 goto free_mem;
0bf25a45386f28 Wolfram Sang 2012-04-03 187
0bf25a45386f28 Wolfram Sang 2012-04-03 @188 err = input_register_device(input);
0bf25a45386f28 Wolfram Sang 2012-04-03 189 if (err)
0bf25a45386f28 Wolfram Sang 2012-04-03 190 goto free_irq;
0bf25a45386f28 Wolfram Sang 2012-04-03 191
0bf25a45386f28 Wolfram Sang 2012-04-03 192 i2c_set_clientdata(client, lm8333);
0bf25a45386f28 Wolfram Sang 2012-04-03 193 return 0;
0bf25a45386f28 Wolfram Sang 2012-04-03 194
0bf25a45386f28 Wolfram Sang 2012-04-03 195 free_irq:
0bf25a45386f28 Wolfram Sang 2012-04-03 196 free_irq(client->irq, lm8333);
0bf25a45386f28 Wolfram Sang 2012-04-03 197 free_mem:
0bf25a45386f28 Wolfram Sang 2012-04-03 @198 input_free_device(input);
0bf25a45386f28 Wolfram Sang 2012-04-03 199 kfree(lm8333);
0bf25a45386f28 Wolfram Sang 2012-04-03 200 return err;
0bf25a45386f28 Wolfram Sang 2012-04-03 201 }
0bf25a45386f28 Wolfram Sang 2012-04-03 202
ed5c2f5fd10dda Uwe Kleine-K?nig 2022-08-15 203 static void lm8333_remove(struct i2c_client *client)
0bf25a45386f28 Wolfram Sang 2012-04-03 204 {
0bf25a45386f28 Wolfram Sang 2012-04-03 205 struct lm8333 *lm8333 = i2c_get_clientdata(client);
0bf25a45386f28 Wolfram Sang 2012-04-03 206
0bf25a45386f28 Wolfram Sang 2012-04-03 207 free_irq(client->irq, lm8333);
0bf25a45386f28 Wolfram Sang 2012-04-03 @208 input_unregister_device(lm8333->input);
0bf25a45386f28 Wolfram Sang 2012-04-03 209 kfree(lm8333);
0bf25a45386f28 Wolfram Sang 2012-04-03 210 }
0bf25a45386f28 Wolfram Sang 2012-04-03 211

--
0-DAY CI Kernel Test Service
https://01.org/lkp


Attachments:
(No filename) (15.86 kB)
config (122.25 kB)
Download all attachments

2022-09-23 23:21:09

by kernel test robot

[permalink] [raw]
Subject: Re: [PATCH v1 2/2] Input: matrix_keypad - replace header inclusions by forward declarations

Hi Andy,

I love your patch! Yet something to improve:

[auto build test ERROR on dtor-input/next]
[also build test ERROR on hid/for-next linus/master v6.0-rc6 next-20220923]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url: https://github.com/intel-lab-lkp/linux/commits/Andy-Shevchenko/Input-matrix_keypad-add-missed-header-inclusion/20220924-024709
base: https://git.kernel.org/pub/scm/linux/kernel/git/dtor/input.git next
config: sh-allmodconfig
compiler: sh4-linux-gcc (GCC) 12.1.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/intel-lab-lkp/linux/commit/baec96dd9b994bf310565d1eca5eb476fa9c0fd3
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Andy-Shevchenko/Input-matrix_keypad-add-missed-header-inclusion/20220924-024709
git checkout baec96dd9b994bf310565d1eca5eb476fa9c0fd3
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=sh SHELL=/bin/bash drivers/input/

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <[email protected]>

All error/warnings (new ones prefixed by >>):

drivers/input/keyboard/ep93xx_keypad.c: In function 'ep93xx_keypad_irq_handler':
>> drivers/input/keyboard/ep93xx_keypad.c:99:25: error: implicit declaration of function 'input_report_key' [-Werror=implicit-function-declaration]
99 | input_report_key(input_dev, keypad->key1, 0);
| ^~~~~~~~~~~~~~~~
>> drivers/input/keyboard/ep93xx_keypad.c:128:9: error: implicit declaration of function 'input_sync' [-Werror=implicit-function-declaration]
128 | input_sync(input_dev);
| ^~~~~~~~~~
drivers/input/keyboard/ep93xx_keypad.c: In function 'ep93xx_keypad_open':
>> drivers/input/keyboard/ep93xx_keypad.c:158:40: error: implicit declaration of function 'input_get_drvdata'; did you mean 'dev_get_drvdata'? [-Werror=implicit-function-declaration]
158 | struct ep93xx_keypad *keypad = input_get_drvdata(pdev);
| ^~~~~~~~~~~~~~~~~
| dev_get_drvdata
>> drivers/input/keyboard/ep93xx_keypad.c:158:40: warning: initialization of 'struct ep93xx_keypad *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
drivers/input/keyboard/ep93xx_keypad.c: In function 'ep93xx_keypad_close':
drivers/input/keyboard/ep93xx_keypad.c:171:40: warning: initialization of 'struct ep93xx_keypad *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
171 | struct ep93xx_keypad *keypad = input_get_drvdata(pdev);
| ^~~~~~~~~~~~~~~~~
In file included from include/linux/seqlock.h:19,
from include/linux/mm_types.h:19,
from include/linux/buildid.h:5,
from include/linux/module.h:14,
from drivers/input/keyboard/ep93xx_keypad.c:21:
drivers/input/keyboard/ep93xx_keypad.c: In function 'ep93xx_keypad_suspend':
>> drivers/input/keyboard/ep93xx_keypad.c:186:30: error: invalid use of undefined type 'struct input_dev'
186 | mutex_lock(&input_dev->mutex);
| ^~
include/linux/mutex.h:187:44: note: in definition of macro 'mutex_lock'
187 | #define mutex_lock(lock) mutex_lock_nested(lock, 0)
| ^~~~
drivers/input/keyboard/ep93xx_keypad.c:193:32: error: invalid use of undefined type 'struct input_dev'
193 | mutex_unlock(&input_dev->mutex);
| ^~
drivers/input/keyboard/ep93xx_keypad.c: In function 'ep93xx_keypad_resume':
drivers/input/keyboard/ep93xx_keypad.c:204:30: error: invalid use of undefined type 'struct input_dev'
204 | mutex_lock(&input_dev->mutex);
| ^~
include/linux/mutex.h:187:44: note: in definition of macro 'mutex_lock'
187 | #define mutex_lock(lock) mutex_lock_nested(lock, 0)
| ^~~~
>> drivers/input/keyboard/ep93xx_keypad.c:206:13: error: implicit declaration of function 'input_device_enabled' [-Werror=implicit-function-declaration]
206 | if (input_device_enabled(input_dev)) {
| ^~~~~~~~~~~~~~~~~~~~
drivers/input/keyboard/ep93xx_keypad.c:214:32: error: invalid use of undefined type 'struct input_dev'
214 | mutex_unlock(&input_dev->mutex);
| ^~
drivers/input/keyboard/ep93xx_keypad.c: In function 'ep93xx_keypad_probe':
>> drivers/input/keyboard/ep93xx_keypad.c:269:21: error: implicit declaration of function 'devm_input_allocate_device' [-Werror=implicit-function-declaration]
269 | input_dev = devm_input_allocate_device(&pdev->dev);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
>> drivers/input/keyboard/ep93xx_keypad.c:269:19: warning: assignment to 'struct input_dev *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
269 | input_dev = devm_input_allocate_device(&pdev->dev);
| ^
drivers/input/keyboard/ep93xx_keypad.c:275:18: error: invalid use of undefined type 'struct input_dev'
275 | input_dev->name = pdev->name;
| ^~
drivers/input/keyboard/ep93xx_keypad.c:276:18: error: invalid use of undefined type 'struct input_dev'
276 | input_dev->id.bustype = BUS_HOST;
| ^~
>> drivers/input/keyboard/ep93xx_keypad.c:276:33: error: 'BUS_HOST' undeclared (first use in this function)
276 | input_dev->id.bustype = BUS_HOST;
| ^~~~~~~~
drivers/input/keyboard/ep93xx_keypad.c:276:33: note: each undeclared identifier is reported only once for each function it appears in
drivers/input/keyboard/ep93xx_keypad.c:277:18: error: invalid use of undefined type 'struct input_dev'
277 | input_dev->open = ep93xx_keypad_open;
| ^~
drivers/input/keyboard/ep93xx_keypad.c:278:18: error: invalid use of undefined type 'struct input_dev'
278 | input_dev->close = ep93xx_keypad_close;
| ^~
In file included from include/linux/log2.h:12,
from include/asm-generic/div64.h:55,
from ./arch/sh/include/generated/asm/div64.h:1,
from include/linux/math.h:6,
from include/linux/math64.h:6,
from include/linux/time.h:6,
from include/linux/stat.h:19,
from include/linux/module.h:13:
>> drivers/input/keyboard/ep93xx_keypad.c:287:27: error: 'EV_REP' undeclared (first use in this function); did you mean 'ET_REL'?
287 | __set_bit(EV_REP, input_dev->evbit);
| ^~~~~~
include/linux/bitops.h:49:32: note: in definition of macro 'bitop'
49 | ((__builtin_constant_p(nr) && \
| ^~
drivers/input/keyboard/ep93xx_keypad.c:287:17: note: in expansion of macro '__set_bit'
287 | __set_bit(EV_REP, input_dev->evbit);
| ^~~~~~~~~
drivers/input/keyboard/ep93xx_keypad.c:287:44: error: invalid use of undefined type 'struct input_dev'
287 | __set_bit(EV_REP, input_dev->evbit);
| ^~
include/linux/bitops.h:50:44: note: in definition of macro 'bitop'
50 | __builtin_constant_p((uintptr_t)(addr) != (uintptr_t)NULL) && \
| ^~~~
drivers/input/keyboard/ep93xx_keypad.c:287:17: note: in expansion of macro '__set_bit'
287 | __set_bit(EV_REP, input_dev->evbit);
| ^~~~~~~~~
drivers/input/keyboard/ep93xx_keypad.c:287:44: error: invalid use of undefined type 'struct input_dev'
287 | __set_bit(EV_REP, input_dev->evbit);
| ^~
include/linux/bitops.h:51:23: note: in definition of macro 'bitop'
51 | (uintptr_t)(addr) != (uintptr_t)NULL && \
| ^~~~
drivers/input/keyboard/ep93xx_keypad.c:287:17: note: in expansion of macro '__set_bit'
287 | __set_bit(EV_REP, input_dev->evbit);
| ^~~~~~~~~
drivers/input/keyboard/ep93xx_keypad.c:287:44: error: invalid use of undefined type 'struct input_dev'
287 | __set_bit(EV_REP, input_dev->evbit);
| ^~
include/linux/bitops.h:52:57: note: in definition of macro 'bitop'
52 | __builtin_constant_p(*(const unsigned long *)(addr))) ? \
| ^~~~
drivers/input/keyboard/ep93xx_keypad.c:287:17: note: in expansion of macro '__set_bit'
287 | __set_bit(EV_REP, input_dev->evbit);
| ^~~~~~~~~
drivers/input/keyboard/ep93xx_keypad.c:287:44: error: invalid use of undefined type 'struct input_dev'
287 | __set_bit(EV_REP, input_dev->evbit);
| ^~
include/linux/bitops.h:53:24: note: in definition of macro 'bitop'
53 | const##op(nr, addr) : op(nr, addr))
| ^~~~
drivers/input/keyboard/ep93xx_keypad.c:287:17: note: in expansion of macro '__set_bit'
287 | __set_bit(EV_REP, input_dev->evbit);
| ^~~~~~~~~
drivers/input/keyboard/ep93xx_keypad.c:287:44: error: invalid use of undefined type 'struct input_dev'
287 | __set_bit(EV_REP, input_dev->evbit);
| ^~
include/linux/bitops.h:53:39: note: in definition of macro 'bitop'
53 | const##op(nr, addr) : op(nr, addr))
| ^~~~
drivers/input/keyboard/ep93xx_keypad.c:287:17: note: in expansion of macro '__set_bit'
287 | __set_bit(EV_REP, input_dev->evbit);
| ^~~~~~~~~
>> drivers/input/keyboard/ep93xx_keypad.c:288:9: error: implicit declaration of function 'input_set_drvdata'; did you mean 'dev_set_drvdata'? [-Werror=implicit-function-declaration]
288 | input_set_drvdata(input_dev, keypad);
| ^~~~~~~~~~~~~~~~~
| dev_set_drvdata
>> drivers/input/keyboard/ep93xx_keypad.c:296:15: error: implicit declaration of function 'input_register_device' [-Werror=implicit-function-declaration]
296 | err = input_register_device(input_dev);
| ^~~~~~~~~~~~~~~~~~~~~
cc1: some warnings being treated as errors
--
drivers/input/keyboard/imx_keypad.c: In function 'imx_keypad_fire_events':
>> drivers/input/keyboard/imx_keypad.c:169:25: error: implicit declaration of function 'input_event' [-Werror=implicit-function-declaration]
169 | input_event(input_dev, EV_MSC, MSC_SCAN, code);
| ^~~~~~~~~~~
>> drivers/input/keyboard/imx_keypad.c:169:48: error: 'EV_MSC' undeclared (first use in this function)
169 | input_event(input_dev, EV_MSC, MSC_SCAN, code);
| ^~~~~~
drivers/input/keyboard/imx_keypad.c:169:48: note: each undeclared identifier is reported only once for each function it appears in
>> drivers/input/keyboard/imx_keypad.c:169:56: error: 'MSC_SCAN' undeclared (first use in this function)
169 | input_event(input_dev, EV_MSC, MSC_SCAN, code);
| ^~~~~~~~
>> drivers/input/keyboard/imx_keypad.c:170:25: error: implicit declaration of function 'input_report_key' [-Werror=implicit-function-declaration]
170 | input_report_key(input_dev, keypad->keycodes[code],
| ^~~~~~~~~~~~~~~~
In file included from include/linux/printk.h:573,
from include/linux/kernel.h:29,
from include/linux/clk.h:13,
from drivers/input/keyboard/imx_keypad.c:6:
>> drivers/input/keyboard/imx_keypad.c:172:43: error: invalid use of undefined type 'struct input_dev'
172 | dev_dbg(&input_dev->dev, "Event code: %d, val: %d",
| ^~
include/linux/dynamic_debug.h:134:29: note: in definition of macro '__dynamic_func_call'
134 | func(&id, ##__VA_ARGS__); \
| ^~~~~~~~~~~
include/linux/dynamic_debug.h:166:9: note: in expansion of macro '_dynamic_func_call'
166 | _dynamic_func_call(fmt,__dynamic_dev_dbg, \
| ^~~~~~~~~~~~~~~~~~
include/linux/dev_printk.h:155:9: note: in expansion of macro 'dynamic_dev_dbg'
155 | dynamic_dev_dbg(dev, dev_fmt(fmt), ##__VA_ARGS__)
| ^~~~~~~~~~~~~~~
drivers/input/keyboard/imx_keypad.c:172:25: note: in expansion of macro 'dev_dbg'
172 | dev_dbg(&input_dev->dev, "Event code: %d, val: %d",
| ^~~~~~~
>> drivers/input/keyboard/imx_keypad.c:177:9: error: implicit declaration of function 'input_sync' [-Werror=implicit-function-declaration]
177 | input_sync(input_dev);
| ^~~~~~~~~~
drivers/input/keyboard/imx_keypad.c: In function 'imx_keypad_close':
>> drivers/input/keyboard/imx_keypad.c:365:37: error: implicit declaration of function 'input_get_drvdata'; did you mean 'dev_get_drvdata'? [-Werror=implicit-function-declaration]
365 | struct imx_keypad *keypad = input_get_drvdata(dev);
| ^~~~~~~~~~~~~~~~~
| dev_get_drvdata
>> drivers/input/keyboard/imx_keypad.c:365:37: warning: initialization of 'struct imx_keypad *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
drivers/input/keyboard/imx_keypad.c:367:21: error: invalid use of undefined type 'struct input_dev'
367 | dev_dbg(&dev->dev, ">%s\n", __func__);
| ^~
include/linux/dynamic_debug.h:134:29: note: in definition of macro '__dynamic_func_call'
134 | func(&id, ##__VA_ARGS__); \
| ^~~~~~~~~~~
include/linux/dynamic_debug.h:166:9: note: in expansion of macro '_dynamic_func_call'
166 | _dynamic_func_call(fmt,__dynamic_dev_dbg, \
| ^~~~~~~~~~~~~~~~~~
include/linux/dev_printk.h:155:9: note: in expansion of macro 'dynamic_dev_dbg'
155 | dynamic_dev_dbg(dev, dev_fmt(fmt), ##__VA_ARGS__)
| ^~~~~~~~~~~~~~~
drivers/input/keyboard/imx_keypad.c:367:9: note: in expansion of macro 'dev_dbg'
367 | dev_dbg(&dev->dev, ">%s\n", __func__);
| ^~~~~~~
drivers/input/keyboard/imx_keypad.c: In function 'imx_keypad_open':
drivers/input/keyboard/imx_keypad.c:382:37: warning: initialization of 'struct imx_keypad *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
382 | struct imx_keypad *keypad = input_get_drvdata(dev);
| ^~~~~~~~~~~~~~~~~
drivers/input/keyboard/imx_keypad.c:385:21: error: invalid use of undefined type 'struct input_dev'
385 | dev_dbg(&dev->dev, ">%s\n", __func__);
| ^~
include/linux/dynamic_debug.h:134:29: note: in definition of macro '__dynamic_func_call'
134 | func(&id, ##__VA_ARGS__); \
| ^~~~~~~~~~~
include/linux/dynamic_debug.h:166:9: note: in expansion of macro '_dynamic_func_call'
166 | _dynamic_func_call(fmt,__dynamic_dev_dbg, \
| ^~~~~~~~~~~~~~~~~~
include/linux/dev_printk.h:155:9: note: in expansion of macro 'dynamic_dev_dbg'
155 | dynamic_dev_dbg(dev, dev_fmt(fmt), ##__VA_ARGS__)
| ^~~~~~~~~~~~~~~
drivers/input/keyboard/imx_keypad.c:385:9: note: in expansion of macro 'dev_dbg'
385 | dev_dbg(&dev->dev, ">%s\n", __func__);
| ^~~~~~~
In file included from include/linux/device.h:15,
from drivers/input/keyboard/imx_keypad.c:8:
drivers/input/keyboard/imx_keypad.c:399:29: error: invalid use of undefined type 'struct input_dev'
399 | dev_err(&dev->dev,
| ^~
include/linux/dev_printk.h:110:25: note: in definition of macro 'dev_printk_index_wrap'
110 | _p_func(dev, fmt, ##__VA_ARGS__); \
| ^~~
drivers/input/keyboard/imx_keypad.c:399:17: note: in expansion of macro 'dev_err'
399 | dev_err(&dev->dev,
| ^~~~~~~
drivers/input/keyboard/imx_keypad.c: In function 'imx_keypad_probe':
>> drivers/input/keyboard/imx_keypad.c:427:21: error: implicit declaration of function 'devm_input_allocate_device' [-Werror=implicit-function-declaration]
427 | input_dev = devm_input_allocate_device(&pdev->dev);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
>> drivers/input/keyboard/imx_keypad.c:427:19: warning: assignment to 'struct input_dev *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
427 | input_dev = devm_input_allocate_device(&pdev->dev);
| ^
drivers/input/keyboard/imx_keypad.c:457:18: error: invalid use of undefined type 'struct input_dev'
457 | input_dev->name = pdev->name;
| ^~
drivers/input/keyboard/imx_keypad.c:458:18: error: invalid use of undefined type 'struct input_dev'
458 | input_dev->id.bustype = BUS_HOST;
| ^~
>> drivers/input/keyboard/imx_keypad.c:458:33: error: 'BUS_HOST' undeclared (first use in this function)
458 | input_dev->id.bustype = BUS_HOST;
| ^~~~~~~~
drivers/input/keyboard/imx_keypad.c:459:18: error: invalid use of undefined type 'struct input_dev'
459 | input_dev->dev.parent = &pdev->dev;
| ^~
drivers/input/keyboard/imx_keypad.c:460:18: error: invalid use of undefined type 'struct input_dev'
460 | input_dev->open = imx_keypad_open;
| ^~
drivers/input/keyboard/imx_keypad.c:461:18: error: invalid use of undefined type 'struct input_dev'
461 | input_dev->close = imx_keypad_close;
| ^~
>> drivers/input/keyboard/imx_keypad.c:476:52: error: 'KEY_RESERVED' undeclared (first use in this function)
476 | if (keypad->keycodes[i] != KEY_RESERVED) {
| ^~~~~~~~~~~~
In file included from include/linux/kernel.h:22:
>> drivers/input/keyboard/imx_keypad.c:485:19: error: 'EV_REP' undeclared (first use in this function); did you mean 'ET_REL'?
485 | __set_bit(EV_REP, input_dev->evbit);
| ^~~~~~
include/linux/bitops.h:49:32: note: in definition of macro 'bitop'
49 | ((__builtin_constant_p(nr) && \
| ^~
drivers/input/keyboard/imx_keypad.c:485:9: note: in expansion of macro '__set_bit'
485 | __set_bit(EV_REP, input_dev->evbit);
| ^~~~~~~~~
drivers/input/keyboard/imx_keypad.c:485:36: error: invalid use of undefined type 'struct input_dev'
485 | __set_bit(EV_REP, input_dev->evbit);
| ^~
include/linux/bitops.h:50:44: note: in definition of macro 'bitop'
50 | __builtin_constant_p((uintptr_t)(addr) != (uintptr_t)NULL) && \
| ^~~~
drivers/input/keyboard/imx_keypad.c:485:9: note: in expansion of macro '__set_bit'
485 | __set_bit(EV_REP, input_dev->evbit);
| ^~~~~~~~~
drivers/input/keyboard/imx_keypad.c:485:36: error: invalid use of undefined type 'struct input_dev'
485 | __set_bit(EV_REP, input_dev->evbit);
| ^~
include/linux/bitops.h:51:23: note: in definition of macro 'bitop'
51 | (uintptr_t)(addr) != (uintptr_t)NULL && \
| ^~~~
drivers/input/keyboard/imx_keypad.c:485:9: note: in expansion of macro '__set_bit'
485 | __set_bit(EV_REP, input_dev->evbit);
| ^~~~~~~~~
drivers/input/keyboard/imx_keypad.c:485:36: error: invalid use of undefined type 'struct input_dev'
485 | __set_bit(EV_REP, input_dev->evbit);
| ^~
include/linux/bitops.h:52:57: note: in definition of macro 'bitop'
52 | __builtin_constant_p(*(const unsigned long *)(addr))) ? \
| ^~~~
drivers/input/keyboard/imx_keypad.c:485:9: note: in expansion of macro '__set_bit'
485 | __set_bit(EV_REP, input_dev->evbit);
| ^~~~~~~~~
drivers/input/keyboard/imx_keypad.c:485:36: error: invalid use of undefined type 'struct input_dev'
485 | __set_bit(EV_REP, input_dev->evbit);
| ^~
include/linux/bitops.h:53:24: note: in definition of macro 'bitop'
53 | const##op(nr, addr) : op(nr, addr))
| ^~~~
drivers/input/keyboard/imx_keypad.c:485:9: note: in expansion of macro '__set_bit'
485 | __set_bit(EV_REP, input_dev->evbit);
| ^~~~~~~~~
drivers/input/keyboard/imx_keypad.c:485:36: error: invalid use of undefined type 'struct input_dev'
485 | __set_bit(EV_REP, input_dev->evbit);
| ^~
include/linux/bitops.h:53:39: note: in definition of macro 'bitop'
53 | const##op(nr, addr) : op(nr, addr))
| ^~~~
drivers/input/keyboard/imx_keypad.c:485:9: note: in expansion of macro '__set_bit'
485 | __set_bit(EV_REP, input_dev->evbit);
| ^~~~~~~~~
>> drivers/input/keyboard/imx_keypad.c:486:9: error: implicit declaration of function 'input_set_capability' [-Werror=implicit-function-declaration]
486 | input_set_capability(input_dev, EV_MSC, MSC_SCAN);
| ^~~~~~~~~~~~~~~~~~~~
drivers/input/keyboard/imx_keypad.c:486:41: error: 'EV_MSC' undeclared (first use in this function)
486 | input_set_capability(input_dev, EV_MSC, MSC_SCAN);
| ^~~~~~
drivers/input/keyboard/imx_keypad.c:486:49: error: 'MSC_SCAN' undeclared (first use in this function)
486 | input_set_capability(input_dev, EV_MSC, MSC_SCAN);
| ^~~~~~~~
>> drivers/input/keyboard/imx_keypad.c:487:9: error: implicit declaration of function 'input_set_drvdata'; did you mean 'dev_set_drvdata'? [-Werror=implicit-function-declaration]
487 | input_set_drvdata(input_dev, keypad);
| ^~~~~~~~~~~~~~~~~
| dev_set_drvdata
>> drivers/input/keyboard/imx_keypad.c:504:17: error: implicit declaration of function 'input_register_device' [-Werror=implicit-function-declaration]
504 | error = input_register_device(input_dev);
| ^~~~~~~~~~~~~~~~~~~~~
In file included from include/linux/notifier.h:14,
from include/linux/clk.h:14:
drivers/input/keyboard/imx_keypad.c: In function 'imx_kbd_noirq_suspend':
drivers/input/keyboard/imx_keypad.c:524:30: error: invalid use of undefined type 'struct input_dev'
524 | mutex_lock(&input_dev->mutex);
| ^~
include/linux/mutex.h:187:44: note: in definition of macro 'mutex_lock'
187 | #define mutex_lock(lock) mutex_lock_nested(lock, 0)
| ^~~~
>> drivers/input/keyboard/imx_keypad.c:526:13: error: implicit declaration of function 'input_device_enabled' [-Werror=implicit-function-declaration]
526 | if (input_device_enabled(input_dev))
| ^~~~~~~~~~~~~~~~~~~~
drivers/input/keyboard/imx_keypad.c:529:32: error: invalid use of undefined type 'struct input_dev'
529 | mutex_unlock(&input_dev->mutex);
| ^~
drivers/input/keyboard/imx_keypad.c: In function 'imx_kbd_noirq_resume':
drivers/input/keyboard/imx_keypad.c:554:30: error: invalid use of undefined type 'struct input_dev'
554 | mutex_lock(&input_dev->mutex);
| ^~
include/linux/mutex.h:187:44: note: in definition of macro 'mutex_lock'
187 | #define mutex_lock(lock) mutex_lock_nested(lock, 0)
| ^~~~
drivers/input/keyboard/imx_keypad.c:563:32: error: invalid use of undefined type 'struct input_dev'
563 | mutex_unlock(&input_dev->mutex);
| ^~
cc1: some warnings being treated as errors
..


vim +186 drivers/input/keyboard/ep93xx_keypad.c

e06003af56c386 H Hartley Sweeten 2009-04-18 81
e06003af56c386 H Hartley Sweeten 2009-04-18 82 static irqreturn_t ep93xx_keypad_irq_handler(int irq, void *dev_id)
e06003af56c386 H Hartley Sweeten 2009-04-18 83 {
e06003af56c386 H Hartley Sweeten 2009-04-18 84 struct ep93xx_keypad *keypad = dev_id;
e06003af56c386 H Hartley Sweeten 2009-04-18 85 struct input_dev *input_dev = keypad->input_dev;
60214f058f44cf H Hartley Sweeten 2009-12-15 86 unsigned int status;
e06003af56c386 H Hartley Sweeten 2009-04-18 87 int keycode, key1, key2;
e06003af56c386 H Hartley Sweeten 2009-04-18 88
60214f058f44cf H Hartley Sweeten 2009-12-15 89 status = __raw_readl(keypad->mmio_base + KEY_REG);
60214f058f44cf H Hartley Sweeten 2009-12-15 90
e06003af56c386 H Hartley Sweeten 2009-04-18 91 keycode = (status & KEY_REG_KEY1_MASK) >> KEY_REG_KEY1_SHIFT;
a5abd95cc0b350 H Hartley Sweeten 2010-01-13 92 key1 = keypad->keycodes[keycode];
e06003af56c386 H Hartley Sweeten 2009-04-18 93
e06003af56c386 H Hartley Sweeten 2009-04-18 94 keycode = (status & KEY_REG_KEY2_MASK) >> KEY_REG_KEY2_SHIFT;
a5abd95cc0b350 H Hartley Sweeten 2010-01-13 95 key2 = keypad->keycodes[keycode];
e06003af56c386 H Hartley Sweeten 2009-04-18 96
e06003af56c386 H Hartley Sweeten 2009-04-18 97 if (status & KEY_REG_2KEYS) {
e06003af56c386 H Hartley Sweeten 2009-04-18 98 if (keypad->key1 && key1 != keypad->key1 && key2 != keypad->key1)
e06003af56c386 H Hartley Sweeten 2009-04-18 @99 input_report_key(input_dev, keypad->key1, 0);
e06003af56c386 H Hartley Sweeten 2009-04-18 100
e06003af56c386 H Hartley Sweeten 2009-04-18 101 if (keypad->key2 && key1 != keypad->key2 && key2 != keypad->key2)
e06003af56c386 H Hartley Sweeten 2009-04-18 102 input_report_key(input_dev, keypad->key2, 0);
e06003af56c386 H Hartley Sweeten 2009-04-18 103
e06003af56c386 H Hartley Sweeten 2009-04-18 104 input_report_key(input_dev, key1, 1);
e06003af56c386 H Hartley Sweeten 2009-04-18 105 input_report_key(input_dev, key2, 1);
e06003af56c386 H Hartley Sweeten 2009-04-18 106
e06003af56c386 H Hartley Sweeten 2009-04-18 107 keypad->key1 = key1;
e06003af56c386 H Hartley Sweeten 2009-04-18 108 keypad->key2 = key2;
e06003af56c386 H Hartley Sweeten 2009-04-18 109
e06003af56c386 H Hartley Sweeten 2009-04-18 110 } else if (status & KEY_REG_1KEY) {
e06003af56c386 H Hartley Sweeten 2009-04-18 111 if (keypad->key1 && key1 != keypad->key1)
e06003af56c386 H Hartley Sweeten 2009-04-18 112 input_report_key(input_dev, keypad->key1, 0);
e06003af56c386 H Hartley Sweeten 2009-04-18 113
e06003af56c386 H Hartley Sweeten 2009-04-18 114 if (keypad->key2 && key1 != keypad->key2)
e06003af56c386 H Hartley Sweeten 2009-04-18 115 input_report_key(input_dev, keypad->key2, 0);
e06003af56c386 H Hartley Sweeten 2009-04-18 116
e06003af56c386 H Hartley Sweeten 2009-04-18 117 input_report_key(input_dev, key1, 1);
e06003af56c386 H Hartley Sweeten 2009-04-18 118
e06003af56c386 H Hartley Sweeten 2009-04-18 119 keypad->key1 = key1;
e06003af56c386 H Hartley Sweeten 2009-04-18 120 keypad->key2 = 0;
e06003af56c386 H Hartley Sweeten 2009-04-18 121
e06003af56c386 H Hartley Sweeten 2009-04-18 122 } else {
e06003af56c386 H Hartley Sweeten 2009-04-18 123 input_report_key(input_dev, keypad->key1, 0);
e06003af56c386 H Hartley Sweeten 2009-04-18 124 input_report_key(input_dev, keypad->key2, 0);
e06003af56c386 H Hartley Sweeten 2009-04-18 125
e06003af56c386 H Hartley Sweeten 2009-04-18 126 keypad->key1 = keypad->key2 = 0;
e06003af56c386 H Hartley Sweeten 2009-04-18 127 }
e06003af56c386 H Hartley Sweeten 2009-04-18 @128 input_sync(input_dev);
e06003af56c386 H Hartley Sweeten 2009-04-18 129
e06003af56c386 H Hartley Sweeten 2009-04-18 130 return IRQ_HANDLED;
e06003af56c386 H Hartley Sweeten 2009-04-18 131 }
e06003af56c386 H Hartley Sweeten 2009-04-18 132
e06003af56c386 H Hartley Sweeten 2009-04-18 133 static void ep93xx_keypad_config(struct ep93xx_keypad *keypad)
e06003af56c386 H Hartley Sweeten 2009-04-18 134 {
e06003af56c386 H Hartley Sweeten 2009-04-18 135 struct ep93xx_keypad_platform_data *pdata = keypad->pdata;
e06003af56c386 H Hartley Sweeten 2009-04-18 136 unsigned int val = 0;
e06003af56c386 H Hartley Sweeten 2009-04-18 137
dfb6db007a5699 Arnd Bergmann 2019-04-15 138 clk_set_rate(keypad->clk, pdata->clk_rate);
e06003af56c386 H Hartley Sweeten 2009-04-18 139
e06003af56c386 H Hartley Sweeten 2009-04-18 140 if (pdata->flags & EP93XX_KEYPAD_DISABLE_3_KEY)
e06003af56c386 H Hartley Sweeten 2009-04-18 141 val |= KEY_INIT_DIS3KY;
e06003af56c386 H Hartley Sweeten 2009-04-18 142 if (pdata->flags & EP93XX_KEYPAD_DIAG_MODE)
e06003af56c386 H Hartley Sweeten 2009-04-18 143 val |= KEY_INIT_DIAG;
e06003af56c386 H Hartley Sweeten 2009-04-18 144 if (pdata->flags & EP93XX_KEYPAD_BACK_DRIVE)
e06003af56c386 H Hartley Sweeten 2009-04-18 145 val |= KEY_INIT_BACK;
e06003af56c386 H Hartley Sweeten 2009-04-18 146 if (pdata->flags & EP93XX_KEYPAD_TEST_MODE)
e06003af56c386 H Hartley Sweeten 2009-04-18 147 val |= KEY_INIT_T2;
e06003af56c386 H Hartley Sweeten 2009-04-18 148
e06003af56c386 H Hartley Sweeten 2009-04-18 149 val |= ((pdata->debounce << KEY_INIT_DBNC_SHIFT) & KEY_INIT_DBNC_MASK);
e06003af56c386 H Hartley Sweeten 2009-04-18 150
e06003af56c386 H Hartley Sweeten 2009-04-18 151 val |= ((pdata->prescale << KEY_INIT_PRSCL_SHIFT) & KEY_INIT_PRSCL_MASK);
e06003af56c386 H Hartley Sweeten 2009-04-18 152
60214f058f44cf H Hartley Sweeten 2009-12-15 153 __raw_writel(val, keypad->mmio_base + KEY_INIT);
e06003af56c386 H Hartley Sweeten 2009-04-18 154 }
e06003af56c386 H Hartley Sweeten 2009-04-18 155
e06003af56c386 H Hartley Sweeten 2009-04-18 156 static int ep93xx_keypad_open(struct input_dev *pdev)
e06003af56c386 H Hartley Sweeten 2009-04-18 157 {
e06003af56c386 H Hartley Sweeten 2009-04-18 @158 struct ep93xx_keypad *keypad = input_get_drvdata(pdev);
e06003af56c386 H Hartley Sweeten 2009-04-18 159
e06003af56c386 H Hartley Sweeten 2009-04-18 160 if (!keypad->enabled) {
e06003af56c386 H Hartley Sweeten 2009-04-18 161 ep93xx_keypad_config(keypad);
62e4fe9f608f4e Alexander Sverdlin 2021-06-14 162 clk_prepare_enable(keypad->clk);
60214f058f44cf H Hartley Sweeten 2009-12-15 163 keypad->enabled = true;
e06003af56c386 H Hartley Sweeten 2009-04-18 164 }
e06003af56c386 H Hartley Sweeten 2009-04-18 165
e06003af56c386 H Hartley Sweeten 2009-04-18 166 return 0;
e06003af56c386 H Hartley Sweeten 2009-04-18 167 }
e06003af56c386 H Hartley Sweeten 2009-04-18 168
e06003af56c386 H Hartley Sweeten 2009-04-18 169 static void ep93xx_keypad_close(struct input_dev *pdev)
e06003af56c386 H Hartley Sweeten 2009-04-18 170 {
e06003af56c386 H Hartley Sweeten 2009-04-18 @171 struct ep93xx_keypad *keypad = input_get_drvdata(pdev);
e06003af56c386 H Hartley Sweeten 2009-04-18 172
e06003af56c386 H Hartley Sweeten 2009-04-18 173 if (keypad->enabled) {
62e4fe9f608f4e Alexander Sverdlin 2021-06-14 174 clk_disable_unprepare(keypad->clk);
60214f058f44cf H Hartley Sweeten 2009-12-15 175 keypad->enabled = false;
e06003af56c386 H Hartley Sweeten 2009-04-18 176 }
e06003af56c386 H Hartley Sweeten 2009-04-18 177 }
e06003af56c386 H Hartley Sweeten 2009-04-18 178
e06003af56c386 H Hartley Sweeten 2009-04-18 179
03b47b3ad0a9dc Dmitry Torokhov 2021-10-11 180 static int __maybe_unused ep93xx_keypad_suspend(struct device *dev)
e06003af56c386 H Hartley Sweeten 2009-04-18 181 {
b5e9528bd19c6a Dmitry Torokhov 2012-04-11 182 struct platform_device *pdev = to_platform_device(dev);
e06003af56c386 H Hartley Sweeten 2009-04-18 183 struct ep93xx_keypad *keypad = platform_get_drvdata(pdev);
e06003af56c386 H Hartley Sweeten 2009-04-18 184 struct input_dev *input_dev = keypad->input_dev;
e06003af56c386 H Hartley Sweeten 2009-04-18 185
e06003af56c386 H Hartley Sweeten 2009-04-18 @186 mutex_lock(&input_dev->mutex);
e06003af56c386 H Hartley Sweeten 2009-04-18 187
e06003af56c386 H Hartley Sweeten 2009-04-18 188 if (keypad->enabled) {
e06003af56c386 H Hartley Sweeten 2009-04-18 189 clk_disable(keypad->clk);
60214f058f44cf H Hartley Sweeten 2009-12-15 190 keypad->enabled = false;
e06003af56c386 H Hartley Sweeten 2009-04-18 191 }
e06003af56c386 H Hartley Sweeten 2009-04-18 192
e06003af56c386 H Hartley Sweeten 2009-04-18 193 mutex_unlock(&input_dev->mutex);
e06003af56c386 H Hartley Sweeten 2009-04-18 194
e06003af56c386 H Hartley Sweeten 2009-04-18 195 return 0;
e06003af56c386 H Hartley Sweeten 2009-04-18 196 }
e06003af56c386 H Hartley Sweeten 2009-04-18 197
03b47b3ad0a9dc Dmitry Torokhov 2021-10-11 198 static int __maybe_unused ep93xx_keypad_resume(struct device *dev)
e06003af56c386 H Hartley Sweeten 2009-04-18 199 {
b5e9528bd19c6a Dmitry Torokhov 2012-04-11 200 struct platform_device *pdev = to_platform_device(dev);
e06003af56c386 H Hartley Sweeten 2009-04-18 201 struct ep93xx_keypad *keypad = platform_get_drvdata(pdev);
e06003af56c386 H Hartley Sweeten 2009-04-18 202 struct input_dev *input_dev = keypad->input_dev;
e06003af56c386 H Hartley Sweeten 2009-04-18 203
e06003af56c386 H Hartley Sweeten 2009-04-18 @204 mutex_lock(&input_dev->mutex);
e06003af56c386 H Hartley Sweeten 2009-04-18 205
d69f0a43c677e8 Andrzej Pietrasiewicz 2020-10-04 @206 if (input_device_enabled(input_dev)) {
e06003af56c386 H Hartley Sweeten 2009-04-18 207 if (!keypad->enabled) {
e06003af56c386 H Hartley Sweeten 2009-04-18 208 ep93xx_keypad_config(keypad);
e06003af56c386 H Hartley Sweeten 2009-04-18 209 clk_enable(keypad->clk);
60214f058f44cf H Hartley Sweeten 2009-12-15 210 keypad->enabled = true;
e06003af56c386 H Hartley Sweeten 2009-04-18 211 }
e06003af56c386 H Hartley Sweeten 2009-04-18 212 }
e06003af56c386 H Hartley Sweeten 2009-04-18 213
e06003af56c386 H Hartley Sweeten 2009-04-18 @214 mutex_unlock(&input_dev->mutex);
e06003af56c386 H Hartley Sweeten 2009-04-18 215
e06003af56c386 H Hartley Sweeten 2009-04-18 216 return 0;
e06003af56c386 H Hartley Sweeten 2009-04-18 217 }
b5e9528bd19c6a Dmitry Torokhov 2012-04-11 218
b5e9528bd19c6a Dmitry Torokhov 2012-04-11 219 static SIMPLE_DEV_PM_OPS(ep93xx_keypad_pm_ops,
b5e9528bd19c6a Dmitry Torokhov 2012-04-11 220 ep93xx_keypad_suspend, ep93xx_keypad_resume);
e06003af56c386 H Hartley Sweeten 2009-04-18 221
c4be5e5a113d78 Dmitry Torokhov 2021-10-12 222 static void ep93xx_keypad_release_gpio_action(void *_pdev)
c4be5e5a113d78 Dmitry Torokhov 2021-10-12 223 {
c4be5e5a113d78 Dmitry Torokhov 2021-10-12 224 struct platform_device *pdev = _pdev;
c4be5e5a113d78 Dmitry Torokhov 2021-10-12 225
c4be5e5a113d78 Dmitry Torokhov 2021-10-12 226 ep93xx_keypad_release_gpio(pdev);
c4be5e5a113d78 Dmitry Torokhov 2021-10-12 227 }
c4be5e5a113d78 Dmitry Torokhov 2021-10-12 228
5298cc4cc753bb Bill Pemberton 2012-11-23 229 static int ep93xx_keypad_probe(struct platform_device *pdev)
e06003af56c386 H Hartley Sweeten 2009-04-18 230 {
e06003af56c386 H Hartley Sweeten 2009-04-18 231 struct ep93xx_keypad *keypad;
a5abd95cc0b350 H Hartley Sweeten 2010-01-13 232 const struct matrix_keymap_data *keymap_data;
e06003af56c386 H Hartley Sweeten 2009-04-18 233 struct input_dev *input_dev;
60214f058f44cf H Hartley Sweeten 2009-12-15 234 int err;
e06003af56c386 H Hartley Sweeten 2009-04-18 235
c4be5e5a113d78 Dmitry Torokhov 2021-10-12 236 keypad = devm_kzalloc(&pdev->dev, sizeof(*keypad), GFP_KERNEL);
60214f058f44cf H Hartley Sweeten 2009-12-15 237 if (!keypad)
e06003af56c386 H Hartley Sweeten 2009-04-18 238 return -ENOMEM;
e06003af56c386 H Hartley Sweeten 2009-04-18 239
c838cb3d477f79 Jingoo Han 2013-12-05 240 keypad->pdata = dev_get_platdata(&pdev->dev);
c4be5e5a113d78 Dmitry Torokhov 2021-10-12 241 if (!keypad->pdata)
c4be5e5a113d78 Dmitry Torokhov 2021-10-12 242 return -EINVAL;
e06003af56c386 H Hartley Sweeten 2009-04-18 243
a5abd95cc0b350 H Hartley Sweeten 2010-01-13 244 keymap_data = keypad->pdata->keymap_data;
c4be5e5a113d78 Dmitry Torokhov 2021-10-12 245 if (!keymap_data)
c4be5e5a113d78 Dmitry Torokhov 2021-10-12 246 return -EINVAL;
a5abd95cc0b350 H Hartley Sweeten 2010-01-13 247
60214f058f44cf H Hartley Sweeten 2009-12-15 248 keypad->irq = platform_get_irq(pdev, 0);
c4be5e5a113d78 Dmitry Torokhov 2021-10-12 249 if (keypad->irq < 0)
c4be5e5a113d78 Dmitry Torokhov 2021-10-12 250 return keypad->irq;
e06003af56c386 H Hartley Sweeten 2009-04-18 251
28e26e927cf4a3 Lv Ruyi 2022-04-20 252 keypad->mmio_base = devm_platform_ioremap_resource(pdev, 0);
c4be5e5a113d78 Dmitry Torokhov 2021-10-12 253 if (IS_ERR(keypad->mmio_base))
c4be5e5a113d78 Dmitry Torokhov 2021-10-12 254 return PTR_ERR(keypad->mmio_base);
e06003af56c386 H Hartley Sweeten 2009-04-18 255
60214f058f44cf H Hartley Sweeten 2009-12-15 256 err = ep93xx_keypad_acquire_gpio(pdev);
60214f058f44cf H Hartley Sweeten 2009-12-15 257 if (err)
c4be5e5a113d78 Dmitry Torokhov 2021-10-12 258 return err;
e06003af56c386 H Hartley Sweeten 2009-04-18 259
c4be5e5a113d78 Dmitry Torokhov 2021-10-12 260 err = devm_add_action_or_reset(&pdev->dev,
c4be5e5a113d78 Dmitry Torokhov 2021-10-12 261 ep93xx_keypad_release_gpio_action, pdev);
c4be5e5a113d78 Dmitry Torokhov 2021-10-12 262 if (err)
c4be5e5a113d78 Dmitry Torokhov 2021-10-12 263 return err;
e06003af56c386 H Hartley Sweeten 2009-04-18 264
c4be5e5a113d78 Dmitry Torokhov 2021-10-12 265 keypad->clk = devm_clk_get(&pdev->dev, NULL);
c4be5e5a113d78 Dmitry Torokhov 2021-10-12 266 if (IS_ERR(keypad->clk))
c4be5e5a113d78 Dmitry Torokhov 2021-10-12 267 return PTR_ERR(keypad->clk);
c4be5e5a113d78 Dmitry Torokhov 2021-10-12 268
c4be5e5a113d78 Dmitry Torokhov 2021-10-12 @269 input_dev = devm_input_allocate_device(&pdev->dev);
c4be5e5a113d78 Dmitry Torokhov 2021-10-12 270 if (!input_dev)
c4be5e5a113d78 Dmitry Torokhov 2021-10-12 271 return -ENOMEM;
e06003af56c386 H Hartley Sweeten 2009-04-18 272
e06003af56c386 H Hartley Sweeten 2009-04-18 273 keypad->input_dev = input_dev;
e06003af56c386 H Hartley Sweeten 2009-04-18 274
e06003af56c386 H Hartley Sweeten 2009-04-18 275 input_dev->name = pdev->name;
e06003af56c386 H Hartley Sweeten 2009-04-18 @276 input_dev->id.bustype = BUS_HOST;
e06003af56c386 H Hartley Sweeten 2009-04-18 277 input_dev->open = ep93xx_keypad_open;
e06003af56c386 H Hartley Sweeten 2009-04-18 278 input_dev->close = ep93xx_keypad_close;
e06003af56c386 H Hartley Sweeten 2009-04-18 279
1932811f426fee Dmitry Torokhov 2012-05-10 280 err = matrix_keypad_build_keymap(keymap_data, NULL,
1932811f426fee Dmitry Torokhov 2012-05-10 281 EP93XX_MATRIX_ROWS, EP93XX_MATRIX_COLS,
1932811f426fee Dmitry Torokhov 2012-05-10 282 keypad->keycodes, input_dev);
1932811f426fee Dmitry Torokhov 2012-05-10 283 if (err)
c4be5e5a113d78 Dmitry Torokhov 2021-10-12 284 return err;
e06003af56c386 H Hartley Sweeten 2009-04-18 285
e06003af56c386 H Hartley Sweeten 2009-04-18 286 if (keypad->pdata->flags & EP93XX_KEYPAD_AUTOREPEAT)
1932811f426fee Dmitry Torokhov 2012-05-10 @287 __set_bit(EV_REP, input_dev->evbit);
1932811f426fee Dmitry Torokhov 2012-05-10 @288 input_set_drvdata(input_dev, keypad);
e06003af56c386 H Hartley Sweeten 2009-04-18 289
c4be5e5a113d78 Dmitry Torokhov 2021-10-12 290 err = devm_request_irq(&pdev->dev, keypad->irq,
c4be5e5a113d78 Dmitry Torokhov 2021-10-12 291 ep93xx_keypad_irq_handler,
ec4665c46b11f6 Yong Zhang 2011-09-07 292 0, pdev->name, keypad);
60214f058f44cf H Hartley Sweeten 2009-12-15 293 if (err)
c4be5e5a113d78 Dmitry Torokhov 2021-10-12 294 return err;
e06003af56c386 H Hartley Sweeten 2009-04-18 295
e06003af56c386 H Hartley Sweeten 2009-04-18 @296 err = input_register_device(input_dev);
60214f058f44cf H Hartley Sweeten 2009-12-15 297 if (err)
c4be5e5a113d78 Dmitry Torokhov 2021-10-12 298 return err;
e06003af56c386 H Hartley Sweeten 2009-04-18 299
1932811f426fee Dmitry Torokhov 2012-05-10 300 platform_set_drvdata(pdev, keypad);
ab317169673dbd Dmitry Torokhov 2021-10-11 301
e06003af56c386 H Hartley Sweeten 2009-04-18 302 device_init_wakeup(&pdev->dev, 1);
ab317169673dbd Dmitry Torokhov 2021-10-11 303 err = dev_pm_set_wake_irq(&pdev->dev, keypad->irq);
ab317169673dbd Dmitry Torokhov 2021-10-11 304 if (err)
ab317169673dbd Dmitry Torokhov 2021-10-11 305 dev_warn(&pdev->dev, "failed to set up wakeup irq: %d\n", err);
e06003af56c386 H Hartley Sweeten 2009-04-18 306
e06003af56c386 H Hartley Sweeten 2009-04-18 307 return 0;
e06003af56c386 H Hartley Sweeten 2009-04-18 308 }
e06003af56c386 H Hartley Sweeten 2009-04-18 309

--
0-DAY CI Kernel Test Service
https://01.org/lkp


Attachments:
(No filename) (44.15 kB)
config (246.73 kB)
Download all attachments

2022-09-24 04:39:12

by kernel test robot

[permalink] [raw]
Subject: Re: [PATCH v1 2/2] Input: matrix_keypad - replace header inclusions by forward declarations

Hi Andy,

I love your patch! Perhaps something to improve:

[auto build test WARNING on dtor-input/next]
[also build test WARNING on hid/for-next linus/master v6.0-rc6 next-20220923]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url: https://github.com/intel-lab-lkp/linux/commits/Andy-Shevchenko/Input-matrix_keypad-add-missed-header-inclusion/20220924-024709
base: https://git.kernel.org/pub/scm/linux/kernel/git/dtor/input.git next
config: i386-randconfig-a004
compiler: clang version 14.0.6 (https://github.com/llvm/llvm-project f28c006a5895fc0e329fe15fead81e37457cb1d1)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/intel-lab-lkp/linux/commit/baec96dd9b994bf310565d1eca5eb476fa9c0fd3
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Andy-Shevchenko/Input-matrix_keypad-add-missed-header-inclusion/20220924-024709
git checkout baec96dd9b994bf310565d1eca5eb476fa9c0fd3
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=i386 SHELL=/bin/bash drivers/input/keyboard/

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <[email protected]>

All warnings (new ones prefixed by >>):

drivers/input/keyboard/lm8333.c:95:3: error: implicit declaration of function 'input_event' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
input_event(input, EV_MSC, MSC_SCAN, code);
^
drivers/input/keyboard/lm8333.c:95:22: error: use of undeclared identifier 'EV_MSC'
input_event(input, EV_MSC, MSC_SCAN, code);
^
drivers/input/keyboard/lm8333.c:95:30: error: use of undeclared identifier 'MSC_SCAN'
input_event(input, EV_MSC, MSC_SCAN, code);
^
drivers/input/keyboard/lm8333.c:96:3: error: implicit declaration of function 'input_report_key' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
input_report_key(input, lm8333->keycodes[code], pressed);
^
drivers/input/keyboard/lm8333.c:99:2: error: implicit declaration of function 'input_sync' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
input_sync(input);
^
drivers/input/keyboard/lm8333.c:99:2: note: did you mean 'mmput_async'?
include/linux/sched/mm.h:114:6: note: 'mmput_async' declared here
void mmput_async(struct mm_struct *);
^
drivers/input/keyboard/lm8333.c:147:10: error: implicit declaration of function 'input_allocate_device' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
input = input_allocate_device();
^
>> drivers/input/keyboard/lm8333.c:147:8: warning: incompatible integer to pointer conversion assigning to 'struct input_dev *' from 'int' [-Wint-conversion]
input = input_allocate_device();
^ ~~~~~~~~~~~~~~~~~~~~~~~
drivers/input/keyboard/lm8333.c:156:7: error: incomplete definition of type 'struct input_dev'
input->name = client->name;
~~~~~^
include/linux/input/matrix_keypad.h:8:8: note: forward declaration of 'struct input_dev'
struct input_dev;
^
drivers/input/keyboard/lm8333.c:157:7: error: incomplete definition of type 'struct input_dev'
input->dev.parent = &client->dev;
~~~~~^
include/linux/input/matrix_keypad.h:8:8: note: forward declaration of 'struct input_dev'
struct input_dev;
^
drivers/input/keyboard/lm8333.c:158:7: error: incomplete definition of type 'struct input_dev'
input->id.bustype = BUS_I2C;
~~~~~^
include/linux/input/matrix_keypad.h:8:8: note: forward declaration of 'struct input_dev'
struct input_dev;
^
drivers/input/keyboard/lm8333.c:158:22: error: use of undeclared identifier 'BUS_I2C'
input->id.bustype = BUS_I2C;
^
drivers/input/keyboard/lm8333.c:160:2: error: implicit declaration of function 'input_set_capability' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
input_set_capability(input, EV_MSC, MSC_SCAN);
^
drivers/input/keyboard/lm8333.c:160:30: error: use of undeclared identifier 'EV_MSC'
input_set_capability(input, EV_MSC, MSC_SCAN);
^
drivers/input/keyboard/lm8333.c:160:38: error: use of undeclared identifier 'MSC_SCAN'
input_set_capability(input, EV_MSC, MSC_SCAN);
^
drivers/input/keyboard/lm8333.c:188:8: error: implicit declaration of function 'input_register_device' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
err = input_register_device(input);
^
drivers/input/keyboard/lm8333.c:188:8: note: did you mean 'i2c_unregister_device'?
include/linux/i2c.h:489:6: note: 'i2c_unregister_device' declared here
void i2c_unregister_device(struct i2c_client *client);
^
drivers/input/keyboard/lm8333.c:198:2: error: implicit declaration of function 'input_free_device' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
input_free_device(input);
^
drivers/input/keyboard/lm8333.c:208:2: error: implicit declaration of function 'input_unregister_device' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
input_unregister_device(lm8333->input);
^
drivers/input/keyboard/lm8333.c:208:2: note: did you mean 'i2c_unregister_device'?
include/linux/i2c.h:489:6: note: 'i2c_unregister_device' declared here
void i2c_unregister_device(struct i2c_client *client);
^
1 warning and 16 errors generated.


vim +147 drivers/input/keyboard/lm8333.c

0bf25a45386f28 Wolfram Sang 2012-04-03 127
5298cc4cc753bb Bill Pemberton 2012-11-23 128 static int lm8333_probe(struct i2c_client *client,
0bf25a45386f28 Wolfram Sang 2012-04-03 129 const struct i2c_device_id *id)
0bf25a45386f28 Wolfram Sang 2012-04-03 130 {
c838cb3d477f79 Jingoo Han 2013-12-05 131 const struct lm8333_platform_data *pdata =
c838cb3d477f79 Jingoo Han 2013-12-05 132 dev_get_platdata(&client->dev);
0bf25a45386f28 Wolfram Sang 2012-04-03 133 struct lm8333 *lm8333;
0bf25a45386f28 Wolfram Sang 2012-04-03 134 struct input_dev *input;
0bf25a45386f28 Wolfram Sang 2012-04-03 135 int err, active_time;
0bf25a45386f28 Wolfram Sang 2012-04-03 136
0bf25a45386f28 Wolfram Sang 2012-04-03 137 if (!pdata)
0bf25a45386f28 Wolfram Sang 2012-04-03 138 return -EINVAL;
0bf25a45386f28 Wolfram Sang 2012-04-03 139
0bf25a45386f28 Wolfram Sang 2012-04-03 140 active_time = pdata->active_time ?: 500;
0bf25a45386f28 Wolfram Sang 2012-04-03 141 if (active_time / 3 <= pdata->debounce_time / 3) {
0bf25a45386f28 Wolfram Sang 2012-04-03 142 dev_err(&client->dev, "Active time not big enough!\n");
0bf25a45386f28 Wolfram Sang 2012-04-03 143 return -EINVAL;
0bf25a45386f28 Wolfram Sang 2012-04-03 144 }
0bf25a45386f28 Wolfram Sang 2012-04-03 145
0bf25a45386f28 Wolfram Sang 2012-04-03 146 lm8333 = kzalloc(sizeof(*lm8333), GFP_KERNEL);
0bf25a45386f28 Wolfram Sang 2012-04-03 @147 input = input_allocate_device();
0bf25a45386f28 Wolfram Sang 2012-04-03 148 if (!lm8333 || !input) {
0bf25a45386f28 Wolfram Sang 2012-04-03 149 err = -ENOMEM;
0bf25a45386f28 Wolfram Sang 2012-04-03 150 goto free_mem;
0bf25a45386f28 Wolfram Sang 2012-04-03 151 }
0bf25a45386f28 Wolfram Sang 2012-04-03 152
0bf25a45386f28 Wolfram Sang 2012-04-03 153 lm8333->client = client;
0bf25a45386f28 Wolfram Sang 2012-04-03 154 lm8333->input = input;
0bf25a45386f28 Wolfram Sang 2012-04-03 155
0bf25a45386f28 Wolfram Sang 2012-04-03 156 input->name = client->name;
0bf25a45386f28 Wolfram Sang 2012-04-03 157 input->dev.parent = &client->dev;
0bf25a45386f28 Wolfram Sang 2012-04-03 158 input->id.bustype = BUS_I2C;
0bf25a45386f28 Wolfram Sang 2012-04-03 159
0bf25a45386f28 Wolfram Sang 2012-04-03 160 input_set_capability(input, EV_MSC, MSC_SCAN);
0bf25a45386f28 Wolfram Sang 2012-04-03 161
1932811f426fee Dmitry Torokhov 2012-05-10 162 err = matrix_keypad_build_keymap(pdata->matrix_data, NULL,
1932811f426fee Dmitry Torokhov 2012-05-10 163 LM8333_NUM_ROWS, LM8333_NUM_COLS,
1932811f426fee Dmitry Torokhov 2012-05-10 164 lm8333->keycodes, input);
1932811f426fee Dmitry Torokhov 2012-05-10 165 if (err)
1932811f426fee Dmitry Torokhov 2012-05-10 166 goto free_mem;
0bf25a45386f28 Wolfram Sang 2012-04-03 167
0bf25a45386f28 Wolfram Sang 2012-04-03 168 if (pdata->debounce_time) {
0bf25a45386f28 Wolfram Sang 2012-04-03 169 err = lm8333_write8(lm8333, LM8333_DEBOUNCE,
0bf25a45386f28 Wolfram Sang 2012-04-03 170 pdata->debounce_time / 3);
0bf25a45386f28 Wolfram Sang 2012-04-03 171 if (err)
0bf25a45386f28 Wolfram Sang 2012-04-03 172 dev_warn(&client->dev, "Unable to set debounce time\n");
0bf25a45386f28 Wolfram Sang 2012-04-03 173 }
0bf25a45386f28 Wolfram Sang 2012-04-03 174
0bf25a45386f28 Wolfram Sang 2012-04-03 175 if (pdata->active_time) {
0bf25a45386f28 Wolfram Sang 2012-04-03 176 err = lm8333_write8(lm8333, LM8333_ACTIVE,
0bf25a45386f28 Wolfram Sang 2012-04-03 177 pdata->active_time / 3);
0bf25a45386f28 Wolfram Sang 2012-04-03 178 if (err)
0bf25a45386f28 Wolfram Sang 2012-04-03 179 dev_warn(&client->dev, "Unable to set active time\n");
0bf25a45386f28 Wolfram Sang 2012-04-03 180 }
0bf25a45386f28 Wolfram Sang 2012-04-03 181
0bf25a45386f28 Wolfram Sang 2012-04-03 182 err = request_threaded_irq(client->irq, NULL, lm8333_irq_thread,
0bf25a45386f28 Wolfram Sang 2012-04-03 183 IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
0bf25a45386f28 Wolfram Sang 2012-04-03 184 "lm8333", lm8333);
0bf25a45386f28 Wolfram Sang 2012-04-03 185 if (err)
0bf25a45386f28 Wolfram Sang 2012-04-03 186 goto free_mem;
0bf25a45386f28 Wolfram Sang 2012-04-03 187
0bf25a45386f28 Wolfram Sang 2012-04-03 188 err = input_register_device(input);
0bf25a45386f28 Wolfram Sang 2012-04-03 189 if (err)
0bf25a45386f28 Wolfram Sang 2012-04-03 190 goto free_irq;
0bf25a45386f28 Wolfram Sang 2012-04-03 191
0bf25a45386f28 Wolfram Sang 2012-04-03 192 i2c_set_clientdata(client, lm8333);
0bf25a45386f28 Wolfram Sang 2012-04-03 193 return 0;
0bf25a45386f28 Wolfram Sang 2012-04-03 194
0bf25a45386f28 Wolfram Sang 2012-04-03 195 free_irq:
0bf25a45386f28 Wolfram Sang 2012-04-03 196 free_irq(client->irq, lm8333);
0bf25a45386f28 Wolfram Sang 2012-04-03 197 free_mem:
0bf25a45386f28 Wolfram Sang 2012-04-03 198 input_free_device(input);
0bf25a45386f28 Wolfram Sang 2012-04-03 199 kfree(lm8333);
0bf25a45386f28 Wolfram Sang 2012-04-03 200 return err;
0bf25a45386f28 Wolfram Sang 2012-04-03 201 }
0bf25a45386f28 Wolfram Sang 2012-04-03 202

--
0-DAY CI Kernel Test Service
https://01.org/lkp


Attachments:
(No filename) (11.56 kB)
config (128.99 kB)
Download all attachments

2022-09-26 13:21:47

by Andy Shevchenko

[permalink] [raw]
Subject: Re: [PATCH v1 2/2] Input: matrix_keypad - replace header inclusions by forward declarations

On Fri, Sep 23, 2022 at 12:03:00PM -0700, Dmitry Torokhov wrote:
> On Fri, Sep 23, 2022 at 09:46:32PM +0300, Andy Shevchenko wrote:
> > When the data structure is only referred by pointer, compiler may not need
> > to see the contents of the data type. Thus, we may replace header inclusions
> > by respective forward declarations.

...

> > +struct device;
> > +struct input_dev;
>
> This results in a ton of compile errors. While I believe this change is
> a good one, we need to fix users of this include first.

Indeed, sorry for breaking things (I compile-tested with limited drivers
enabled). I will look into LKP reports and will fix the users.

--
With Best Regards,
Andy Shevchenko


2022-09-26 14:49:25

by Andy Shevchenko

[permalink] [raw]
Subject: Re: [PATCH v1 2/2] Input: matrix_keypad - replace header inclusions by forward declarations

On Mon, Sep 26, 2022 at 01:56:27PM +0300, Andy Shevchenko wrote:
> On Fri, Sep 23, 2022 at 12:03:00PM -0700, Dmitry Torokhov wrote:
> > On Fri, Sep 23, 2022 at 09:46:32PM +0300, Andy Shevchenko wrote:
> > > When the data structure is only referred by pointer, compiler may not need
> > > to see the contents of the data type. Thus, we may replace header inclusions
> > > by respective forward declarations.

...

> > > +struct device;
> > > +struct input_dev;
> >
> > This results in a ton of compile errors. While I believe this change is
> > a good one, we need to fix users of this include first.
>
> Indeed, sorry for breaking things (I compile-tested with limited drivers
> enabled). I will look into LKP reports and will fix the users.

Ah, thanks, I see your series for that!

--
With Best Regards,
Andy Shevchenko