Changeset View
Changeset View
Standalone View
Standalone View
sys/compat/linuxkpi/common/include/linux/device.h
Show First 20 Lines • Show All 51 Lines • ▼ Show 20 Lines | struct class { | ||||
const char *name; | const char *name; | ||||
struct module *owner; | struct module *owner; | ||||
struct kobject kobj; | struct kobject kobj; | ||||
devclass_t bsdclass; | devclass_t bsdclass; | ||||
const struct dev_pm_ops *pm; | const struct dev_pm_ops *pm; | ||||
void (*class_release)(struct class *class); | void (*class_release)(struct class *class); | ||||
void (*dev_release)(struct device *dev); | void (*dev_release)(struct device *dev); | ||||
char * (*devnode)(struct device *dev, umode_t *mode); | char * (*devnode)(struct device *dev, umode_t *mode); | ||||
const struct attribute_group **dev_groups; | |||||
}; | }; | ||||
struct dev_pm_ops { | struct dev_pm_ops { | ||||
int (*prepare)(struct device *dev); | int (*prepare)(struct device *dev); | ||||
int (*suspend)(struct device *dev); | int (*suspend)(struct device *dev); | ||||
int (*suspend_late)(struct device *dev); | int (*suspend_late)(struct device *dev); | ||||
int (*resume)(struct device *dev); | int (*resume)(struct device *dev); | ||||
int (*resume_early)(struct device *dev); | int (*resume_early)(struct device *dev); | ||||
▲ Show 20 Lines • Show All 350 Lines • ▼ Show 20 Lines | if (bsddev != NULL) { | ||||
if (dev->devt == 0) | if (dev->devt == 0) | ||||
dev->devt = makedev(0, device_get_unit(bsddev)); | dev->devt = makedev(0, device_get_unit(bsddev)); | ||||
device_set_softc(bsddev, dev); | device_set_softc(bsddev, dev); | ||||
} | } | ||||
dev->bsddev = bsddev; | dev->bsddev = bsddev; | ||||
done: | done: | ||||
kobject_init(&dev->kobj, &linux_dev_ktype); | kobject_init(&dev->kobj, &linux_dev_ktype); | ||||
kobject_add(&dev->kobj, &dev->class->kobj, dev_name(dev)); | kobject_add(&dev->kobj, &dev->class->kobj, dev_name(dev)); | ||||
if (dev->class->dev_groups) | |||||
return (sysfs_create_groups(&dev->kobj, dev->class->dev_groups)); | |||||
return (0); | return (0); | ||||
} | } | ||||
static inline void | static inline void | ||||
device_unregister(struct device *dev) | device_unregister(struct device *dev) | ||||
{ | { | ||||
device_t bsddev; | device_t bsddev; | ||||
▲ Show 20 Lines • Show All 124 Lines • Show Last 20 Lines |