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>
This commit is contained in:
parent
cfd8579ddc
commit
53119e5134
|
@ -120,25 +120,19 @@ soc_button_device_create(struct platform_device *pdev,
|
||||||
gpio_keys_pdata->nbuttons = n_buttons;
|
gpio_keys_pdata->nbuttons = n_buttons;
|
||||||
gpio_keys_pdata->rep = autorepeat;
|
gpio_keys_pdata->rep = autorepeat;
|
||||||
|
|
||||||
pd = platform_device_alloc("gpio-keys", PLATFORM_DEVID_AUTO);
|
pd = platform_device_register_resndata(&pdev->dev, "gpio-keys",
|
||||||
if (!pd) {
|
PLATFORM_DEVID_AUTO, NULL, 0,
|
||||||
error = -ENOMEM;
|
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;
|
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;
|
return pd;
|
||||||
|
|
||||||
err_free_pdev:
|
|
||||||
platform_device_put(pd);
|
|
||||||
err_free_mem:
|
err_free_mem:
|
||||||
devm_kfree(&pdev->dev, gpio_keys_pdata);
|
devm_kfree(&pdev->dev, gpio_keys_pdata);
|
||||||
return ERR_PTR(error);
|
return ERR_PTR(error);
|
||||||
|
|
Loading…
Reference in New Issue