Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F171346554
D21564.id62411.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D21564.id62411.diff
View Options
Index: sys/compat/linuxkpi/common/include/linux/device.h
===================================================================
--- sys/compat/linuxkpi/common/include/linux/device.h
+++ sys/compat/linuxkpi/common/include/linux/device.h
@@ -57,6 +57,7 @@
void (*class_release)(struct class *class);
void (*dev_release)(struct device *dev);
char * (*devnode)(struct device *dev, umode_t *mode);
+ const struct attribute_group **dev_groups;
};
struct dev_pm_ops {
@@ -424,7 +425,7 @@
kobject_init(&dev->kobj, &linux_dev_ktype);
kobject_add(&dev->kobj, &dev->class->kobj, dev_name(dev));
- return (0);
+ return (sysfs_create_groups(&dev->kobj, dev->class->dev_groups));
}
static inline void
@@ -432,6 +433,8 @@
{
device_t bsddev;
+ sysfs_remove_groups(&dev->kobj, dev->class->dev_groups);
+
bsddev = dev->bsddev;
dev->bsddev = NULL;
Index: sys/compat/linuxkpi/common/include/linux/sysfs.h
===================================================================
--- sys/compat/linuxkpi/common/include/linux/sysfs.h
+++ sys/compat/linuxkpi/common/include/linux/sysfs.h
@@ -62,12 +62,13 @@
#define ATTRIBUTE_GROUPS(_name) \
static struct attribute_group _name##_group = { \
+ .name = __stringify(_name), \
.attrs = _name##_attrs, \
}; \
- static struct attribute_group *_name##_groups[] = { \
+ static const struct attribute_group *_name##_groups[] = { \
&_name##_group, \
NULL, \
- };
+ }
/*
* Handle our generic '\0' terminated 'C' string.
@@ -210,14 +211,27 @@
int error = 0;
int i;
+ if (grps == NULL)
+ goto done;
for (i = 0; grps[i] && !error; i++)
error = sysfs_create_group(kobj, grps[i]);
while (error && --i >= 0)
sysfs_remove_group(kobj, grps[i]);
-
+done:
return (error);
}
+static inline void
+sysfs_remove_groups(struct kobject *kobj, const struct attribute_group **grps)
+{
+ int i;
+
+ if (grps == NULL)
+ return;
+ for (i = 0; grps[i]; i++)
+ sysfs_remove_group(kobj, grps[i]);
+}
+
static inline int
sysfs_merge_group(struct kobject *kobj, const struct attribute_group *grp)
{
Index: sys/sys/param.h
===================================================================
--- sys/sys/param.h
+++ sys/sys/param.h
@@ -60,7 +60,7 @@
* in the range 5 to 9.
*/
#undef __FreeBSD_version
-#define __FreeBSD_version 1300047 /* Master, propagated to newvers */
+#define __FreeBSD_version 1300048 /* Master, propagated to newvers */
/*
* __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD,
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Sep 11, 2:24 PM (21 h, 55 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
38710369
Default Alt Text
D21564.id62411.diff (2 KB)
Attached To
Mode
D21564: LinuxKPI: enable class dev_groups attributes
Attached
Detach File
Event Timeline
Log In to Comment