summaryrefslogtreecommitdiff
path: root/drivers/tee
diff options
context:
space:
mode:
authorSudeep Holla <sudeep.holla@arm.com>2020-09-01 11:33:35 +0100
committerJens Wiklander <jens.wiklander@linaro.org>2020-09-18 10:44:45 +0200
commit8c05f50fe8452f9d3220efad77bef42c7b498193 (patch)
tree7adb2df26c08b39293d3872017d6d62813dbaf90 /drivers/tee
parentab3d8e1baaee4b167cc99120f640ee4de6d05d50 (diff)
tee: avoid explicit sysfs_create/delete_group by initialising dev->groups
If the dev->groups is initialised, the sysfs group is created as part of device_add call. There is no need to call sysfs_create/delete_group explicitly. Signed-off-by: Sudeep Holla <sudeep.holla@arm.com> Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
Diffstat (limited to 'drivers/tee')
-rw-r--r--drivers/tee/tee_core.c21
1 files changed, 4 insertions, 17 deletions
diff --git a/drivers/tee/tee_core.c b/drivers/tee/tee_core.c
index b4a8b362d78f..f77d64fafead 100644
--- a/drivers/tee/tee_core.c
+++ b/drivers/tee/tee_core.c
@@ -962,9 +962,7 @@ static struct attribute *tee_dev_attrs[] = {
NULL
};
-static const struct attribute_group tee_dev_group = {
- .attrs = tee_dev_attrs,
-};
+ATTRIBUTE_GROUPS(tee_dev);
/**
* tee_device_register() - Registers a TEE device
@@ -984,6 +982,8 @@ int tee_device_register(struct tee_device *teedev)
return -EINVAL;
}
+ teedev->dev.groups = tee_dev_groups;
+
rc = cdev_device_add(&teedev->cdev, &teedev->dev);
if (rc) {
dev_err(&teedev->dev,
@@ -993,19 +993,8 @@ int tee_device_register(struct tee_device *teedev)
return rc;
}
- rc = sysfs_create_group(&teedev->dev.kobj, &tee_dev_group);
- if (rc) {
- dev_err(&teedev->dev,
- "failed to create sysfs attributes, err=%d\n", rc);
- goto err_sysfs_create_group;
- }
-
teedev->flags |= TEE_DEVICE_FLAG_REGISTERED;
return 0;
-
-err_sysfs_create_group:
- cdev_device_del(&teedev->cdev, &teedev->dev);
- return rc;
}
EXPORT_SYMBOL_GPL(tee_device_register);
@@ -1048,10 +1037,8 @@ void tee_device_unregister(struct tee_device *teedev)
if (!teedev)
return;
- if (teedev->flags & TEE_DEVICE_FLAG_REGISTERED) {
- sysfs_remove_group(&teedev->dev.kobj, &tee_dev_group);
+ if (teedev->flags & TEE_DEVICE_FLAG_REGISTERED)
cdev_device_del(&teedev->cdev, &teedev->dev);
- }
tee_device_put(teedev);
wait_for_completion(&teedev->c_no_users);