Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F116048115
D45845.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D45845.diff
View Options
diff --git a/sys/compat/linuxkpi/common/include/linux/device.h b/sys/compat/linuxkpi/common/include/linux/device.h
--- a/sys/compat/linuxkpi/common/include/linux/device.h
+++ b/sys/compat/linuxkpi/common/include/linux/device.h
@@ -701,4 +701,8 @@
#define devm_add_action_or_reset(dev, action, data) \
lkpi_devm_add_action_or_reset(dev, action, data)
+int lkpi_devm_device_add_group(struct device *dev, const struct attribute_group *group);
+#define devm_device_add_group(dev, group) \
+ lkpi_devm_device_add_group(dev, group)
+
#endif /* _LINUXKPI_LINUX_DEVICE_H_ */
diff --git a/sys/compat/linuxkpi/common/src/linux_compat.c b/sys/compat/linuxkpi/common/src/linux_compat.c
--- a/sys/compat/linuxkpi/common/src/linux_compat.c
+++ b/sys/compat/linuxkpi/common/src/linux_compat.c
@@ -2615,6 +2615,36 @@
return (false);
}
+static void
+devm_device_group_remove(struct device *dev, void *p)
+{
+ const struct attribute_group **dr = p;
+ const struct attribute_group *group = *dr;
+
+ sysfs_remove_group(&dev->kobj, group);
+}
+
+int
+lkpi_devm_device_add_group(struct device *dev,
+ const struct attribute_group *group)
+{
+ const struct attribute_group **dr;
+ int ret;
+
+ dr = devres_alloc(devm_device_group_remove, sizeof(*dr), GFP_KERNEL);
+ if (dr == NULL)
+ return (-ENOMEM);
+
+ ret = sysfs_create_group(&dev->kobj, group);
+ if (ret == 0) {
+ *dr = group;
+ devres_add(dev, dr);
+ } else
+ devres_free(dr);
+
+ return (ret);
+}
+
#if defined(__i386__) || defined(__amd64__)
bool linux_cpu_has_clflush;
struct cpuinfo_x86 boot_cpu_data;
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, May 3, 1:42 AM (12 h, 54 s)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
17916608
Default Alt Text
D45845.diff (1 KB)
Attached To
Mode
D45845: LinuxKPI: Add devm_device_add_group to linux/device.h
Attached
Detach File
Event Timeline
Log In to Comment