diff options
| author | Marek Vasut <marex@denx.de> | 2019-02-07 01:00:44 -0500 |
|---|---|---|
| committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2019-02-07 01:18:11 -0500 |
| commit | 1bdec5d9818c47e080c19784dfd25d1d9c20807e (patch) | |
| tree | 2eed8b1781da1d3622e7e0e9600eb670c99b3a5f /drivers/input | |
| parent | 201f3c803544c052aa1bab9e562e0ada4aefe03d (diff) | |
Input: ili210x - convert to devm IRQ
Convert the driver to devm_request_irq(), drop the related unmanaged
deregistration code and add ili210x_irq_teardown() to tear the IRQ
down and cancel possible touchscreen pending work.
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.c | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/drivers/input/touchscreen/ili210x.c b/drivers/input/touchscreen/ili210x.c index f8b20d302384..bc674ece61f3 100644 --- a/drivers/input/touchscreen/ili210x.c +++ b/drivers/input/touchscreen/ili210x.c | |||
| @@ -177,6 +177,13 @@ static void ili210x_power_down(void *data) | |||
| 177 | gpiod_set_value_cansleep(reset_gpio, 1); | 177 | gpiod_set_value_cansleep(reset_gpio, 1); |
| 178 | } | 178 | } |
| 179 | 179 | ||
| 180 | static void ili210x_cancel_work(void *data) | ||
| 181 | { | ||
| 182 | struct ili210x *priv = data; | ||
| 183 | |||
| 184 | cancel_delayed_work_sync(&priv->dwork); | ||
| 185 | } | ||
| 186 | |||
| 180 | static int ili210x_i2c_probe(struct i2c_client *client, | 187 | static int ili210x_i2c_probe(struct i2c_client *client, |
| 181 | const struct i2c_device_id *id) | 188 | const struct i2c_device_id *id) |
| 182 | { | 189 | { |
| @@ -266,19 +273,23 @@ static int ili210x_i2c_probe(struct i2c_client *client, | |||
| 266 | 273 | ||
| 267 | i2c_set_clientdata(client, priv); | 274 | i2c_set_clientdata(client, priv); |
| 268 | 275 | ||
| 269 | error = request_irq(client->irq, ili210x_irq, 0, | 276 | error = devm_add_action(dev, ili210x_cancel_work, priv); |
| 270 | client->name, priv); | 277 | if (error) |
| 278 | return error; | ||
| 279 | |||
| 280 | error = devm_request_irq(dev, client->irq, ili210x_irq, 0, | ||
| 281 | client->name, priv); | ||
| 271 | if (error) { | 282 | if (error) { |
| 272 | dev_err(dev, "Unable to request touchscreen IRQ, err: %d\n", | 283 | dev_err(dev, "Unable to request touchscreen IRQ, err: %d\n", |
| 273 | error); | 284 | error); |
| 274 | goto err_free_mem; | 285 | return error; |
| 275 | } | 286 | } |
| 276 | 287 | ||
| 277 | error = sysfs_create_group(&dev->kobj, &ili210x_attr_group); | 288 | error = sysfs_create_group(&dev->kobj, &ili210x_attr_group); |
| 278 | if (error) { | 289 | if (error) { |
| 279 | dev_err(dev, "Unable to create sysfs attributes, err: %d\n", | 290 | dev_err(dev, "Unable to create sysfs attributes, err: %d\n", |
| 280 | error); | 291 | error); |
| 281 | goto err_free_irq; | 292 | return error; |
| 282 | } | 293 | } |
| 283 | 294 | ||
| 284 | error = input_register_device(priv->input); | 295 | error = input_register_device(priv->input); |
| @@ -297,19 +308,12 @@ static int ili210x_i2c_probe(struct i2c_client *client, | |||
| 297 | 308 | ||
| 298 | err_remove_sysfs: | 309 | err_remove_sysfs: |
| 299 | sysfs_remove_group(&dev->kobj, &ili210x_attr_group); | 310 | sysfs_remove_group(&dev->kobj, &ili210x_attr_group); |
| 300 | err_free_irq: | ||
| 301 | free_irq(client->irq, priv); | ||
| 302 | err_free_mem: | ||
| 303 | return error; | 311 | return error; |
| 304 | } | 312 | } |
| 305 | 313 | ||
| 306 | static int ili210x_i2c_remove(struct i2c_client *client) | 314 | static int ili210x_i2c_remove(struct i2c_client *client) |
| 307 | { | 315 | { |
| 308 | struct ili210x *priv = i2c_get_clientdata(client); | ||
| 309 | |||
| 310 | sysfs_remove_group(&client->dev.kobj, &ili210x_attr_group); | 316 | sysfs_remove_group(&client->dev.kobj, &ili210x_attr_group); |
| 311 | free_irq(priv->client->irq, priv); | ||
| 312 | cancel_delayed_work_sync(&priv->dwork); | ||
| 313 | 317 | ||
| 314 | return 0; | 318 | return 0; |
| 315 | } | 319 | } |
