summaryrefslogtreecommitdiff
path: root/drivers/input
diff options
context:
space:
mode:
authorFabio Estevam <fabio.estevam@freescale.com>2013-08-29 09:13:35 -0700
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2013-08-29 09:34:48 -0700
commitd33c4aa32d426a7c00d33b5b1212720d5bc3fa44 (patch)
treec60d30bba2ab3c547667af570e1b063d7017fcb8 /drivers/input
parentc9eb303bd12be8446e672e0a42d41a5b88c7b5cb (diff)
Input: max11801_ts - convert to devm
Converting to devm functions can make the code smaller and cleaner. Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Diffstat (limited to 'drivers/input')
-rw-r--r--drivers/input/touchscreen/max11801_ts.c37
1 files changed, 9 insertions, 28 deletions
diff --git a/drivers/input/touchscreen/max11801_ts.c b/drivers/input/touchscreen/max11801_ts.c
index 00bc6caa27f5..9f84fcd08732 100644
--- a/drivers/input/touchscreen/max11801_ts.c
+++ b/drivers/input/touchscreen/max11801_ts.c
@@ -181,12 +181,11 @@ static int max11801_ts_probe(struct i2c_client *client,
struct input_dev *input_dev;
int error;
- data = kzalloc(sizeof(struct max11801_data), GFP_KERNEL);
- input_dev = input_allocate_device();
+ data = devm_kzalloc(&client->dev, sizeof(*data), GFP_KERNEL);
+ input_dev = devm_input_allocate_device(&client->dev);
if (!data || !input_dev) {
dev_err(&client->dev, "Failed to allocate memory\n");
- error = -ENOMEM;
- goto err_free_mem;
+ return -ENOMEM;
}
data->client = client;
@@ -205,38 +204,21 @@ static int max11801_ts_probe(struct i2c_client *client,
max11801_ts_phy_init(data);
- error = request_threaded_irq(client->irq, NULL, max11801_ts_interrupt,
- IRQF_TRIGGER_LOW | IRQF_ONESHOT,
- "max11801_ts", data);
+ error = devm_request_threaded_irq(&client->dev, client->irq, NULL,
+ max11801_ts_interrupt,
+ IRQF_TRIGGER_LOW | IRQF_ONESHOT,
+ "max11801_ts", data);
if (error) {
dev_err(&client->dev, "Failed to register interrupt\n");
- goto err_free_mem;
+ return error;
}
error = input_register_device(data->input_dev);
if (error)
- goto err_free_irq;
+ return error;
i2c_set_clientdata(client, data);
return 0;
-
-err_free_irq:
- free_irq(client->irq, data);
-err_free_mem:
- input_free_device(input_dev);
- kfree(data);
- return error;
-}
-
-static int max11801_ts_remove(struct i2c_client *client)
-{
- struct max11801_data *data = i2c_get_clientdata(client);
-
- free_irq(client->irq, data);
- input_unregister_device(data->input_dev);
- kfree(data);
-
- return 0;
}
static const struct i2c_device_id max11801_ts_id[] = {
@@ -252,7 +234,6 @@ static struct i2c_driver max11801_ts_driver = {
},
.id_table = max11801_ts_id,
.probe = max11801_ts_probe,
- .remove = max11801_ts_remove,
};
module_i2c_driver(max11801_ts_driver);