diff options
author | Enrico Weigelt <info@metux.net> | 2019-08-20 22:08:43 +0300 |
---|---|---|
committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2019-08-21 00:15:37 +0300 |
commit | 53119e513478b3b5c2b81a9a049f52cf17fcfff3 (patch) | |
tree | 452c0a8130e34ec365d890a3f1b6b68cb4b9ce28 /drivers/input | |
parent | cfd8579ddc02d8c5024bae7106ba37079653b3d2 (diff) | |
download | linux-53119e513478b3b5c2b81a9a049f52cf17fcfff3.tar.xz |
Input: soc_button_array - use platform_device_register_resndata()
The registration of gpio-keys device can be written much shorter
by using the platform_device_register_resndata() helper.
Signed-off-by: Enrico Weigelt <info@metux.net>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Diffstat (limited to 'drivers/input')
-rw-r--r-- | drivers/input/misc/soc_button_array.c | 22 |
1 files changed, 8 insertions, 14 deletions
diff --git a/drivers/input/misc/soc_button_array.c b/drivers/input/misc/soc_button_array.c index 6f0133fe1546..97e3639e99d0 100644 --- a/drivers/input/misc/soc_button_array.c +++ b/drivers/input/misc/soc_button_array.c @@ -120,25 +120,19 @@ soc_button_device_create(struct platform_device *pdev, gpio_keys_pdata->nbuttons = n_buttons; gpio_keys_pdata->rep = autorepeat; - pd = platform_device_alloc("gpio-keys", PLATFORM_DEVID_AUTO); - if (!pd) { - error = -ENOMEM; + pd = platform_device_register_resndata(&pdev->dev, "gpio-keys", + PLATFORM_DEVID_AUTO, NULL, 0, + gpio_keys_pdata, + sizeof(*gpio_keys_pdata)); + error = PTR_ERR_OR_ZERO(pd); + if (error) { + dev_err(&pdev->dev, + "failed registering gpio-keys: %d\n", error); goto err_free_mem; } - error = platform_device_add_data(pd, gpio_keys_pdata, - sizeof(*gpio_keys_pdata)); - if (error) - goto err_free_pdev; - - error = platform_device_add(pd); - if (error) - goto err_free_pdev; - return pd; -err_free_pdev: - platform_device_put(pd); err_free_mem: devm_kfree(&pdev->dev, gpio_keys_pdata); return ERR_PTR(error); |