[PATCH 07/17] ASoC: Tegra DAS: Use devm_ APIs and module_platform_driver

Thierry Reding thierry.reding at avionic-design.de
Wed Nov 23 17:58:08 EST 2011


* Stephen Warren wrote:
> module_platform_drive saves some boiler-plate code.
> 
> The devm_ APIs remove the need to manually clean up allocations,
> thus removing some code.
> 
> Signed-off-by: Stephen Warren <swarren at nvidia.com>
> ---
>  sound/soc/tegra/tegra_das.c |   45 +++++++++---------------------------------
>  1 files changed, 10 insertions(+), 35 deletions(-)
> 
> diff --git a/sound/soc/tegra/tegra_das.c b/sound/soc/tegra/tegra_das.c
[...]
> @@ -208,32 +208,18 @@ static int __devinit tegra_das_probe(struct platform_device *pdev)
>  
>  	return 0;
>  
> -err_release:
> -	release_mem_region(res->start, resource_size(res));
> -err_free:
> -	kfree(das);
> +err:
>  	das = NULL;
> -exit:
>  	return ret;
>  }
>  
>  static int __devexit tegra_das_remove(struct platform_device *pdev)
>  {
> -	struct resource *res;
> -
>  	if (!das)
>  		return -ENODEV;
>  
> -	platform_set_drvdata(pdev, NULL);
> -
[...]

Setting the driver data to NULL may still be a good idea.

Thierry
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.ozlabs.org/pipermail/devicetree-discuss/attachments/20111123/36c981fe/attachment.pgp>


More information about the devicetree-discuss mailing list