diff options
author | Nico Huber <nico.h@gmx.de> | 2013-06-10 22:57:12 +0200 |
---|---|---|
committer | Stefan Reinauer <stefan.reinauer@coreboot.org> | 2013-06-17 21:38:37 +0200 |
commit | f898f7ba4d10146b45241afe65fd54b3c049cc4f (patch) | |
tree | d0aa5c8874521f998f794c12fce9b5dfc80abeed /src/superio/fintek | |
parent | a00f9830fb58d3f5061aab71be8553f3ff2e1f70 (diff) |
pnp: Provide alternative pnp_enable() implementation
The current default implementation of pnp_enable() only disables devices
- if set so in the devicetree - but does not enable them. Enablement takes
place in pnp_enable_resources(). Yet, many PnP chips implement their own
version of pnp_enable() which also enables devices if set in the devicetree.
It's arguable, if enabling those devices makes sense, before they get
resources assigned. Maybe we can't write the resource registers if not,
who knows? The least we can do is providing a common implementation for
this behavior, and get rid of some code duplication.
Used the following cocci:
@@
expression e;
@@
+pnp_alt_enable(e);
-pnp_set_logical_device(e);
(
-pnp_set_enable(e, !!e->enabled);
|
-(e->enabled) ? pnp_set_enable(e, 1) : pnp_set_enable(e, 0);
|
-if (e->enabled) { pnp_set_enable(e, 1); }
-else { pnp_set_enable(e, 0); }
)
Change-Id: I8d695e8fcd3cf8b847b1aa99326b51a554700bc4
Signed-off-by: Nico Huber <nico.h@gmx.de>
Reviewed-on: http://review.coreboot.org/3480
Tested-by: build bot (Jenkins)
Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>
Reviewed-by: Ronald G. Minnich <rminnich@gmail.com>
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
Diffstat (limited to 'src/superio/fintek')
-rw-r--r-- | src/superio/fintek/f71805f/superio.c | 3 | ||||
-rw-r--r-- | src/superio/fintek/f71859/superio.c | 3 | ||||
-rw-r--r-- | src/superio/fintek/f71863fg/superio.c | 3 | ||||
-rw-r--r-- | src/superio/fintek/f71872/superio.c | 3 | ||||
-rw-r--r-- | src/superio/fintek/f71889/superio.c | 3 | ||||
-rw-r--r-- | src/superio/fintek/f81865f/superio.c | 3 |
6 files changed, 6 insertions, 12 deletions
diff --git a/src/superio/fintek/f71805f/superio.c b/src/superio/fintek/f71805f/superio.c index 964f105e14..f46bd67dc4 100644 --- a/src/superio/fintek/f71805f/superio.c +++ b/src/superio/fintek/f71805f/superio.c @@ -62,8 +62,7 @@ static void f71805f_pnp_enable_resources(device_t dev) static void f71805f_pnp_enable(device_t dev) { pnp_enter_conf_state(dev); - pnp_set_logical_device(dev); - pnp_set_enable(dev, !!dev->enabled); + pnp_alt_enable(dev); pnp_exit_conf_state(dev); } diff --git a/src/superio/fintek/f71859/superio.c b/src/superio/fintek/f71859/superio.c index db7834dfdf..ed5da6ee30 100644 --- a/src/superio/fintek/f71859/superio.c +++ b/src/superio/fintek/f71859/superio.c @@ -63,8 +63,7 @@ static void f71859_pnp_enable_resources(device_t dev) static void f71859_pnp_enable(device_t dev) { pnp_enter_conf_state(dev); - pnp_set_logical_device(dev); - pnp_set_enable(dev, !!dev->enabled); + pnp_alt_enable(dev); pnp_exit_conf_state(dev); } diff --git a/src/superio/fintek/f71863fg/superio.c b/src/superio/fintek/f71863fg/superio.c index ab86922be5..d133745622 100644 --- a/src/superio/fintek/f71863fg/superio.c +++ b/src/superio/fintek/f71863fg/superio.c @@ -72,8 +72,7 @@ static void f71863fg_pnp_enable_resources(device_t dev) static void f71863fg_pnp_enable(device_t dev) { pnp_enter_conf_state(dev); - pnp_set_logical_device(dev); - pnp_set_enable(dev, !!dev->enabled); + pnp_alt_enable(dev); pnp_exit_conf_state(dev); } diff --git a/src/superio/fintek/f71872/superio.c b/src/superio/fintek/f71872/superio.c index ae5360804e..5a2719b403 100644 --- a/src/superio/fintek/f71872/superio.c +++ b/src/superio/fintek/f71872/superio.c @@ -69,8 +69,7 @@ static void f71872_pnp_enable_resources(device_t dev) static void f71872_pnp_enable(device_t dev) { pnp_enter_conf_state(dev); - pnp_set_logical_device(dev); - pnp_set_enable(dev, !!dev->enabled); + pnp_alt_enable(dev); pnp_exit_conf_state(dev); } diff --git a/src/superio/fintek/f71889/superio.c b/src/superio/fintek/f71889/superio.c index 98306f9edd..8daf7669a8 100644 --- a/src/superio/fintek/f71889/superio.c +++ b/src/superio/fintek/f71889/superio.c @@ -70,8 +70,7 @@ static void f71889_pnp_enable_resources(device_t dev) static void f71889_pnp_enable(device_t dev) { pnp_enter_conf_state(dev); - pnp_set_logical_device(dev); - pnp_set_enable(dev, !!dev->enabled); + pnp_alt_enable(dev); pnp_exit_conf_state(dev); } diff --git a/src/superio/fintek/f81865f/superio.c b/src/superio/fintek/f81865f/superio.c index e09adbb461..eaae09ce09 100644 --- a/src/superio/fintek/f81865f/superio.c +++ b/src/superio/fintek/f81865f/superio.c @@ -69,8 +69,7 @@ static void f81865f_pnp_enable_resources(device_t dev) static void f81865f_pnp_enable(device_t dev) { pnp_enter_conf_state(dev); - pnp_set_logical_device(dev); - (dev->enabled) ? pnp_set_enable(dev, 1) : pnp_set_enable(dev, 0); + pnp_alt_enable(dev); pnp_exit_conf_state(dev); } |