+void
+device_populate_info(struct device* dev, struct dev_info* devinfo)
+{
+ devinfo->dev_id.group = dev->ident.fn_grp;
+ devinfo->dev_id.unique = dev->ident.unique;
+
+ if (!devinfo->dev_name.buf) {
+ return;
+ }
+
+ struct device_def* def = devdef_byident(&dev->ident);
+ size_t buflen = devinfo->dev_name.buf_len;
+
+ strncpy(devinfo->dev_name.buf, def->name, buflen);
+ devinfo->dev_name.buf[buflen - 1] = 0;
+}
+
+struct device*
+device_cast(void* obj)
+{
+ struct device* dev = (struct device*)obj;
+ if (dev && dev->magic == DEV_STRUCT_MAGIC) {
+ return dev;
+ }
+
+ return NULL;
+}
+
+void
+device_alert_poller(struct device* dev, int poll_evt)
+{
+ dev->poll_evflags = poll_evt;
+ iopoll_wake_pollers(&dev->pollers);
+}
+