如果需要遍历top_kset低两级的kset, 仅需
list_for_each_entry(...){
list_for_each_entry(....)
}
系统设备架构图
1)遍历所有的系统设备类:
list_for_each_entry(cls, &system_kset->list,kset.kobject.entry)
2)遍历系统设备类cls所有的驱动、设备
list_for_each_entry(sysdev, &cls->kset.list, kobject.entry)
list_for_each_entry(drv, &cls->drivers,drivers.entry)
3)遍历所有的系统设备、驱动
list_for_each_entry(cls, &system_kset->list, kset.kobject.entry){
struct sys_device *sysdev;
list_for_each_entry(sysdev, &cls->kset.list, kobject).entry
}