Under the hood, the LDM relies on three important structures, which are kobject, kobj_type, and kset. Let us see how each of these structures are involved in the device model.
Deep inside LDM
kobject structure
kobject is the core of the device model, running behind the scenes. It brings an OO-like programming style to the kernel, and is mainly used for reference counting and to expose devices hierarchies and relationships between them. kobjects introduce the concept of encapsulation of common object properties, such as usage reference counts:
struct kobject { const char *name; struct list_head entry; struct kobject *parent; struct kset *kset; struct kobj_type *ktype; struct sysfs_dirent *sd; ...