Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F177181506
D55036.1793936673.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Authored By
Unknown
Size
1 KB
Referenced Files
None
Subscribers
None
D55036.1793936673.diff
View Options
diff --git a/sys/compat/linuxkpi/common/src/linuxkpi_usb.c b/sys/compat/linuxkpi/common/src/linuxkpi_usb.c
--- a/sys/compat/linuxkpi/common/src/linuxkpi_usb.c
+++ b/sys/compat/linuxkpi/common/src/linuxkpi_usb.c
@@ -1167,6 +1167,25 @@
/* ---------------------------------------------------------------------------- */
/* Internal helper functions for the native device interface. */
+static int
+lkpi_usb_fill_dev(device_t bsddev, struct device *dev, const char *name)
+{
+ int error;
+
+ error = kobject_init_and_add(&dev->kobj, &linux_dev_ktype,
+ &linux_root_device.kobj, name);
+ if (error != 0)
+ return (error);
+
+ dev->bsddev = bsddev;
+ dev->parent = &linux_root_device;
+
+ spin_lock_init(&dev->devres_lock);
+ INIT_LIST_HEAD(&dev->devres_head);
+
+ return (0);
+}
+
/*
* lkpi_usb_create_device()
*
@@ -1188,8 +1207,7 @@
uint8_t pass;
uint8_t iface_no;
- error = kobject_init_and_add(&udev->dev.kobj, &linux_dev_ktype,
- &linux_root_device.kobj, device_get_nameunit(dev));
+ error = lkpi_usb_fill_dev(dev, &udev->dev, device_get_nameunit(dev));
if (error != 0)
return (error);
@@ -1270,11 +1288,9 @@
p_ui->cur_altsetting = p_uhi - 1;
p_ui->bsd_iface_index = iface_index;
p_ui->udev = udev;
-
- error = kobject_init_and_add(&p_ui->dev.kobj, &linux_dev_ktype,
- &linux_root_device.kobj, dev_name(&udev->dev));
+ error = lkpi_usb_fill_dev(p_ui->subdev, /* XXX ? */
+ &p_ui->dev, dev_name(&udev->dev));
WARN_ON(error != 0);
- p_ui->dev.bsddev = p_ui->subdev; /* XXX ? */
p_ui++;
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Nov 6, 3:44 AM (18 h, 9 s)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
41467891
Default Alt Text
D55036.1793936673.diff (1 KB)
Attached To
Mode
D55036: LinuxKPI: usb: factor out struct device initialization
Attached
Detach File
Event Timeline