Skip to content

Commit

Permalink
asus-laptop: callbacks should use "driver data" parameter or field
Browse files Browse the repository at this point in the history
(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>
  • Loading branch information
Corentin Chary committed Feb 28, 2010
1 parent 7c24764 commit 9129d14
Showing 1 changed file with 209 additions and 153 deletions.
Loading

0 comments on commit 9129d14

Please sign in to comment.