summaryrefslogtreecommitdiffstats
path: root/drivers/input
diff options
context:
space:
mode:
authorMarek Vasut <marex@denx.de>2019-02-06 21:54:59 -0800
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2019-02-06 22:17:44 -0800
commit63083fd582b9eb46a67fff6d4077a931d986d066 (patch)
treedef42704915385b4278eb69b4875410db5632c60 /drivers/input
parent2fa928390f3f04fbb29267b29ca09d980b17f9d1 (diff)
downloadlinux-63083fd582b9eb46a67fff6d4077a931d986d066.tar.gz
linux-63083fd582b9eb46a67fff6d4077a931d986d066.tar.bz2
linux-63083fd582b9eb46a67fff6d4077a931d986d066.zip
Input: ili210x - convert to devm_ functions
Convert the driver to dev-managed allocations. Signed-off-by: Marek Vasut <marex@denx.de> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Diffstat (limited to 'drivers/input')
-rw-r--r--drivers/input/touchscreen/ili210x.c17
1 files changed, 7 insertions, 10 deletions
diff --git a/drivers/input/touchscreen/ili210x.c b/drivers/input/touchscreen/ili210x.c
index 11007bf8113c..788f4140e302 100644
--- a/drivers/input/touchscreen/ili210x.c
+++ b/drivers/input/touchscreen/ili210x.c
@@ -206,12 +206,13 @@ static int ili210x_i2c_probe(struct i2c_client *client,
xmax = panel.finger_max.x_low | (panel.finger_max.x_high << 8);
ymax = panel.finger_max.y_low | (panel.finger_max.y_high << 8);
- priv = kzalloc(sizeof(*priv), GFP_KERNEL);
- input = input_allocate_device();
- if (!priv || !input) {
- error = -ENOMEM;
- goto err_free_mem;
- }
+ priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
+ if (!priv)
+ return -ENOMEM;
+
+ input = devm_input_allocate_device(dev);
+ if (!input)
+ return -ENOMEM;
priv->client = client;
priv->input = input;
@@ -273,8 +274,6 @@ err_remove_sysfs:
err_free_irq:
free_irq(client->irq, priv);
err_free_mem:
- input_free_device(input);
- kfree(priv);
return error;
}
@@ -285,8 +284,6 @@ static int ili210x_i2c_remove(struct i2c_client *client)
sysfs_remove_group(&client->dev.kobj, &ili210x_attr_group);
free_irq(priv->client->irq, priv);
cancel_delayed_work_sync(&priv->dwork);
- input_unregister_device(priv->input);
- kfree(priv);
return 0;
}