efi: Use device_get_uclass_id() where appropriate

Use this function rather than following the pointers, since it is there
for this purpose.

Add the uclass name to the debug call at the end of dp_fill() since it is
quite useful.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
This commit is contained in:
Simon Glass 2022-01-29 14:58:38 -07:00 committed by Heinrich Schuchardt
parent d837cb1e3b
commit 377d39d178

View file

@ -494,7 +494,7 @@ __maybe_unused static unsigned int dp_size(struct udevice *dev)
if (!dev || !dev->driver) if (!dev || !dev->driver)
return sizeof(ROOT); return sizeof(ROOT);
switch (dev->driver->id) { switch (device_get_uclass_id(dev)) {
case UCLASS_ROOT: case UCLASS_ROOT:
case UCLASS_SIMPLE_BUS: case UCLASS_SIMPLE_BUS:
/* stop traversing parents at this point: */ /* stop traversing parents at this point: */
@ -579,7 +579,7 @@ __maybe_unused static void *dp_fill(void *buf, struct udevice *dev)
if (!dev || !dev->driver) if (!dev || !dev->driver)
return buf; return buf;
switch (dev->driver->id) { switch (device_get_uclass_id(dev)) {
case UCLASS_ROOT: case UCLASS_ROOT:
case UCLASS_SIMPLE_BUS: { case UCLASS_SIMPLE_BUS: {
/* stop traversing parents at this point: */ /* stop traversing parents at this point: */
@ -759,9 +759,9 @@ __maybe_unused static void *dp_fill(void *buf, struct udevice *dev)
return &udp[1]; return &udp[1];
} }
default: default:
debug("%s(%u) %s: unhandled device class: %s (%u)\n", /* If the uclass driver is missing, this will show NULL */
__FILE__, __LINE__, __func__, log_debug("unhandled device class: %s (%s)\n", dev->name,
dev->name, dev->driver->id); dev_get_uclass_name(dev));
return dp_fill(buf, dev->parent); return dp_fill(buf, dev->parent);
} }
} }