]> rtime.felk.cvut.cz Git - linux-imx.git/commit
asus-laptop: callbacks should use "driver data" parameter or field
authorCorentin Chary <corentincj@iksaif.net>
Tue, 1 Dec 2009 21:39:41 +0000 (22:39 +0100)
committerCorentin Chary <corentincj@iksaif.net>
Sun, 28 Feb 2010 18:35:10 +0000 (19:35 +0100)
commit9129d14d297e78bc21caffa44d55a5920a74862c
tree0f7a6006d36e9130de46a4a7989a03aaa1d184f9
parent7c247645f305da2bb309fa439fd6cc0aa26f8722
asus-laptop: callbacks should use "driver data" parameter or field

(Changelog stolen from Alan's patch for eeepc-laptop, but this patch
does the same thing for asus-laptop)

Callback methods should not refer to a variable like "asus" (formally
"hotk").  Instead, they should extract the data they need either from
a "driver data" parameter, or the "driver data" field of the object
which they operate on.  The "asus" variable can then be removed.

In practice, drivers under "drivers/platform" can get away without using
driver data, because it doesn't make sense to have more than one
instance of them.  However this makes it harder to review them for
correctness.  This is especially true for core ACPI developers who have
not previously been exposed to this anti-pattern :-).

This will serve as an example of best practice for new driver writers
(whether they find it themselves, or have it pointed out during review
:-).

Signed-off-by: Corentin Chary <corentincj@iksaif.net>
drivers/platform/x86/asus-laptop.c