@@ -24,6 +24,7 @@
#include <linux/dmi.h>
#include <linux/capability.h>
#include <linux/slab.h>
+#include <linux/sysfs.h>
#include <linux/list.h>
#include <linux/io.h>
#include <asm/dmi.h>
@@ -13,6 +13,7 @@
#include <linux/types.h>
#include <linux/memblock.h>
#include <linux/slab.h>
+#include <linux/sysfs.h>
#include <linux/mm.h>
/*
@@ -9,6 +9,7 @@
#include <linux/input/vivaldi-fmap.h>
#include <linux/kernel.h>
#include <linux/module.h>
+#include <linux/sysfs.h>
#include <linux/types.h>
/**
@@ -1,6 +1,7 @@
// SPDX-License-Identifier: GPL-2.0
#include <linux/of.h>
#include <linux/slab.h>
+#include <linux/sysfs.h>
#include "of_private.h"
@@ -6,6 +6,7 @@
*/
#include <linux/slab.h>
+#include <linux/sysfs.h>
#include "audio_manager.h"
#include "audio_manager_private.h"
@@ -16,7 +16,7 @@
#include <linux/klist.h>
#include <linux/pm.h>
-#include <linux/sysfs.h> // for struct attribute
+#include <linux/sysfs_types.h> // for struct attribute
struct device_driver;
struct device_node;
@@ -1,7 +1,8 @@
/* SPDX-License-Identifier: GPL-2.0 */
#ifndef _IIO_BUFFER_GENERIC_IMPL_H_
#define _IIO_BUFFER_GENERIC_IMPL_H_
-#include <linux/sysfs.h>
+
+#include <linux/sysfs_types.h> // for struct attribute_group
#include <linux/kref_types.h>
#ifdef CONFIG_IIO_BUFFER
@@ -18,7 +18,7 @@
#include <linux/kobject_types.h>
#include <linux/types.h>
#include <linux/list.h>
-#include <linux/sysfs.h>
+#include <linux/sysfs_types.h> // for struct attribute
#include <linux/compiler.h>
#include <linux/container_of.h>
#include <linux/spinlock_types.h>
@@ -27,7 +27,7 @@
#include <linux/tracepoint-defs.h>
#include <linux/srcu.h>
#include <linux/static_call_types.h>
-#include <linux/sysfs.h> // for struct attribute
+#include <linux/sysfs_types.h> // for struct attribute
#include <linux/dynamic_debug.h>
#include <linux/percpu.h>
@@ -55,7 +55,7 @@ struct perf_guest_info_callbacks {
#include <linux/static_key.h>
#include <linux/jump_label_ratelimit.h>
#include <linux/atomic.h>
-#include <linux/sysfs.h>
+#include <linux/sysfs_types.h>
#include <linux/perf_regs.h>
#include <linux/cgroup.h>
#include <linux/refcount_types.h>
@@ -13,6 +13,7 @@
#ifndef _SYSFS_H_
#define _SYSFS_H_
+#include <linux/sysfs_types.h>
#include <linux/kernfs.h>
#include <linux/compiler.h>
#include <linux/list.h>
@@ -22,16 +23,6 @@ struct kobject;
struct module;
struct bin_attribute;
-struct attribute {
- const char *name;
- umode_t mode;
-#ifdef CONFIG_DEBUG_LOCK_ALLOC
- bool ignore_lockdep:1;
- struct lock_class_key *key;
- struct lock_class_key skey;
-#endif
-};
-
/**
* sysfs_attr_init - initialize a dynamically allocated sysfs attribute
* @attr: struct attribute to initialize
@@ -53,39 +44,6 @@ do { \
#define sysfs_attr_init(attr) do {} while (0)
#endif
-/**
- * struct attribute_group - data structure used to declare an attribute group.
- * @name: Optional: Attribute group name
- * If specified, the attribute group will be created in
- * a new subdirectory with this name.
- * @is_visible: Optional: Function to return permissions associated with an
- * attribute of the group. Will be called repeatedly for each
- * non-binary attribute in the group. Only read/write
- * permissions as well as SYSFS_PREALLOC are accepted. Must
- * return 0 if an attribute is not visible. The returned value
- * will replace static permissions defined in struct attribute.
- * @is_bin_visible:
- * Optional: Function to return permissions associated with a
- * binary attribute of the group. Will be called repeatedly
- * for each binary attribute in the group. Only read/write
- * permissions as well as SYSFS_PREALLOC are accepted. Must
- * return 0 if a binary attribute is not visible. The returned
- * value will replace static permissions defined in
- * struct bin_attribute.
- * @attrs: Pointer to NULL terminated list of attributes.
- * @bin_attrs: Pointer to NULL terminated list of binary attributes.
- * Either attrs or bin_attrs or both must be provided.
- */
-struct attribute_group {
- const char *name;
- umode_t (*is_visible)(struct kobject *,
- struct attribute *, int);
- umode_t (*is_bin_visible)(struct kobject *,
- struct bin_attribute *, int);
- struct attribute **attrs;
- struct bin_attribute **bin_attrs;
-};
-
/*
* Use these macros to make defining attributes easier.
* See include/linux/device.h for examples..
@@ -163,25 +121,6 @@ static const struct attribute_group _name##_group = { \
}; \
__ATTRIBUTE_GROUPS(_name)
-struct file;
-struct vm_area_struct;
-struct address_space;
-
-struct bin_attribute {
- struct attribute attr;
- size_t size;
- void *private;
- struct address_space *(*f_mapping)(void);
- ssize_t (*read)(struct file *, struct kobject *, struct bin_attribute *,
- char *, loff_t, size_t);
- ssize_t (*write)(struct file *, struct kobject *, struct bin_attribute *,
- char *, loff_t, size_t);
- loff_t (*llseek)(struct file *, struct kobject *, struct bin_attribute *,
- loff_t, int);
- int (*mmap)(struct file *, struct kobject *, struct bin_attribute *attr,
- struct vm_area_struct *vma);
-};
-
/**
* sysfs_bin_attr_init - initialize a dynamically allocated bin_attribute
* @attr: struct bin_attribute to initialize
new file mode 100644
@@ -0,0 +1,89 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * sysfs.h - definitions for the device driver filesystem
+ *
+ * Copyright (c) 2001,2002 Patrick Mochel
+ * Copyright (c) 2004 Silicon Graphics, Inc.
+ * Copyright (c) 2007 SUSE Linux Products GmbH
+ * Copyright (c) 2007 Tejun Heo <teheo@suse.de>
+ *
+ * Please see Documentation/filesystems/sysfs.rst for more information.
+ */
+
+#ifndef _SYSFS_TYPES_H_
+#define _SYSFS_TYPES_H_
+
+#include <linux/types.h>
+#include <linux/lockdep_types.h>
+
+struct kobject;
+struct module;
+struct bin_attribute;
+
+struct attribute {
+ const char *name;
+ umode_t mode;
+#ifdef CONFIG_DEBUG_LOCK_ALLOC
+ bool ignore_lockdep:1;
+ struct lock_class_key *key;
+ struct lock_class_key skey;
+#endif
+};
+
+/**
+ * struct attribute_group - data structure used to declare an attribute group.
+ * @name: Optional: Attribute group name
+ * If specified, the attribute group will be created in
+ * a new subdirectory with this name.
+ * @is_visible: Optional: Function to return permissions associated with an
+ * attribute of the group. Will be called repeatedly for each
+ * non-binary attribute in the group. Only read/write
+ * permissions as well as SYSFS_PREALLOC are accepted. Must
+ * return 0 if an attribute is not visible. The returned value
+ * will replace static permissions defined in struct attribute.
+ * @is_bin_visible:
+ * Optional: Function to return permissions associated with a
+ * binary attribute of the group. Will be called repeatedly
+ * for each binary attribute in the group. Only read/write
+ * permissions as well as SYSFS_PREALLOC are accepted. Must
+ * return 0 if a binary attribute is not visible. The returned
+ * value will replace static permissions defined in
+ * struct bin_attribute.
+ * @attrs: Pointer to NULL terminated list of attributes.
+ * @bin_attrs: Pointer to NULL terminated list of binary attributes.
+ * Either attrs or bin_attrs or both must be provided.
+ */
+struct attribute_group {
+ const char *name;
+ umode_t (*is_visible)(struct kobject *,
+ struct attribute *, int);
+ umode_t (*is_bin_visible)(struct kobject *,
+ struct bin_attribute *, int);
+ struct attribute **attrs;
+ struct bin_attribute **bin_attrs;
+};
+
+struct file;
+struct vm_area_struct;
+struct address_space;
+
+struct bin_attribute {
+ struct attribute attr;
+ size_t size;
+#ifdef __cplusplus
+ void *private_;
+#else
+ void *private;
+#endif
+ struct address_space *(*f_mapping)(void);
+ ssize_t (*read)(struct file *, struct kobject *, struct bin_attribute *,
+ char *, loff_t, size_t);
+ ssize_t (*write)(struct file *, struct kobject *, struct bin_attribute *,
+ char *, loff_t, size_t);
+ loff_t (*llseek)(struct file *, struct kobject *, struct bin_attribute *,
+ loff_t, int);
+ int (*mmap)(struct file *, struct kobject *, struct bin_attribute *attr,
+ struct vm_area_struct *vma);
+};
+
+#endif /* _SYSFS_TYPES_H_ */
@@ -13,7 +13,7 @@
#include <linux/of.h>
#include <linux/idr.h>
#include <linux/device.h>
-#include <linux/sysfs.h>
+#include <linux/sysfs_types.h>
#include <linux/workqueue_types.h>
#include <uapi/linux/thermal.h>
@@ -4,7 +4,7 @@
#include <linux/kobject_types.h>
#include <linux/netdevice.h>
-#include <linux/sysfs.h>
+#include <linux/sysfs_types.h>
#include <net/xdp.h>
/* This structure contains an instance of an RX queue. */
@@ -5,7 +5,7 @@
#ifndef DEF_RDMA_IB_SYSFS_H
#define DEF_RDMA_IB_SYSFS_H
-#include <linux/sysfs.h>
+#include <linux/sysfs_types.h>
struct ib_device;
@@ -10,6 +10,7 @@
#include <linux/module.h>
#include <linux/kobject.h>
#include <linux/init.h>
+#include <linux/sysfs.h>
/*
* Define kernel_headers_data and kernel_headers_data_end, within which the
@@ -21,6 +21,7 @@
#include <linux/uidgid.h>
#include <linux/workqueue.h>
#include <linux/kref.h>
+#include <linux/sysfs.h>
/**
* kobject_namespace() - Return @kobj's namespace tag.
@@ -8,6 +8,7 @@
#include <linux/cma.h>
#include <linux/kernel.h>
#include <linux/slab.h>
+#include <linux/sysfs.h>
#include "cma.h"