[PATCH 1/2] bus: bt1-axi: use dev_groups to register attribute groups
From: Ovidiu Panait
Date: Mon Feb 24 2025 - 15:46:33 EST
Instead of manually adding/removing attribute groups, set dev_groups
pointer to have the driver core do it.
Signed-off-by: Ovidiu Panait <ovidiu.panait.oss@xxxxxxxxx>
---
drivers/bus/bt1-axi.c | 31 ++-----------------------------
1 file changed, 2 insertions(+), 29 deletions(-)
diff --git a/drivers/bus/bt1-axi.c b/drivers/bus/bt1-axi.c
index a5254c73bf43..240c7e77b35e 100644
--- a/drivers/bus/bt1-axi.c
+++ b/drivers/bus/bt1-axi.c
@@ -217,30 +217,6 @@ static struct attribute *bt1_axi_sysfs_attrs[] = {
};
ATTRIBUTE_GROUPS(bt1_axi_sysfs);
-static void bt1_axi_remove_sysfs(void *data)
-{
- struct bt1_axi *axi = data;
-
- device_remove_groups(axi->dev, bt1_axi_sysfs_groups);
-}
-
-static int bt1_axi_init_sysfs(struct bt1_axi *axi)
-{
- int ret;
-
- ret = device_add_groups(axi->dev, bt1_axi_sysfs_groups);
- if (ret) {
- dev_err(axi->dev, "Failed to add sysfs files group\n");
- return ret;
- }
-
- ret = devm_add_action_or_reset(axi->dev, bt1_axi_remove_sysfs, axi);
- if (ret)
- dev_err(axi->dev, "Can't add AXI EHB sysfs remove action\n");
-
- return ret;
-}
-
static int bt1_axi_probe(struct platform_device *pdev)
{
struct bt1_axi *axi;
@@ -266,10 +242,6 @@ static int bt1_axi_probe(struct platform_device *pdev)
if (ret)
return ret;
- ret = bt1_axi_init_sysfs(axi);
- if (ret)
- return ret;
-
return 0;
}
@@ -283,7 +255,8 @@ static struct platform_driver bt1_axi_driver = {
.probe = bt1_axi_probe,
.driver = {
.name = "bt1-axi",
- .of_match_table = bt1_axi_of_match
+ .of_match_table = bt1_axi_of_match,
+ .dev_groups = bt1_axi_sysfs_groups,
}
};
module_platform_driver(bt1_axi_driver);
--
2.48.1