Commit 4b080e3b authored by Pramod Gurav's avatar Pramod Gurav Committed by Dmitry Torokhov

Input: jornada720_ts - switch to using managed resources

This switches the driver to using managed resources to simplify error
handling and to do away with remove function.
Signed-off-by: default avatarPramod Gurav <pramod.gurav@smartplayin.com>
Signed-off-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
parent f3f33c67
...@@ -104,13 +104,13 @@ static int jornada720_ts_probe(struct platform_device *pdev) ...@@ -104,13 +104,13 @@ static int jornada720_ts_probe(struct platform_device *pdev)
struct input_dev *input_dev; struct input_dev *input_dev;
int error; int error;
jornada_ts = kzalloc(sizeof(struct jornada_ts), GFP_KERNEL); jornada_ts = devm_kzalloc(&pdev->dev, sizeof(*jornada_ts), GFP_KERNEL);
input_dev = input_allocate_device(); if (!jornada_ts)
return -ENOMEM;
if (!jornada_ts || !input_dev) { input_dev = devm_input_allocate_device(&pdev->dev);
error = -ENOMEM; if (!input_dev)
goto fail1; return -ENOMEM;
}
platform_set_drvdata(pdev, jornada_ts); platform_set_drvdata(pdev, jornada_ts);
...@@ -126,36 +126,18 @@ static int jornada720_ts_probe(struct platform_device *pdev) ...@@ -126,36 +126,18 @@ static int jornada720_ts_probe(struct platform_device *pdev)
input_set_abs_params(input_dev, ABS_X, 270, 3900, 0, 0); input_set_abs_params(input_dev, ABS_X, 270, 3900, 0, 0);
input_set_abs_params(input_dev, ABS_Y, 180, 3700, 0, 0); input_set_abs_params(input_dev, ABS_Y, 180, 3700, 0, 0);
error = request_irq(IRQ_GPIO9, error = devm_request_irq(&pdev->dev, IRQ_GPIO9,
jornada720_ts_interrupt, jornada720_ts_interrupt,
IRQF_TRIGGER_RISING, IRQF_TRIGGER_RISING,
"HP7XX Touchscreen driver", pdev); "HP7XX Touchscreen driver", pdev);
if (error) { if (error) {
printk(KERN_INFO "HP7XX TS : Unable to acquire irq!\n"); dev_err(&pdev->dev, "HP7XX TS : Unable to acquire irq!\n");
goto fail1; return error;
} }
error = input_register_device(jornada_ts->dev); error = input_register_device(jornada_ts->dev);
if (error) if (error)
goto fail2; return error;
return 0;
fail2:
free_irq(IRQ_GPIO9, pdev);
fail1:
input_free_device(input_dev);
kfree(jornada_ts);
return error;
}
static int jornada720_ts_remove(struct platform_device *pdev)
{
struct jornada_ts *jornada_ts = platform_get_drvdata(pdev);
free_irq(IRQ_GPIO9, pdev);
input_unregister_device(jornada_ts->dev);
kfree(jornada_ts);
return 0; return 0;
} }
...@@ -165,7 +147,6 @@ MODULE_ALIAS("platform:jornada_ts"); ...@@ -165,7 +147,6 @@ MODULE_ALIAS("platform:jornada_ts");
static struct platform_driver jornada720_ts_driver = { static struct platform_driver jornada720_ts_driver = {
.probe = jornada720_ts_probe, .probe = jornada720_ts_probe,
.remove = jornada720_ts_remove,
.driver = { .driver = {
.name = "jornada_ts", .name = "jornada_ts",
.owner = THIS_MODULE, .owner = THIS_MODULE,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment