/* sysfs_chmod_file - update the modified mode value on an object attribute. @kobj: object we're acting for. @attr: attribute descriptor. @mode: file permissions.  */
int sysfs_chmod_file(struct kobject *kobj, struct attribute *attr, mode_t mode)
/* sysfs_chmod_file - update the modified mode value on an object attribute. @kobj: object we're acting for. @attr: attribute descriptor. @mode: file permissions.  */
int sysfs_chmod_file(struct kobject *kobj, struct attribute *attr, mode_t mode)
{
	struct sysfs_dirent *sd;
	struct iattr newattrs;
	int rc;
	mutex_lock(&sysfs_mutex);
	rc = -ENOENT;
	sd = sysfs_find_dirent(kobj->sd, attr->name);
	if (!sd)
		goto out;
	newattrs.ia_mode = (mode & S_IALLUGO) | (sd->s_mode & ~S_IALLUGO);
	newattrs.ia_valid = ATTR_MODE;
	rc = sysfs_sd_setattr(sd, &newattrs);
 out:
	mutex_unlock(&sysfs_mutex);
	return rc;
}