#define TYPE_DEVICE "device"
#define DEVICE(obj) OBJECT_CHECK(DeviceState, (obj), TYPE_DEVICE)
+#define DEVICE_CLASS(klass) OBJECT_CLASS_CHECK(DeviceClass, (klass), TYPE_DEVICE)
+#define DEVICE_GET_CLASS(obj) OBJECT_GET_CLASS(DeviceClass, (obj), TYPE_DEVICE)
typedef struct DeviceClass {
ObjectClass parent_class;
+ DeviceInfo *info;
} DeviceClass;
/* This structure should not be accessed directly. We declare it here
enum DevState state;
QemuOpts *opts;
int hotplugged;
- DeviceInfo *info;
BusState *parent_bus;
int num_gpio_out;
qemu_irq *gpio_out;
void error_set_from_qdev_prop_error(Error **errp, int ret, DeviceState *dev,
Property *prop, const char *value);
+DeviceInfo *qdev_get_info(DeviceState *dev);
+
static inline const char *qdev_fw_name(DeviceState *dev)
{
- return dev->info->fw_name ? : dev->info->alias ? : dev->info->name;
+ DeviceInfo *info = qdev_get_info(dev);
+
+ if (info->fw_name) {
+ return info->fw_name;
+ } else if (info->alias) {
+ return info->alias;
+ }
+
+ return info->name;
}
char *qdev_get_fw_dev_path(DeviceState *dev);