#include <linux/device.h>
#include <linux/module.h>
#include <linux/string.h>
static struct kset *system_kset;
#define to_bus_attr(_attr) container_of(_attr, struct bus_attribute, attr)
#define to_drv_attr(_attr) container_of(_attr, struct driver_attribute, attr)
#define DRIVER_ATTR_IGNORE_LOCKDEP(_name, _mode, _show, _store) \
struct driver_attribute driver_attr_##_name = \
__ATTR_IGNORE_LOCKDEP(_name, _mode, _show, _store)
static int __must_check bus_rescan_devices_helper(struct device *dev,
static struct bus_type *bus_get(struct bus_type *bus)
kset_get(&bus->p->subsys);
static void bus_put(struct bus_type *bus)
kset_put(&bus->p->subsys);
static ssize_t drv_attr_show(struct kobject *kobj, struct attribute *attr,
struct driver_attribute *drv_attr = to_drv_attr(attr);
struct driver_private *drv_priv = to_driver(kobj);
ret = drv_attr->show(drv_priv->driver, buf);
static ssize_t drv_attr_store(struct kobject *kobj, struct attribute *attr,
const char *buf, size_t count)
struct driver_attribute *drv_attr = to_drv_attr(attr);
struct driver_private *drv_priv = to_driver(kobj);
ret = drv_attr->store(drv_priv->driver, buf, count);
static const struct sysfs_ops driver_sysfs_ops = {
static void driver_release(struct kobject *kobj)
struct driver_private *drv_priv = to_driver(kobj);
pr_debug("driver: '%s': %s\n", kobject_name(kobj), __func__);