[coreboot-gerrit] New patch to review for coreboot: 9a39bcf ec: Use DEVICE_NOOP macro formalism over static stub func

Edward O'Callaghan (eocallaghan@alterapraxis.com) gerrit at coreboot.org
Fri Nov 28 14:10:34 CET 2014


Edward O'Callaghan (eocallaghan at alterapraxis.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/7598

-gerrit

commit 9a39bcf2464e79665e90999853bc7f16f8274a94
Author: Edward O'Callaghan <eocallaghan at alterapraxis.com>
Date:   Sat Nov 29 00:03:03 2014 +1100

    ec: Use DEVICE_NOOP macro formalism over static stub func
    
    The in source comment:
    
    	/* This function avoids an error on serial console. */
    
    refers to the resource allocator needing to find a non-NULL
    function pointer else complaints of "... missing read_resources"
    will be spewed.
    
    Unfortunately/fortunately (depending on the time of day) compiler
    optimisers have gotten a bit better at optimising away no-op functions
    leading to the very message these stubs attempted to avoid. By using
    the DEVICE_NOOP formalism that is static inlined 'suggests' (not enforces)
    to the compiler to keep these symbols around.
    
    Change-Id: I182019627b6954a4020f9f70e9c829ce3135f63c
    Signed-off-by: Edward O'Callaghan <eocallaghan at alterapraxis.com>
---
 src/ec/compal/ene932/ec.c      | 16 ++--------------
 src/ec/quanta/ene_kb3940q/ec.c | 16 ++--------------
 src/ec/quanta/it8518/ec.c      | 16 ++--------------
 3 files changed, 6 insertions(+), 42 deletions(-)

diff --git a/src/ec/compal/ene932/ec.c b/src/ec/compal/ene932/ec.c
index 4bf6727..91c979e 100644
--- a/src/ec/compal/ene932/ec.c
+++ b/src/ec/compal/ene932/ec.c
@@ -142,22 +142,10 @@ static void ene932_init(struct device *dev)
 
 }
 
-
-static void ene932_read_resources(struct device *dev)
-{
-	/* This function avoids an error on serial console. */
-}
-
-
-static void ene932_enable_resources(struct device *dev)
-{
-	/* This function avoids an error on serial console. */
-}
-
 static struct device_operations ops = {
 	.init             = ene932_init,
-	.read_resources   = ene932_read_resources,
-	.enable_resources = ene932_enable_resources
+	.read_resources   = DEVICE_NOOP,
+	.enable_resources = DEVICE_NOOP,
 };
 
 static struct pnp_info pnp_dev_info[] = {
diff --git a/src/ec/quanta/ene_kb3940q/ec.c b/src/ec/quanta/ene_kb3940q/ec.c
index dcd9c4a..d7539fc 100644
--- a/src/ec/quanta/ene_kb3940q/ec.c
+++ b/src/ec/quanta/ene_kb3940q/ec.c
@@ -152,22 +152,10 @@ static void ene_kb3940q_init(struct device *dev)
 	ene_kb3940q_log_events();
 }
 
-
-static void ene_kb3940q_read_resources(struct device *dev)
-{
-	/* This function avoids an error on serial console. */
-}
-
-
-static void ene_kb3940q_enable_resources(struct device *dev)
-{
-	/* This function avoids an error on serial console. */
-}
-
 static struct device_operations ops = {
 	.init             = ene_kb3940q_init,
-	.read_resources   = ene_kb3940q_read_resources,
-	.enable_resources = ene_kb3940q_enable_resources
+	.read_resources   = DEVICE_NOOP,
+	.enable_resources = DEVICE_NOOP,
 };
 
 static struct pnp_info pnp_dev_info[] = {
diff --git a/src/ec/quanta/it8518/ec.c b/src/ec/quanta/it8518/ec.c
index cd976e6..5ce5c6c 100644
--- a/src/ec/quanta/it8518/ec.c
+++ b/src/ec/quanta/it8518/ec.c
@@ -165,22 +165,10 @@ static void it8518_init(struct device *dev)
 	pc_keyboard_init();
 }
 
-
-static void it8518_read_resources(struct device *dev)
-{
-	/* This function avoids an error on serial console. */
-}
-
-
-static void it8518_enable_resources(struct device *dev)
-{
-	/* This function avoids an error on serial console. */
-}
-
 static struct device_operations ops = {
 	.init             = it8518_init,
-	.read_resources   = it8518_read_resources,
-	.enable_resources = it8518_enable_resources
+	.read_resources   = DEVICE_NOOP,
+	.enable_resources = DEVICE_NOOP,
 };
 
 static struct pnp_info pnp_dev_info[] = {



More information about the coreboot-gerrit mailing list