[coreboot-gerrit] Change in coreboot[master]: pnp_device: improve readability

Felix Held (Code Review) gerrit at coreboot.org
Fri Jul 6 19:45:15 CEST 2018


Felix Held has uploaded this change for review. ( https://review.coreboot.org/27384


Change subject: pnp_device: improve readability
......................................................................

pnp_device: improve readability

Add comments on the ops handling in pnp_enable_devices function and the
pnp_info struct.
Also remove the negation in the check if an LDN-specific override is used.
This patch doesn't change the logic though.

Change-Id: I3e80dbce1f29ee3e95e3b1d71c9b8479561d5c1a
---
M src/device/pnp_device.c
M src/include/device/pnp.h
2 files changed, 7 insertions(+), 4 deletions(-)



  git pull ssh://review.coreboot.org:29418/coreboot refs/changes/84/27384/1

diff --git a/src/device/pnp_device.c b/src/device/pnp_device.c
index ba05c82..821b054 100644
--- a/src/device/pnp_device.c
+++ b/src/device/pnp_device.c
@@ -386,10 +386,13 @@
 		if (dev->ops)
 			continue;
 
-		if (info[i].ops == 0)
-			dev->ops = ops;
-		else
+		/* use LDN-specific ops override from corresponding pnp_info
+		 * entry if not NULL */
+		if (info[i].ops)
 			dev->ops = info[i].ops;
+		/* else use device ops  */
+		else
+			dev->ops = ops;
 
 		get_resources(dev, &info[i]);
 	}
diff --git a/src/include/device/pnp.h b/src/include/device/pnp.h
index e3839c6..d753013 100644
--- a/src/include/device/pnp.h
+++ b/src/include/device/pnp.h
@@ -31,7 +31,7 @@
 /* PNP helper operations */
 
 struct pnp_info {
-	struct device_operations *ops;
+	struct device_operations *ops; /* LDN-specific ops override */
 	unsigned int function; /* Must be at least 16 bits (virtual LDNs)! */
 	unsigned int flags;
 #define PNP_IO0  0x000001

-- 
To view, visit https://review.coreboot.org/27384
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings

Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I3e80dbce1f29ee3e95e3b1d71c9b8479561d5c1a
Gerrit-Change-Number: 27384
Gerrit-PatchSet: 1
Gerrit-Owner: Felix Held <felix-coreboot at felixheld.de>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.coreboot.org/pipermail/coreboot-gerrit/attachments/20180706/fd8e0dcc/attachment.html>


More information about the coreboot-gerrit mailing list