Thread (1 message) 1 message, 1 author, 2011-11-23

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

From: Thierry Reding <hidden>
Date: 2011-11-23 20:40:30
Also in: alsa-devel, linux-devicetree, linux-tegra

* Stephen Warren wrote:
Thierry Reding wrote at Tuesday, November 22, 2011 11:58 PM:
quoted
* Stephen Warren wrote:
quoted
module_platform_drive saves some boiler-plate code.

The devm_ APIs remove the need to manually clean up allocations,
thus removing some code.
...
quoted
quoted
 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.
When Mark Brown reviewed the TrimSlice machine driver, he mentioned that
clearing the drvdata was pointless; nothing should be using it when the
device is not created.

As background, soon after that, I modified the tegra_wm8903.c machine
driver along the same lines, but evidently didn't update tegra_das.c
in a similar way, but would have if I'd been paying attention...
Thinking about this some more I have to agree. The only one using the driver
data would be the driver, which in turn shouldn't be doing anything with it
after remove is called.

I was just commenting on it because I've seen it done in a lot of drivers and
thought it was common (best) practice.

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.infradead.org/pipermail/linux-arm-kernel/attachments/20111123/21c11281/attachment-0001.sig>
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help