* [PATCH][RESEND] input: adp5589: Make keypad support optional [not found] <20190717122133.24333-1-alexandru.ardelean@analog.com> @ 2019-09-27 12:38 ` Alexandru Ardelean 0 siblings, 0 replies; 9+ messages in thread From: Alexandru Ardelean @ 2019-09-27 12:38 UTC (permalink / raw) To: linux-input, linux-kernel Cc: dmitry.torokhov, Lars-Peter Clausen, Alexandru Ardelean From: Lars-Peter Clausen <lars@metafoo.de> On some platforms the adp5589 is used in GPIO only mode. On these platforms we do not want to register a input device, so make that optional and only create the input device if a keymap is supplied. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com> --- drivers/input/keyboard/adp5589-keys.c | 197 +++++++++++++++----------- 1 file changed, 111 insertions(+), 86 deletions(-) diff --git a/drivers/input/keyboard/adp5589-keys.c b/drivers/input/keyboard/adp5589-keys.c index 4f96a4a99e5b..08bfa8b213e8 100644 --- a/drivers/input/keyboard/adp5589-keys.c +++ b/drivers/input/keyboard/adp5589-keys.c @@ -495,10 +495,10 @@ static int adp5589_build_gpiomap(struct adp5589_kpad *kpad, return n_unused; } -static int adp5589_gpio_add(struct adp5589_kpad *kpad) +static int adp5589_gpio_add(struct adp5589_kpad *kpad, + const struct adp5589_kpad_platform_data *pdata) { struct device *dev = &kpad->client->dev; - const struct adp5589_kpad_platform_data *pdata = dev_get_platdata(dev); const struct adp5589_gpio_platform_data *gpio_data = pdata->gpio_data; int i, error; @@ -550,10 +550,10 @@ static int adp5589_gpio_add(struct adp5589_kpad *kpad) return 0; } -static void adp5589_gpio_remove(struct adp5589_kpad *kpad) +static void adp5589_gpio_remove(struct adp5589_kpad *kpad, + const struct adp5589_kpad_platform_data *pdata) { struct device *dev = &kpad->client->dev; - const struct adp5589_kpad_platform_data *pdata = dev_get_platdata(dev); const struct adp5589_gpio_platform_data *gpio_data = pdata->gpio_data; int error; @@ -571,12 +571,14 @@ static void adp5589_gpio_remove(struct adp5589_kpad *kpad) gpiochip_remove(&kpad->gc); } #else -static inline int adp5589_gpio_add(struct adp5589_kpad *kpad) +static inline int adp5589_gpio_add(struct adp5589_kpad *kpad, + struct const adp5589_kpad_platform_data *pdata) { return 0; } -static inline void adp5589_gpio_remove(struct adp5589_kpad *kpad) +static inline void adp5589_gpio_remove(struct adp5589_kpad *kpad, + struct const adp5589_kpad_platform_data *pdata) { } #endif @@ -652,11 +654,10 @@ static int adp5589_get_evcode(struct adp5589_kpad *kpad, unsigned short key) return -EINVAL; } -static int adp5589_setup(struct adp5589_kpad *kpad) +static int adp5589_setup(struct adp5589_kpad *kpad, + const struct adp5589_kpad_platform_data *pdata) { struct i2c_client *client = kpad->client; - const struct adp5589_kpad_platform_data *pdata = - dev_get_platdata(&client->dev); u8 (*reg) (u8) = kpad->var->reg; unsigned char evt_mode1 = 0, evt_mode2 = 0, evt_mode3 = 0; unsigned char pull_mask = 0; @@ -857,70 +858,37 @@ static void adp5589_report_switch_state(struct adp5589_kpad *kpad) input_sync(kpad->input); } -static int adp5589_probe(struct i2c_client *client, - const struct i2c_device_id *id) +static int adp5589_keypad_add(struct adp5589_kpad *kpad, unsigned int revid, + const struct adp5589_kpad_platform_data *pdata) { - struct adp5589_kpad *kpad; - const struct adp5589_kpad_platform_data *pdata = - dev_get_platdata(&client->dev); + struct i2c_client *client = kpad->client; struct input_dev *input; - unsigned int revid; - int ret, i; + unsigned int i; int error; - if (!i2c_check_functionality(client->adapter, - I2C_FUNC_SMBUS_BYTE_DATA)) { - dev_err(&client->dev, "SMBUS Byte Data not Supported\n"); - return -EIO; - } - - if (!pdata) { - dev_err(&client->dev, "no platform data?\n"); - return -EINVAL; - } - - kpad = kzalloc(sizeof(*kpad), GFP_KERNEL); - if (!kpad) - return -ENOMEM; - - switch (id->driver_data) { - case ADP5585_02: - kpad->support_row5 = true; - /* fall through */ - case ADP5585_01: - kpad->is_adp5585 = true; - kpad->var = &const_adp5585; - break; - case ADP5589: - kpad->support_row5 = true; - kpad->var = &const_adp5589; - break; - } + if (pdata->keymapsize == 0) + return 0; if (!((pdata->keypad_en_mask & kpad->var->row_mask) && (pdata->keypad_en_mask >> kpad->var->col_shift)) || !pdata->keymap) { dev_err(&client->dev, "no rows, cols or keymap from pdata\n"); - error = -EINVAL; - goto err_free_mem; + return -EINVAL; } if (pdata->keymapsize != kpad->var->keymapsize) { dev_err(&client->dev, "invalid keymapsize\n"); - error = -EINVAL; - goto err_free_mem; + return -EINVAL; } if (!pdata->gpimap && pdata->gpimapsize) { dev_err(&client->dev, "invalid gpimap from pdata\n"); - error = -EINVAL; - goto err_free_mem; + return -EINVAL; } if (pdata->gpimapsize > kpad->var->gpimapsize_max) { dev_err(&client->dev, "invalid gpimapsize\n"); - error = -EINVAL; - goto err_free_mem; + return -EINVAL; } for (i = 0; i < pdata->gpimapsize; i++) { @@ -929,41 +897,27 @@ static int adp5589_probe(struct i2c_client *client, if (pin < kpad->var->gpi_pin_base || pin > kpad->var->gpi_pin_end) { dev_err(&client->dev, "invalid gpi pin data\n"); - error = -EINVAL; - goto err_free_mem; + return -EINVAL; } if ((1 << (pin - kpad->var->gpi_pin_row_base)) & pdata->keypad_en_mask) { dev_err(&client->dev, "invalid gpi row/col data\n"); - error = -EINVAL; - goto err_free_mem; + return -EINVAL; } } if (!client->irq) { dev_err(&client->dev, "no IRQ?\n"); - error = -EINVAL; - goto err_free_mem; + return -EINVAL; } input = input_allocate_device(); - if (!input) { - error = -ENOMEM; - goto err_free_mem; - } + if (!input) + return -ENOMEM; - kpad->client = client; kpad->input = input; - ret = adp5589_read(client, ADP5589_5_ID); - if (ret < 0) { - error = ret; - goto err_free_input; - } - - revid = (u8) ret & ADP5589_5_DEVICE_ID_MASK; - input->name = client->name; input->phys = "adp5589-keys/input0"; input->dev.parent = &client->dev; @@ -1015,30 +969,94 @@ static int adp5589_probe(struct i2c_client *client, goto err_unreg_dev; } - error = adp5589_setup(kpad); + device_init_wakeup(&client->dev, 1); + + return 0; + +err_unreg_dev: + input_unregister_device(input); + input = NULL; +err_free_input: + input_free_device(input); + + return error; +} + +static void adp5589_keypad_remove(struct adp5589_kpad *kpad, + const struct adp5589_kpad_platform_data *pdata) +{ + if (!kpad->input) + return; + + free_irq(kpad->client->irq, kpad); + input_unregister_device(kpad->input); +} + +static int adp5589_probe(struct i2c_client *client, + const struct i2c_device_id *id) +{ + struct adp5589_kpad *kpad; + const struct adp5589_kpad_platform_data *pdata = + dev_get_platdata(&client->dev); + unsigned int revid; + int error, ret; + + if (!i2c_check_functionality(client->adapter, + I2C_FUNC_SMBUS_BYTE_DATA)) { + dev_err(&client->dev, "SMBUS Byte Data not Supported\n"); + return -EIO; + } + + + kpad = kzalloc(sizeof(*kpad), GFP_KERNEL); + if (!kpad) + return -ENOMEM; + + kpad->client = client; + + switch (id->driver_data) { + case ADP5585_02: + kpad->support_row5 = true; + case ADP5585_01: + kpad->is_adp5585 = true; + kpad->var = &const_adp5585; + break; + case ADP5589: + kpad->support_row5 = true; + kpad->var = &const_adp5589; + break; + } + + ret = adp5589_read(client, ADP5589_5_ID); + if (ret < 0) { + error = ret; + goto err_free_mem; + } + + revid = (u8) ret & ADP5589_5_DEVICE_ID_MASK; + + error = adp5589_keypad_add(kpad, revid, pdata); if (error) - goto err_free_irq; + goto err_free_mem; + + error = adp5589_setup(kpad, pdata); + if (error) + goto err_keypad_remove; if (kpad->gpimapsize) adp5589_report_switch_state(kpad); - error = adp5589_gpio_add(kpad); + error = adp5589_gpio_add(kpad, pdata); if (error) - goto err_free_irq; + goto err_keypad_remove; - device_init_wakeup(&client->dev, 1); i2c_set_clientdata(client, kpad); dev_info(&client->dev, "Rev.%d keypad, irq %d\n", revid, client->irq); return 0; -err_free_irq: - free_irq(client->irq, kpad); -err_unreg_dev: - input_unregister_device(input); - input = NULL; -err_free_input: - input_free_device(input); +err_keypad_remove: + adp5589_keypad_remove(kpad, pdata); err_free_mem: kfree(kpad); @@ -1048,11 +1066,12 @@ static int adp5589_probe(struct i2c_client *client, static int adp5589_remove(struct i2c_client *client) { struct adp5589_kpad *kpad = i2c_get_clientdata(client); + const struct adp5589_kpad_platform_data *pdata = + dev_get_platdata(&client->dev); adp5589_write(client, kpad->var->reg(ADP5589_GENERAL_CFG), 0); - free_irq(client->irq, kpad); - input_unregister_device(kpad->input); - adp5589_gpio_remove(kpad); + adp5589_keypad_remove(kpad, pdata); + adp5589_gpio_remove(kpad, pdata); kfree(kpad); return 0; @@ -1064,6 +1083,9 @@ static int adp5589_suspend(struct device *dev) struct adp5589_kpad *kpad = dev_get_drvdata(dev); struct i2c_client *client = kpad->client; + if (!kpad->input) + return 0; + disable_irq(client->irq); if (device_may_wakeup(&client->dev)) @@ -1077,6 +1099,9 @@ static int adp5589_resume(struct device *dev) struct adp5589_kpad *kpad = dev_get_drvdata(dev); struct i2c_client *client = kpad->client; + if (!kpad->input) + return 0; + if (device_may_wakeup(&client->dev)) disable_irq_wake(client->irq); -- 2.20.1 ^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH][RESEND] input: adp5589: Make keypad support optional @ 2019-09-27 12:38 ` Alexandru Ardelean 0 siblings, 0 replies; 9+ messages in thread From: Alexandru Ardelean @ 2019-09-27 12:38 UTC (permalink / raw) To: linux-input, linux-kernel Cc: dmitry.torokhov, Lars-Peter Clausen, Alexandru Ardelean From: Lars-Peter Clausen <lars@metafoo.de> On some platforms the adp5589 is used in GPIO only mode. On these platforms we do not want to register a input device, so make that optional and only create the input device if a keymap is supplied. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com> --- drivers/input/keyboard/adp5589-keys.c | 197 +++++++++++++++----------- 1 file changed, 111 insertions(+), 86 deletions(-) diff --git a/drivers/input/keyboard/adp5589-keys.c b/drivers/input/keyboard/adp5589-keys.c index 4f96a4a99e5b..08bfa8b213e8 100644 --- a/drivers/input/keyboard/adp5589-keys.c +++ b/drivers/input/keyboard/adp5589-keys.c @@ -495,10 +495,10 @@ static int adp5589_build_gpiomap(struct adp5589_kpad *kpad, return n_unused; } -static int adp5589_gpio_add(struct adp5589_kpad *kpad) +static int adp5589_gpio_add(struct adp5589_kpad *kpad, + const struct adp5589_kpad_platform_data *pdata) { struct device *dev = &kpad->client->dev; - const struct adp5589_kpad_platform_data *pdata = dev_get_platdata(dev); const struct adp5589_gpio_platform_data *gpio_data = pdata->gpio_data; int i, error; @@ -550,10 +550,10 @@ static int adp5589_gpio_add(struct adp5589_kpad *kpad) return 0; } -static void adp5589_gpio_remove(struct adp5589_kpad *kpad) +static void adp5589_gpio_remove(struct adp5589_kpad *kpad, + const struct adp5589_kpad_platform_data *pdata) { struct device *dev = &kpad->client->dev; - const struct adp5589_kpad_platform_data *pdata = dev_get_platdata(dev); const struct adp5589_gpio_platform_data *gpio_data = pdata->gpio_data; int error; @@ -571,12 +571,14 @@ static void adp5589_gpio_remove(struct adp5589_kpad *kpad) gpiochip_remove(&kpad->gc); } #else -static inline int adp5589_gpio_add(struct adp5589_kpad *kpad) +static inline int adp5589_gpio_add(struct adp5589_kpad *kpad, + struct const adp5589_kpad_platform_data *pdata) { return 0; } -static inline void adp5589_gpio_remove(struct adp5589_kpad *kpad) +static inline void adp5589_gpio_remove(struct adp5589_kpad *kpad, + struct const adp5589_kpad_platform_data *pdata) { } #endif @@ -652,11 +654,10 @@ static int adp5589_get_evcode(struct adp5589_kpad *kpad, unsigned short key) return -EINVAL; } -static int adp5589_setup(struct adp5589_kpad *kpad) +static int adp5589_setup(struct adp5589_kpad *kpad, + const struct adp5589_kpad_platform_data *pdata) { struct i2c_client *client = kpad->client; - const struct adp5589_kpad_platform_data *pdata = - dev_get_platdata(&client->dev); u8 (*reg) (u8) = kpad->var->reg; unsigned char evt_mode1 = 0, evt_mode2 = 0, evt_mode3 = 0; unsigned char pull_mask = 0; @@ -857,70 +858,37 @@ static void adp5589_report_switch_state(struct adp5589_kpad *kpad) input_sync(kpad->input); } -static int adp5589_probe(struct i2c_client *client, - const struct i2c_device_id *id) +static int adp5589_keypad_add(struct adp5589_kpad *kpad, unsigned int revid, + const struct adp5589_kpad_platform_data *pdata) { - struct adp5589_kpad *kpad; - const struct adp5589_kpad_platform_data *pdata = - dev_get_platdata(&client->dev); + struct i2c_client *client = kpad->client; struct input_dev *input; - unsigned int revid; - int ret, i; + unsigned int i; int error; - if (!i2c_check_functionality(client->adapter, - I2C_FUNC_SMBUS_BYTE_DATA)) { - dev_err(&client->dev, "SMBUS Byte Data not Supported\n"); - return -EIO; - } - - if (!pdata) { - dev_err(&client->dev, "no platform data?\n"); - return -EINVAL; - } - - kpad = kzalloc(sizeof(*kpad), GFP_KERNEL); - if (!kpad) - return -ENOMEM; - - switch (id->driver_data) { - case ADP5585_02: - kpad->support_row5 = true; - /* fall through */ - case ADP5585_01: - kpad->is_adp5585 = true; - kpad->var = &const_adp5585; - break; - case ADP5589: - kpad->support_row5 = true; - kpad->var = &const_adp5589; - break; - } + if (pdata->keymapsize == 0) + return 0; if (!((pdata->keypad_en_mask & kpad->var->row_mask) && (pdata->keypad_en_mask >> kpad->var->col_shift)) || !pdata->keymap) { dev_err(&client->dev, "no rows, cols or keymap from pdata\n"); - error = -EINVAL; - goto err_free_mem; + return -EINVAL; } if (pdata->keymapsize != kpad->var->keymapsize) { dev_err(&client->dev, "invalid keymapsize\n"); - error = -EINVAL; - goto err_free_mem; + return -EINVAL; } if (!pdata->gpimap && pdata->gpimapsize) { dev_err(&client->dev, "invalid gpimap from pdata\n"); - error = -EINVAL; - goto err_free_mem; + return -EINVAL; } if (pdata->gpimapsize > kpad->var->gpimapsize_max) { dev_err(&client->dev, "invalid gpimapsize\n"); - error = -EINVAL; - goto err_free_mem; + return -EINVAL; } for (i = 0; i < pdata->gpimapsize; i++) { @@ -929,41 +897,27 @@ static int adp5589_probe(struct i2c_client *client, if (pin < kpad->var->gpi_pin_base || pin > kpad->var->gpi_pin_end) { dev_err(&client->dev, "invalid gpi pin data\n"); - error = -EINVAL; - goto err_free_mem; + return -EINVAL; } if ((1 << (pin - kpad->var->gpi_pin_row_base)) & pdata->keypad_en_mask) { dev_err(&client->dev, "invalid gpi row/col data\n"); - error = -EINVAL; - goto err_free_mem; + return -EINVAL; } } if (!client->irq) { dev_err(&client->dev, "no IRQ?\n"); - error = -EINVAL; - goto err_free_mem; + return -EINVAL; } input = input_allocate_device(); - if (!input) { - error = -ENOMEM; - goto err_free_mem; - } + if (!input) + return -ENOMEM; - kpad->client = client; kpad->input = input; - ret = adp5589_read(client, ADP5589_5_ID); - if (ret < 0) { - error = ret; - goto err_free_input; - } - - revid = (u8) ret & ADP5589_5_DEVICE_ID_MASK; - input->name = client->name; input->phys = "adp5589-keys/input0"; input->dev.parent = &client->dev; @@ -1015,30 +969,94 @@ static int adp5589_probe(struct i2c_client *client, goto err_unreg_dev; } - error = adp5589_setup(kpad); + device_init_wakeup(&client->dev, 1); + + return 0; + +err_unreg_dev: + input_unregister_device(input); + input = NULL; +err_free_input: + input_free_device(input); + + return error; +} + +static void adp5589_keypad_remove(struct adp5589_kpad *kpad, + const struct adp5589_kpad_platform_data *pdata) +{ + if (!kpad->input) + return; + + free_irq(kpad->client->irq, kpad); + input_unregister_device(kpad->input); +} + +static int adp5589_probe(struct i2c_client *client, + const struct i2c_device_id *id) +{ + struct adp5589_kpad *kpad; + const struct adp5589_kpad_platform_data *pdata = + dev_get_platdata(&client->dev); + unsigned int revid; + int error, ret; + + if (!i2c_check_functionality(client->adapter, + I2C_FUNC_SMBUS_BYTE_DATA)) { + dev_err(&client->dev, "SMBUS Byte Data not Supported\n"); + return -EIO; + } + + + kpad = kzalloc(sizeof(*kpad), GFP_KERNEL); + if (!kpad) + return -ENOMEM; + + kpad->client = client; + + switch (id->driver_data) { + case ADP5585_02: + kpad->support_row5 = true; + case ADP5585_01: + kpad->is_adp5585 = true; + kpad->var = &const_adp5585; + break; + case ADP5589: + kpad->support_row5 = true; + kpad->var = &const_adp5589; + break; + } + + ret = adp5589_read(client, ADP5589_5_ID); + if (ret < 0) { + error = ret; + goto err_free_mem; + } + + revid = (u8) ret & ADP5589_5_DEVICE_ID_MASK; + + error = adp5589_keypad_add(kpad, revid, pdata); if (error) - goto err_free_irq; + goto err_free_mem; + + error = adp5589_setup(kpad, pdata); + if (error) + goto err_keypad_remove; if (kpad->gpimapsize) adp5589_report_switch_state(kpad); - error = adp5589_gpio_add(kpad); + error = adp5589_gpio_add(kpad, pdata); if (error) - goto err_free_irq; + goto err_keypad_remove; - device_init_wakeup(&client->dev, 1); i2c_set_clientdata(client, kpad); dev_info(&client->dev, "Rev.%d keypad, irq %d\n", revid, client->irq); return 0; -err_free_irq: - free_irq(client->irq, kpad); -err_unreg_dev: - input_unregister_device(input); - input = NULL; -err_free_input: - input_free_device(input); +err_keypad_remove: + adp5589_keypad_remove(kpad, pdata); err_free_mem: kfree(kpad); @@ -1048,11 +1066,12 @@ static int adp5589_probe(struct i2c_client *client, static int adp5589_remove(struct i2c_client *client) { struct adp5589_kpad *kpad = i2c_get_clientdata(client); + const struct adp5589_kpad_platform_data *pdata = + dev_get_platdata(&client->dev); adp5589_write(client, kpad->var->reg(ADP5589_GENERAL_CFG), 0); - free_irq(client->irq, kpad); - input_unregister_device(kpad->input); - adp5589_gpio_remove(kpad); + adp5589_keypad_remove(kpad, pdata); + adp5589_gpio_remove(kpad, pdata); kfree(kpad); return 0; @@ -1064,6 +1083,9 @@ static int adp5589_suspend(struct device *dev) struct adp5589_kpad *kpad = dev_get_drvdata(dev); struct i2c_client *client = kpad->client; + if (!kpad->input) + return 0; + disable_irq(client->irq); if (device_may_wakeup(&client->dev)) @@ -1077,6 +1099,9 @@ static int adp5589_resume(struct device *dev) struct adp5589_kpad *kpad = dev_get_drvdata(dev); struct i2c_client *client = kpad->client; + if (!kpad->input) + return 0; + if (device_may_wakeup(&client->dev)) disable_irq_wake(client->irq); -- 2.20.1 ^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH][RESEND] input: adp5589: Make keypad support optional 2019-09-27 12:38 ` Alexandru Ardelean (?) @ 2019-10-23 7:05 ` Alexandru Ardelean 2019-10-23 22:59 ` Dmitry Torokhov ` (2 more replies) -1 siblings, 3 replies; 9+ messages in thread From: Alexandru Ardelean @ 2019-10-23 7:05 UTC (permalink / raw) To: linux-input, linux-kernel Cc: dmitry.torokhov, Lars-Peter Clausen, Alexandru Ardelean From: Lars-Peter Clausen <lars@metafoo.de> On some platforms the adp5589 is used in GPIO only mode. On these platforms we do not want to register a input device, so make that optional and only create the input device if a keymap is supplied. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com> --- drivers/input/keyboard/adp5589-keys.c | 197 +++++++++++++++----------- 1 file changed, 111 insertions(+), 86 deletions(-) diff --git a/drivers/input/keyboard/adp5589-keys.c b/drivers/input/keyboard/adp5589-keys.c index 4f96a4a99e5b..08bfa8b213e8 100644 --- a/drivers/input/keyboard/adp5589-keys.c +++ b/drivers/input/keyboard/adp5589-keys.c @@ -495,10 +495,10 @@ static int adp5589_build_gpiomap(struct adp5589_kpad *kpad, return n_unused; } -static int adp5589_gpio_add(struct adp5589_kpad *kpad) +static int adp5589_gpio_add(struct adp5589_kpad *kpad, + const struct adp5589_kpad_platform_data *pdata) { struct device *dev = &kpad->client->dev; - const struct adp5589_kpad_platform_data *pdata = dev_get_platdata(dev); const struct adp5589_gpio_platform_data *gpio_data = pdata->gpio_data; int i, error; @@ -550,10 +550,10 @@ static int adp5589_gpio_add(struct adp5589_kpad *kpad) return 0; } -static void adp5589_gpio_remove(struct adp5589_kpad *kpad) +static void adp5589_gpio_remove(struct adp5589_kpad *kpad, + const struct adp5589_kpad_platform_data *pdata) { struct device *dev = &kpad->client->dev; - const struct adp5589_kpad_platform_data *pdata = dev_get_platdata(dev); const struct adp5589_gpio_platform_data *gpio_data = pdata->gpio_data; int error; @@ -571,12 +571,14 @@ static void adp5589_gpio_remove(struct adp5589_kpad *kpad) gpiochip_remove(&kpad->gc); } #else -static inline int adp5589_gpio_add(struct adp5589_kpad *kpad) +static inline int adp5589_gpio_add(struct adp5589_kpad *kpad, + struct const adp5589_kpad_platform_data *pdata) { return 0; } -static inline void adp5589_gpio_remove(struct adp5589_kpad *kpad) +static inline void adp5589_gpio_remove(struct adp5589_kpad *kpad, + struct const adp5589_kpad_platform_data *pdata) { } #endif @@ -652,11 +654,10 @@ static int adp5589_get_evcode(struct adp5589_kpad *kpad, unsigned short key) return -EINVAL; } -static int adp5589_setup(struct adp5589_kpad *kpad) +static int adp5589_setup(struct adp5589_kpad *kpad, + const struct adp5589_kpad_platform_data *pdata) { struct i2c_client *client = kpad->client; - const struct adp5589_kpad_platform_data *pdata = - dev_get_platdata(&client->dev); u8 (*reg) (u8) = kpad->var->reg; unsigned char evt_mode1 = 0, evt_mode2 = 0, evt_mode3 = 0; unsigned char pull_mask = 0; @@ -857,70 +858,37 @@ static void adp5589_report_switch_state(struct adp5589_kpad *kpad) input_sync(kpad->input); } -static int adp5589_probe(struct i2c_client *client, - const struct i2c_device_id *id) +static int adp5589_keypad_add(struct adp5589_kpad *kpad, unsigned int revid, + const struct adp5589_kpad_platform_data *pdata) { - struct adp5589_kpad *kpad; - const struct adp5589_kpad_platform_data *pdata = - dev_get_platdata(&client->dev); + struct i2c_client *client = kpad->client; struct input_dev *input; - unsigned int revid; - int ret, i; + unsigned int i; int error; - if (!i2c_check_functionality(client->adapter, - I2C_FUNC_SMBUS_BYTE_DATA)) { - dev_err(&client->dev, "SMBUS Byte Data not Supported\n"); - return -EIO; - } - - if (!pdata) { - dev_err(&client->dev, "no platform data?\n"); - return -EINVAL; - } - - kpad = kzalloc(sizeof(*kpad), GFP_KERNEL); - if (!kpad) - return -ENOMEM; - - switch (id->driver_data) { - case ADP5585_02: - kpad->support_row5 = true; - /* fall through */ - case ADP5585_01: - kpad->is_adp5585 = true; - kpad->var = &const_adp5585; - break; - case ADP5589: - kpad->support_row5 = true; - kpad->var = &const_adp5589; - break; - } + if (pdata->keymapsize == 0) + return 0; if (!((pdata->keypad_en_mask & kpad->var->row_mask) && (pdata->keypad_en_mask >> kpad->var->col_shift)) || !pdata->keymap) { dev_err(&client->dev, "no rows, cols or keymap from pdata\n"); - error = -EINVAL; - goto err_free_mem; + return -EINVAL; } if (pdata->keymapsize != kpad->var->keymapsize) { dev_err(&client->dev, "invalid keymapsize\n"); - error = -EINVAL; - goto err_free_mem; + return -EINVAL; } if (!pdata->gpimap && pdata->gpimapsize) { dev_err(&client->dev, "invalid gpimap from pdata\n"); - error = -EINVAL; - goto err_free_mem; + return -EINVAL; } if (pdata->gpimapsize > kpad->var->gpimapsize_max) { dev_err(&client->dev, "invalid gpimapsize\n"); - error = -EINVAL; - goto err_free_mem; + return -EINVAL; } for (i = 0; i < pdata->gpimapsize; i++) { @@ -929,41 +897,27 @@ static int adp5589_probe(struct i2c_client *client, if (pin < kpad->var->gpi_pin_base || pin > kpad->var->gpi_pin_end) { dev_err(&client->dev, "invalid gpi pin data\n"); - error = -EINVAL; - goto err_free_mem; + return -EINVAL; } if ((1 << (pin - kpad->var->gpi_pin_row_base)) & pdata->keypad_en_mask) { dev_err(&client->dev, "invalid gpi row/col data\n"); - error = -EINVAL; - goto err_free_mem; + return -EINVAL; } } if (!client->irq) { dev_err(&client->dev, "no IRQ?\n"); - error = -EINVAL; - goto err_free_mem; + return -EINVAL; } input = input_allocate_device(); - if (!input) { - error = -ENOMEM; - goto err_free_mem; - } + if (!input) + return -ENOMEM; - kpad->client = client; kpad->input = input; - ret = adp5589_read(client, ADP5589_5_ID); - if (ret < 0) { - error = ret; - goto err_free_input; - } - - revid = (u8) ret & ADP5589_5_DEVICE_ID_MASK; - input->name = client->name; input->phys = "adp5589-keys/input0"; input->dev.parent = &client->dev; @@ -1015,30 +969,94 @@ static int adp5589_probe(struct i2c_client *client, goto err_unreg_dev; } - error = adp5589_setup(kpad); + device_init_wakeup(&client->dev, 1); + + return 0; + +err_unreg_dev: + input_unregister_device(input); + input = NULL; +err_free_input: + input_free_device(input); + + return error; +} + +static void adp5589_keypad_remove(struct adp5589_kpad *kpad, + const struct adp5589_kpad_platform_data *pdata) +{ + if (!kpad->input) + return; + + free_irq(kpad->client->irq, kpad); + input_unregister_device(kpad->input); +} + +static int adp5589_probe(struct i2c_client *client, + const struct i2c_device_id *id) +{ + struct adp5589_kpad *kpad; + const struct adp5589_kpad_platform_data *pdata = + dev_get_platdata(&client->dev); + unsigned int revid; + int error, ret; + + if (!i2c_check_functionality(client->adapter, + I2C_FUNC_SMBUS_BYTE_DATA)) { + dev_err(&client->dev, "SMBUS Byte Data not Supported\n"); + return -EIO; + } + + + kpad = kzalloc(sizeof(*kpad), GFP_KERNEL); + if (!kpad) + return -ENOMEM; + + kpad->client = client; + + switch (id->driver_data) { + case ADP5585_02: + kpad->support_row5 = true; + case ADP5585_01: + kpad->is_adp5585 = true; + kpad->var = &const_adp5585; + break; + case ADP5589: + kpad->support_row5 = true; + kpad->var = &const_adp5589; + break; + } + + ret = adp5589_read(client, ADP5589_5_ID); + if (ret < 0) { + error = ret; + goto err_free_mem; + } + + revid = (u8) ret & ADP5589_5_DEVICE_ID_MASK; + + error = adp5589_keypad_add(kpad, revid, pdata); if (error) - goto err_free_irq; + goto err_free_mem; + + error = adp5589_setup(kpad, pdata); + if (error) + goto err_keypad_remove; if (kpad->gpimapsize) adp5589_report_switch_state(kpad); - error = adp5589_gpio_add(kpad); + error = adp5589_gpio_add(kpad, pdata); if (error) - goto err_free_irq; + goto err_keypad_remove; - device_init_wakeup(&client->dev, 1); i2c_set_clientdata(client, kpad); dev_info(&client->dev, "Rev.%d keypad, irq %d\n", revid, client->irq); return 0; -err_free_irq: - free_irq(client->irq, kpad); -err_unreg_dev: - input_unregister_device(input); - input = NULL; -err_free_input: - input_free_device(input); +err_keypad_remove: + adp5589_keypad_remove(kpad, pdata); err_free_mem: kfree(kpad); @@ -1048,11 +1066,12 @@ static int adp5589_probe(struct i2c_client *client, static int adp5589_remove(struct i2c_client *client) { struct adp5589_kpad *kpad = i2c_get_clientdata(client); + const struct adp5589_kpad_platform_data *pdata = + dev_get_platdata(&client->dev); adp5589_write(client, kpad->var->reg(ADP5589_GENERAL_CFG), 0); - free_irq(client->irq, kpad); - input_unregister_device(kpad->input); - adp5589_gpio_remove(kpad); + adp5589_keypad_remove(kpad, pdata); + adp5589_gpio_remove(kpad, pdata); kfree(kpad); return 0; @@ -1064,6 +1083,9 @@ static int adp5589_suspend(struct device *dev) struct adp5589_kpad *kpad = dev_get_drvdata(dev); struct i2c_client *client = kpad->client; + if (!kpad->input) + return 0; + disable_irq(client->irq); if (device_may_wakeup(&client->dev)) @@ -1077,6 +1099,9 @@ static int adp5589_resume(struct device *dev) struct adp5589_kpad *kpad = dev_get_drvdata(dev); struct i2c_client *client = kpad->client; + if (!kpad->input) + return 0; + if (device_may_wakeup(&client->dev)) disable_irq_wake(client->irq); -- 2.20.1 ^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH][RESEND] input: adp5589: Make keypad support optional 2019-10-23 7:05 ` Alexandru Ardelean @ 2019-10-23 22:59 ` Dmitry Torokhov 2019-10-24 9:24 ` Ardelean, Alexandru 2019-10-24 20:30 ` kbuild test robot 2019-10-25 0:50 ` kbuild test robot 2 siblings, 1 reply; 9+ messages in thread From: Dmitry Torokhov @ 2019-10-23 22:59 UTC (permalink / raw) To: Alexandru Ardelean; +Cc: linux-input, linux-kernel, Lars-Peter Clausen Hi Alexandru, On Wed, Oct 23, 2019 at 10:05:41AM +0300, Alexandru Ardelean wrote: > From: Lars-Peter Clausen <lars@metafoo.de> > > On some platforms the adp5589 is used in GPIO only mode. On these platforms > we do not want to register a input device, so make that optional and only > create the input device if a keymap is supplied. > > Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> > Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com> > --- > drivers/input/keyboard/adp5589-keys.c | 197 +++++++++++++++----------- > 1 file changed, 111 insertions(+), 86 deletions(-) > > diff --git a/drivers/input/keyboard/adp5589-keys.c b/drivers/input/keyboard/adp5589-keys.c > index 4f96a4a99e5b..08bfa8b213e8 100644 > --- a/drivers/input/keyboard/adp5589-keys.c > +++ b/drivers/input/keyboard/adp5589-keys.c > @@ -495,10 +495,10 @@ static int adp5589_build_gpiomap(struct adp5589_kpad *kpad, > return n_unused; > } > > -static int adp5589_gpio_add(struct adp5589_kpad *kpad) > +static int adp5589_gpio_add(struct adp5589_kpad *kpad, > + const struct adp5589_kpad_platform_data *pdata) > { > struct device *dev = &kpad->client->dev; > - const struct adp5589_kpad_platform_data *pdata = dev_get_platdata(dev); > const struct adp5589_gpio_platform_data *gpio_data = pdata->gpio_data; > int i, error; > All these changes passing pdata to various functions are not really needed for this patch. I dropped them and applied. Sorry for the delay. -- Dmitry ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH][RESEND] input: adp5589: Make keypad support optional 2019-10-23 22:59 ` Dmitry Torokhov @ 2019-10-24 9:24 ` Ardelean, Alexandru 0 siblings, 0 replies; 9+ messages in thread From: Ardelean, Alexandru @ 2019-10-24 9:24 UTC (permalink / raw) To: dmitry.torokhov; +Cc: linux-input, linux-kernel, lars On Wed, 2019-10-23 at 15:59 -0700, Dmitry Torokhov wrote: > [External] > > Hi Alexandru, > > On Wed, Oct 23, 2019 at 10:05:41AM +0300, Alexandru Ardelean wrote: > > From: Lars-Peter Clausen <lars@metafoo.de> > > > > On some platforms the adp5589 is used in GPIO only mode. On these > > platforms > > we do not want to register a input device, so make that optional and > > only > > create the input device if a keymap is supplied. > > > > Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> > > Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com> > > --- > > drivers/input/keyboard/adp5589-keys.c | 197 +++++++++++++++----------- > > 1 file changed, 111 insertions(+), 86 deletions(-) > > > > diff --git a/drivers/input/keyboard/adp5589-keys.c > > b/drivers/input/keyboard/adp5589-keys.c > > index 4f96a4a99e5b..08bfa8b213e8 100644 > > --- a/drivers/input/keyboard/adp5589-keys.c > > +++ b/drivers/input/keyboard/adp5589-keys.c > > @@ -495,10 +495,10 @@ static int adp5589_build_gpiomap(struct > > adp5589_kpad *kpad, > > return n_unused; > > } > > > > -static int adp5589_gpio_add(struct adp5589_kpad *kpad) > > +static int adp5589_gpio_add(struct adp5589_kpad *kpad, > > + const struct adp5589_kpad_platform_data *pdata) > > { > > struct device *dev = &kpad->client->dev; > > - const struct adp5589_kpad_platform_data *pdata = > > dev_get_platdata(dev); > > const struct adp5589_gpio_platform_data *gpio_data = pdata- > > >gpio_data; > > int i, error; > > > > All these changes passing pdata to various functions are not really > needed for this patch. I dropped them and applied. Ack. Thank you. > > Sorry for the delay. No worries & thank you again :) > ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH][RESEND] input: adp5589: Make keypad support optional 2019-10-23 7:05 ` Alexandru Ardelean @ 2019-10-24 20:30 ` kbuild test robot 2019-10-24 20:30 ` kbuild test robot 2019-10-25 0:50 ` kbuild test robot 2 siblings, 0 replies; 9+ messages in thread From: kbuild test robot @ 2019-10-24 20:30 UTC (permalink / raw) To: Alexandru Ardelean Cc: kbuild-all, linux-input, linux-kernel, dmitry.torokhov, Lars-Peter Clausen, Alexandru Ardelean [-- Attachment #1: Type: text/plain, Size: 3546 bytes --] Hi Alexandru, I love your patch! Perhaps something to improve: [auto build test WARNING on input/next] [cannot apply to v5.4-rc4 next-20191024] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system. BTW, we also suggest to use '--base' option to specify the base tree in git format-patch, please see https://stackoverflow.com/a/37406982] url: https://github.com/0day-ci/linux/commits/Alexandru-Ardelean/input-adp5589-Make-keypad-support-optional/20191025-034654 base: https://git.kernel.org/pub/scm/linux/kernel/git/dtor/input.git next config: mips-allmodconfig (attached as .config) compiler: mips-linux-gcc (GCC) 7.4.0 reproduce: wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # save the attached .config to linux build tree GCC_VERSION=7.4.0 make.cross ARCH=mips If you fix the issue, kindly add following tag Reported-by: kbuild test robot <lkp@intel.com> All warnings (new ones prefixed by >>): drivers/input/keyboard/adp5589-keys.c: In function 'adp5589_probe': >> drivers/input/keyboard/adp5589-keys.c:1019:22: warning: this statement may fall through [-Wimplicit-fallthrough=] kpad->support_row5 = true; ~~~~~~~~~~~~~~~~~~~^~~~~~ drivers/input/keyboard/adp5589-keys.c:1020:2: note: here case ADP5585_01: ^~~~ vim +1019 drivers/input/keyboard/adp5589-keys.c 994 995 static int adp5589_probe(struct i2c_client *client, 996 const struct i2c_device_id *id) 997 { 998 struct adp5589_kpad *kpad; 999 const struct adp5589_kpad_platform_data *pdata = 1000 dev_get_platdata(&client->dev); 1001 unsigned int revid; 1002 int error, ret; 1003 1004 if (!i2c_check_functionality(client->adapter, 1005 I2C_FUNC_SMBUS_BYTE_DATA)) { 1006 dev_err(&client->dev, "SMBUS Byte Data not Supported\n"); 1007 return -EIO; 1008 } 1009 1010 1011 kpad = kzalloc(sizeof(*kpad), GFP_KERNEL); 1012 if (!kpad) 1013 return -ENOMEM; 1014 1015 kpad->client = client; 1016 1017 switch (id->driver_data) { 1018 case ADP5585_02: > 1019 kpad->support_row5 = true; 1020 case ADP5585_01: 1021 kpad->is_adp5585 = true; 1022 kpad->var = &const_adp5585; 1023 break; 1024 case ADP5589: 1025 kpad->support_row5 = true; 1026 kpad->var = &const_adp5589; 1027 break; 1028 } 1029 1030 ret = adp5589_read(client, ADP5589_5_ID); 1031 if (ret < 0) { 1032 error = ret; 1033 goto err_free_mem; 1034 } 1035 1036 revid = (u8) ret & ADP5589_5_DEVICE_ID_MASK; 1037 1038 error = adp5589_keypad_add(kpad, revid, pdata); 1039 if (error) 1040 goto err_free_mem; 1041 1042 error = adp5589_setup(kpad, pdata); 1043 if (error) 1044 goto err_keypad_remove; 1045 1046 if (kpad->gpimapsize) 1047 adp5589_report_switch_state(kpad); 1048 1049 error = adp5589_gpio_add(kpad, pdata); 1050 if (error) 1051 goto err_keypad_remove; 1052 1053 i2c_set_clientdata(client, kpad); 1054 1055 dev_info(&client->dev, "Rev.%d keypad, irq %d\n", revid, client->irq); 1056 return 0; 1057 1058 err_keypad_remove: 1059 adp5589_keypad_remove(kpad, pdata); 1060 err_free_mem: 1061 kfree(kpad); 1062 1063 return error; 1064 } 1065 --- 0-DAY kernel test infrastructure Open Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation [-- Attachment #2: .config.gz --] [-- Type: application/gzip, Size: 61527 bytes --] ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH][RESEND] input: adp5589: Make keypad support optional @ 2019-10-24 20:30 ` kbuild test robot 0 siblings, 0 replies; 9+ messages in thread From: kbuild test robot @ 2019-10-24 20:30 UTC (permalink / raw) To: kbuild-all [-- Attachment #1: Type: text/plain, Size: 3657 bytes --] Hi Alexandru, I love your patch! Perhaps something to improve: [auto build test WARNING on input/next] [cannot apply to v5.4-rc4 next-20191024] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system. BTW, we also suggest to use '--base' option to specify the base tree in git format-patch, please see https://stackoverflow.com/a/37406982] url: https://github.com/0day-ci/linux/commits/Alexandru-Ardelean/input-adp5589-Make-keypad-support-optional/20191025-034654 base: https://git.kernel.org/pub/scm/linux/kernel/git/dtor/input.git next config: mips-allmodconfig (attached as .config) compiler: mips-linux-gcc (GCC) 7.4.0 reproduce: wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # save the attached .config to linux build tree GCC_VERSION=7.4.0 make.cross ARCH=mips If you fix the issue, kindly add following tag Reported-by: kbuild test robot <lkp@intel.com> All warnings (new ones prefixed by >>): drivers/input/keyboard/adp5589-keys.c: In function 'adp5589_probe': >> drivers/input/keyboard/adp5589-keys.c:1019:22: warning: this statement may fall through [-Wimplicit-fallthrough=] kpad->support_row5 = true; ~~~~~~~~~~~~~~~~~~~^~~~~~ drivers/input/keyboard/adp5589-keys.c:1020:2: note: here case ADP5585_01: ^~~~ vim +1019 drivers/input/keyboard/adp5589-keys.c 994 995 static int adp5589_probe(struct i2c_client *client, 996 const struct i2c_device_id *id) 997 { 998 struct adp5589_kpad *kpad; 999 const struct adp5589_kpad_platform_data *pdata = 1000 dev_get_platdata(&client->dev); 1001 unsigned int revid; 1002 int error, ret; 1003 1004 if (!i2c_check_functionality(client->adapter, 1005 I2C_FUNC_SMBUS_BYTE_DATA)) { 1006 dev_err(&client->dev, "SMBUS Byte Data not Supported\n"); 1007 return -EIO; 1008 } 1009 1010 1011 kpad = kzalloc(sizeof(*kpad), GFP_KERNEL); 1012 if (!kpad) 1013 return -ENOMEM; 1014 1015 kpad->client = client; 1016 1017 switch (id->driver_data) { 1018 case ADP5585_02: > 1019 kpad->support_row5 = true; 1020 case ADP5585_01: 1021 kpad->is_adp5585 = true; 1022 kpad->var = &const_adp5585; 1023 break; 1024 case ADP5589: 1025 kpad->support_row5 = true; 1026 kpad->var = &const_adp5589; 1027 break; 1028 } 1029 1030 ret = adp5589_read(client, ADP5589_5_ID); 1031 if (ret < 0) { 1032 error = ret; 1033 goto err_free_mem; 1034 } 1035 1036 revid = (u8) ret & ADP5589_5_DEVICE_ID_MASK; 1037 1038 error = adp5589_keypad_add(kpad, revid, pdata); 1039 if (error) 1040 goto err_free_mem; 1041 1042 error = adp5589_setup(kpad, pdata); 1043 if (error) 1044 goto err_keypad_remove; 1045 1046 if (kpad->gpimapsize) 1047 adp5589_report_switch_state(kpad); 1048 1049 error = adp5589_gpio_add(kpad, pdata); 1050 if (error) 1051 goto err_keypad_remove; 1052 1053 i2c_set_clientdata(client, kpad); 1054 1055 dev_info(&client->dev, "Rev.%d keypad, irq %d\n", revid, client->irq); 1056 return 0; 1057 1058 err_keypad_remove: 1059 adp5589_keypad_remove(kpad, pdata); 1060 err_free_mem: 1061 kfree(kpad); 1062 1063 return error; 1064 } 1065 --- 0-DAY kernel test infrastructure Open Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation [-- Attachment #2: config.gz --] [-- Type: application/gzip, Size: 61527 bytes --] ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH][RESEND] input: adp5589: Make keypad support optional 2019-10-23 7:05 ` Alexandru Ardelean @ 2019-10-25 0:50 ` kbuild test robot 2019-10-24 20:30 ` kbuild test robot 2019-10-25 0:50 ` kbuild test robot 2 siblings, 0 replies; 9+ messages in thread From: kbuild test robot @ 2019-10-25 0:50 UTC (permalink / raw) To: Alexandru Ardelean Cc: kbuild-all, linux-input, linux-kernel, dmitry.torokhov, Lars-Peter Clausen, Alexandru Ardelean [-- Attachment #1: Type: text/plain, Size: 3541 bytes --] Hi Alexandru, I love your patch! Yet something to improve: [auto build test ERROR on input/next] [also build test ERROR on v5.4-rc4] [cannot apply to next-20191024] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system. BTW, we also suggest to use '--base' option to specify the base tree in git format-patch, please see https://stackoverflow.com/a/37406982] url: https://github.com/0day-ci/linux/commits/Alexandru-Ardelean/input-adp5589-Make-keypad-support-optional/20191025-034654 base: https://git.kernel.org/pub/scm/linux/kernel/git/dtor/input.git next config: x86_64-kexec (attached as .config) compiler: gcc-7 (Debian 7.4.0-14) 7.4.0 reproduce: # save the attached .config to linux build tree make ARCH=x86_64 If you fix the issue, kindly add following tag Reported-by: kbuild test robot <lkp@intel.com> All errors (new ones prefixed by >>): >> drivers/input/keyboard/adp5589-keys.c:575:9: error: expected '{' before 'const' struct const adp5589_kpad_platform_data *pdata) ^~~~~ drivers/input/keyboard/adp5589-keys.c:581:9: error: expected '{' before 'const' struct const adp5589_kpad_platform_data *pdata) ^~~~~ drivers/input/keyboard/adp5589-keys.c: In function 'adp5589_probe': >> drivers/input/keyboard/adp5589-keys.c:1049:10: error: implicit declaration of function 'adp5589_gpio_add'; did you mean 'adp5589_keypad_add'? [-Werror=implicit-function-declaration] error = adp5589_gpio_add(kpad, pdata); ^~~~~~~~~~~~~~~~ adp5589_keypad_add drivers/input/keyboard/adp5589-keys.c: In function 'adp5589_remove': >> drivers/input/keyboard/adp5589-keys.c:1074:2: error: implicit declaration of function 'adp5589_gpio_remove'; did you mean 'adp5589_remove'? [-Werror=implicit-function-declaration] adp5589_gpio_remove(kpad, pdata); ^~~~~~~~~~~~~~~~~~~ adp5589_remove drivers/input/keyboard/adp5589-keys.c: In function 'adp5589_probe': drivers/input/keyboard/adp5589-keys.c:1019:22: warning: this statement may fall through [-Wimplicit-fallthrough=] kpad->support_row5 = true; ~~~~~~~~~~~~~~~~~~~^~~~~~ drivers/input/keyboard/adp5589-keys.c:1020:2: note: here case ADP5585_01: ^~~~ cc1: some warnings being treated as errors vim +575 drivers/input/keyboard/adp5589-keys.c 552 553 static void adp5589_gpio_remove(struct adp5589_kpad *kpad, 554 const struct adp5589_kpad_platform_data *pdata) 555 { 556 struct device *dev = &kpad->client->dev; 557 const struct adp5589_gpio_platform_data *gpio_data = pdata->gpio_data; 558 int error; 559 560 if (!kpad->export_gpio) 561 return; 562 563 if (gpio_data->teardown) { 564 error = gpio_data->teardown(kpad->client, 565 kpad->gc.base, kpad->gc.ngpio, 566 gpio_data->context); 567 if (error) 568 dev_warn(dev, "teardown failed %d\n", error); 569 } 570 571 gpiochip_remove(&kpad->gc); 572 } 573 #else 574 static inline int adp5589_gpio_add(struct adp5589_kpad *kpad, > 575 struct const adp5589_kpad_platform_data *pdata) 576 { 577 return 0; 578 } 579 580 static inline void adp5589_gpio_remove(struct adp5589_kpad *kpad, > 581 struct const adp5589_kpad_platform_data *pdata) 582 { 583 } 584 #endif 585 --- 0-DAY kernel test infrastructure Open Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation [-- Attachment #2: .config.gz --] [-- Type: application/gzip, Size: 27445 bytes --] ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH][RESEND] input: adp5589: Make keypad support optional @ 2019-10-25 0:50 ` kbuild test robot 0 siblings, 0 replies; 9+ messages in thread From: kbuild test robot @ 2019-10-25 0:50 UTC (permalink / raw) To: kbuild-all [-- Attachment #1: Type: text/plain, Size: 3630 bytes --] Hi Alexandru, I love your patch! Yet something to improve: [auto build test ERROR on input/next] [also build test ERROR on v5.4-rc4] [cannot apply to next-20191024] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system. BTW, we also suggest to use '--base' option to specify the base tree in git format-patch, please see https://stackoverflow.com/a/37406982] url: https://github.com/0day-ci/linux/commits/Alexandru-Ardelean/input-adp5589-Make-keypad-support-optional/20191025-034654 base: https://git.kernel.org/pub/scm/linux/kernel/git/dtor/input.git next config: x86_64-kexec (attached as .config) compiler: gcc-7 (Debian 7.4.0-14) 7.4.0 reproduce: # save the attached .config to linux build tree make ARCH=x86_64 If you fix the issue, kindly add following tag Reported-by: kbuild test robot <lkp@intel.com> All errors (new ones prefixed by >>): >> drivers/input/keyboard/adp5589-keys.c:575:9: error: expected '{' before 'const' struct const adp5589_kpad_platform_data *pdata) ^~~~~ drivers/input/keyboard/adp5589-keys.c:581:9: error: expected '{' before 'const' struct const adp5589_kpad_platform_data *pdata) ^~~~~ drivers/input/keyboard/adp5589-keys.c: In function 'adp5589_probe': >> drivers/input/keyboard/adp5589-keys.c:1049:10: error: implicit declaration of function 'adp5589_gpio_add'; did you mean 'adp5589_keypad_add'? [-Werror=implicit-function-declaration] error = adp5589_gpio_add(kpad, pdata); ^~~~~~~~~~~~~~~~ adp5589_keypad_add drivers/input/keyboard/adp5589-keys.c: In function 'adp5589_remove': >> drivers/input/keyboard/adp5589-keys.c:1074:2: error: implicit declaration of function 'adp5589_gpio_remove'; did you mean 'adp5589_remove'? [-Werror=implicit-function-declaration] adp5589_gpio_remove(kpad, pdata); ^~~~~~~~~~~~~~~~~~~ adp5589_remove drivers/input/keyboard/adp5589-keys.c: In function 'adp5589_probe': drivers/input/keyboard/adp5589-keys.c:1019:22: warning: this statement may fall through [-Wimplicit-fallthrough=] kpad->support_row5 = true; ~~~~~~~~~~~~~~~~~~~^~~~~~ drivers/input/keyboard/adp5589-keys.c:1020:2: note: here case ADP5585_01: ^~~~ cc1: some warnings being treated as errors vim +575 drivers/input/keyboard/adp5589-keys.c 552 553 static void adp5589_gpio_remove(struct adp5589_kpad *kpad, 554 const struct adp5589_kpad_platform_data *pdata) 555 { 556 struct device *dev = &kpad->client->dev; 557 const struct adp5589_gpio_platform_data *gpio_data = pdata->gpio_data; 558 int error; 559 560 if (!kpad->export_gpio) 561 return; 562 563 if (gpio_data->teardown) { 564 error = gpio_data->teardown(kpad->client, 565 kpad->gc.base, kpad->gc.ngpio, 566 gpio_data->context); 567 if (error) 568 dev_warn(dev, "teardown failed %d\n", error); 569 } 570 571 gpiochip_remove(&kpad->gc); 572 } 573 #else 574 static inline int adp5589_gpio_add(struct adp5589_kpad *kpad, > 575 struct const adp5589_kpad_platform_data *pdata) 576 { 577 return 0; 578 } 579 580 static inline void adp5589_gpio_remove(struct adp5589_kpad *kpad, > 581 struct const adp5589_kpad_platform_data *pdata) 582 { 583 } 584 #endif 585 --- 0-DAY kernel test infrastructure Open Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation [-- Attachment #2: config.gz --] [-- Type: application/gzip, Size: 27445 bytes --] ^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2019-10-25 0:50 UTC | newest] Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- [not found] <20190717122133.24333-1-alexandru.ardelean@analog.com> 2019-09-27 12:38 ` [PATCH][RESEND] input: adp5589: Make keypad support optional Alexandru Ardelean 2019-09-27 12:38 ` Alexandru Ardelean 2019-10-23 7:05 ` Alexandru Ardelean 2019-10-23 22:59 ` Dmitry Torokhov 2019-10-24 9:24 ` Ardelean, Alexandru 2019-10-24 20:30 ` kbuild test robot 2019-10-24 20:30 ` kbuild test robot 2019-10-25 0:50 ` kbuild test robot 2019-10-25 0:50 ` kbuild test robot
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.