/* Most subsystems have a set of default attributes that are associated with an object that registers with them. This is a helper called during object registration that loops through the default attributes of the subsystem and creates attributes files for them in sysfs.  */
static int populate_dir(struct kobject *kobj)
/* Most subsystems have a set of default attributes that are associated with an object that registers with them. This is a helper called during object registration that loops through the default attributes of the subsystem and creates attributes files for them in sysfs.  */
static int populate_dir(struct kobject *kobj)
{
	struct kobj_type *t = get_ktype(kobj);
	struct attribute *attr;
	int error = 0;
	int i;
	if (t && t->default_attrs) {
		for (i = 0; (attr = t->default_attrs[i]) != NULL; i++) {
			error = sysfs_create_file(kobj, attr);
			if (error)
				break;
		}
	}
	return error;
}