Nico Huber would like Angel Pons and Werner Zeh to review this change.

View Change

device: Clarify use of `config_of()`

We don't want unnecessary die() calls to spread throughout coreboot.
Chances are high that we'd add a NON_FATAL_DIE Kconfig eventually.

Change-Id: I01c7efdf23672bad3a195b7dc1565a3cc8a087bd
Signed-off-by: Nico Huber <nico.h@gmx.de>
---
M src/include/device/device.h
1 file changed, 6 insertions(+), 0 deletions(-)

git pull ssh://review.coreboot.org:29418/coreboot refs/changes/46/46046/1
diff --git a/src/include/device/device.h b/src/include/device/device.h
index b53b64a..031091a 100644
--- a/src/include/device/device.h
+++ b/src/include/device/device.h
@@ -339,6 +339,12 @@
void devtree_bug(const char *func, pci_devfn_t devfn);
void __noreturn devtree_die(void);

+/*
+ * Dies if `dev` or `dev->chip_info` are NULL. Returns `dev->chip_info` otherwise.
+ *
+ * Only use if missing `chip_info` is fatal and we can't boot. If it's
+ * not fatal, please handle the NULL case gracefully.
+ */
static inline DEVTREE_CONST void *config_of(const struct device *dev)
{
if (dev && dev->chip_info)

To view, visit change 46046. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: I01c7efdf23672bad3a195b7dc1565a3cc8a087bd
Gerrit-Change-Number: 46046
Gerrit-PatchSet: 1
Gerrit-Owner: Nico Huber <nico.h@gmx.de>
Gerrit-Reviewer: Angel Pons <th3fanbus@gmail.com>
Gerrit-Reviewer: Werner Zeh <werner.zeh@siemens.com>
Gerrit-MessageType: newchange