Re: [PATCH 8/12] neo1973: button input device driver

From
Dmitry Torokhov <dmitry.torokhov@gmail.com>
Date
2008-01-03 17:05:04
Reply to
Harald Welte, 2007-12-18
Hi Harald,

Sorry for the slow response.

On Dec 18, 2007 6:08 AM, Harald Welte [off-list ref] wrote:
quoted hunk ↗ jump to hunk
+
+       input_dev->name = "Neo1973 Buttons";
+       input_dev->phys = "neo1973kbd/input0";
+       input_dev->id.bustype = BUS_HOST;
+       input_dev->id.vendor = 0x0001;
+       input_dev->id.product = 0x0001;
+       input_dev->id.version = 0x0100;
+       input_dev->cdev.dev = &pdev->dev;
Please use input_dev->dev.parent instead of cdev as it is going away.
+       input_dev->private = neo1973kbd;
Please use input_set_drvdata() instead of accessing private directly.
+out_aux:
+       input_unregister_device(neo1973kbd->input);
Add neo1973kbd->input = NULL here, otherwise we'll end up doing
input_free_device after input_unregister_device which is no good
(unregister will free the device if it is the last reference).
quoted hunk ↗ jump to hunk
+out_register:
+       input_free_device(neo1973kbd->input);
+       platform_set_drvdata(pdev, NULL);
+       kfree(neo1973kbd);
+
+       return -ENODEV;
+}
+
+static int neo1973kbd_remove(struct platform_device *pdev)
+{
+       struct neo1973kbd *neo1973kbd = platform_get_drvdata(pdev);
+
+       free_irq(s3c2410_gpio_getirq(pdev->resource[2].start), neo1973kbd);
+       free_irq(s3c2410_gpio_getirq(pdev->resource[1].start), neo1973kbd);
+       free_irq(s3c2410_gpio_getirq(pdev->resource[0].start), neo1973kbd);
+
+       input_unregister_device(neo1973kbd->input);
+       input_free_device(neo1973kbd->input);
Same here, input_free_device() is harmful here.

-- 
Dmitry
Thread (2 messages) 2 messages, 2 authors, last reply 2008-01-03
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help