#ifndef _DEVICE_CLASS_H_
#define _DEVICE_CLASS_H_
#include <linux/kobject.h>
#include <linux/klist.h>
#include <linux/pm.h>
#include <linux/device/bus.h>
struct device;
struct fwnode_handle;
struct class { … };
struct class_dev_iter { … };
int __must_check class_register(const struct class *class);
void class_unregister(const struct class *class);
bool class_is_registered(const struct class *class);
struct class_compat;
struct class_compat *class_compat_register(const char *name);
void class_compat_unregister(struct class_compat *cls);
int class_compat_create_link(struct class_compat *cls, struct device *dev,
struct device *device_link);
void class_compat_remove_link(struct class_compat *cls, struct device *dev,
struct device *device_link);
void class_dev_iter_init(struct class_dev_iter *iter, const struct class *class,
const struct device *start, const struct device_type *type);
struct device *class_dev_iter_next(struct class_dev_iter *iter);
void class_dev_iter_exit(struct class_dev_iter *iter);
int class_for_each_device(const struct class *class, const struct device *start, void *data,
int (*fn)(struct device *dev, void *data));
struct device *class_find_device(const struct class *class, const struct device *start,
const void *data, device_match_t match);
static inline struct device *class_find_device_by_name(const struct class *class,
const char *name)
{ … }
static inline struct device *class_find_device_by_of_node(const struct class *class,
const struct device_node *np)
{ … }
static inline struct device *class_find_device_by_fwnode(const struct class *class,
const struct fwnode_handle *fwnode)
{ … }
static inline struct device *class_find_device_by_devt(const struct class *class,
dev_t devt)
{ … }
#ifdef CONFIG_ACPI
struct acpi_device;
static inline struct device *class_find_device_by_acpi_dev(const struct class *class,
const struct acpi_device *adev)
{ … }
#else
static inline struct device *class_find_device_by_acpi_dev(const struct class *class,
const void *adev)
{
return NULL;
}
#endif
struct class_attribute { … };
#define CLASS_ATTR_RW(_name) …
#define CLASS_ATTR_RO(_name) …
#define CLASS_ATTR_WO(_name) …
int __must_check class_create_file_ns(const struct class *class, const struct class_attribute *attr,
const void *ns);
void class_remove_file_ns(const struct class *class, const struct class_attribute *attr,
const void *ns);
static inline int __must_check class_create_file(const struct class *class,
const struct class_attribute *attr)
{ … }
static inline void class_remove_file(const struct class *class,
const struct class_attribute *attr)
{ … }
struct class_attribute_string { … };
#define _CLASS_ATTR_STRING(_name, _mode, _str) …
#define CLASS_ATTR_STRING(_name, _mode, _str) …
ssize_t show_class_attr_string(const struct class *class, const struct class_attribute *attr,
char *buf);
struct class_interface { … };
int __must_check class_interface_register(struct class_interface *);
void class_interface_unregister(struct class_interface *);
struct class * __must_check class_create(const char *name);
void class_destroy(const struct class *cls);
#endif