@@ -41,9 +41,10 @@ static char *bus_get_fw_dev_path(BusState *bus, DeviceState *dev)
return NULL;
}
-static char *qdev_get_fw_dev_path_from_handler(BusState *bus, DeviceState *dev)
+static char *qdev_get_fw_dev_path_from_handler(DeviceState *dev)
{
Object *obj = OBJECT(dev);
+ BusState *bus = qdev_get_parent_bus(dev);
char *d = NULL;
while (!d && obj->parent) {
@@ -53,11 +54,11 @@ static char *qdev_get_fw_dev_path_from_handler(BusState *bus, DeviceState *dev)
return d;
}
-char *qdev_get_own_fw_dev_path_from_handler(BusState *bus, DeviceState *dev)
+char *qdev_get_own_fw_dev_path_from_handler(DeviceState *dev)
{
Object *obj = OBJECT(dev);
- return fw_path_provider_try_get_dev_path(obj, bus, dev);
+ return fw_path_provider_try_get_dev_path(obj, qdev_get_parent_bus(dev), dev);
}
static int qdev_get_fw_dev_path_helper(DeviceState *dev, char *p, int size)
@@ -67,7 +68,7 @@ static int qdev_get_fw_dev_path_helper(DeviceState *dev, char *p, int size)
if (dev && dev->parent_bus) {
char *d;
l = qdev_get_fw_dev_path_helper(dev->parent_bus->parent, p, size);
- d = qdev_get_fw_dev_path_from_handler(dev->parent_bus, dev);
+ d = qdev_get_fw_dev_path_from_handler(dev);
if (!d) {
d = bus_get_fw_dev_path(dev->parent_bus, dev);
}
@@ -774,7 +774,7 @@ bool bus_is_in_reset(BusState *bus);
BusState *sysbus_get_default(void);
char *qdev_get_fw_dev_path(DeviceState *dev);
-char *qdev_get_own_fw_dev_path_from_handler(BusState *bus, DeviceState *dev);
+char *qdev_get_own_fw_dev_path_from_handler(DeviceState *dev);
void device_class_set_props(DeviceClass *dc, Property *props);
@@ -214,7 +214,7 @@ static char *get_boot_device_path(DeviceState *dev, bool ignore_suffixes,
if (!ignore_suffixes) {
if (dev) {
- d = qdev_get_own_fw_dev_path_from_handler(dev->parent_bus, dev);
+ d = qdev_get_own_fw_dev_path_from_handler(dev);
if (d) {
assert(!suffix);
s = d;
No need to pass 'dev' and 'dev->parent_bus' when we can retrieve 'parent_bus' with qdev_get_parent_bus(). Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> --- hw/core/qdev-fw.c | 9 +++++---- include/hw/qdev-core.h | 2 +- softmmu/bootdevice.c | 2 +- 3 files changed, 7 insertions(+), 6 deletions(-)