lkml.org 
[lkml]   [2012]   [Apr]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v8 2/6] Extcon: support generic GPIO extcon driver
On Thu, Apr 19, 2012 at 11:41:34AM +0900, MyungJoo Ham wrote:
> The generic GPIO extcon driver (an external connector device based on
> GPIO control) and imported from Android kernel.

Reviwed-by: Mark Brown <broonie@opensource.wolfsonmicro.com>

> + ret = gpio_request(extcon_data->gpio, pdev->name);
> + if (ret < 0)
> + goto err_request_gpio;
> +
> + ret = gpio_direction_input(extcon_data->gpio);
> + if (ret < 0)
> + goto err_set_gpio_input;

Incrementally (or in future versions) I'd suggest replacing with
gpio_request_one() which combines the above and is generally nicer.

> +static int __devexit gpio_extcon_remove(struct platform_device *pdev)
> +{
> + struct gpio_extcon_data *extcon_data = platform_get_drvdata(pdev);
> +
> + cancel_delayed_work_sync(&extcon_data->work);
> + gpio_free(extcon_data->gpio);
> + extcon_dev_unregister(&extcon_data->edev);
> + devm_kfree(&pdev->dev, extcon_data);

The whole point of using devm_ is that you don't need to explicitly free
for this usage pattern. On the other hand it does no harm.
[unhandled content-type:application/pgp-signature]
\
 
 \ /
  Last update: 2012-04-19 13:43    [W:0.175 / U:0.264 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site