Skip to content

Commit d397965

Browse files
Evgeny Bachininsuperna9999
authored andcommitted
firmware: meson_sm: refactor serial sysfs entry via dev_groups attrs
Introduce just another way to register sysfs serial entry: the less code, the better in the absence of extra error-paths Signed-off-by: Evgeny Bachinin <EABachinin@salutedevices.com> Acked-by: Neil Armstrong <neil.armstrong@linaro.org> Link: https://lore.kernel.org/r/20231108125604.162383-2-EABachinin@salutedevices.com Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
1 parent b85ea95 commit d397965

1 file changed

Lines changed: 3 additions & 8 deletions

File tree

drivers/firmware/meson/meson_sm.c

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -274,14 +274,11 @@ static ssize_t serial_show(struct device *dev, struct device_attribute *attr,
274274

275275
static DEVICE_ATTR_RO(serial);
276276

277-
static struct attribute *meson_sm_sysfs_attributes[] = {
277+
static struct attribute *meson_sm_sysfs_attrs[] = {
278278
&dev_attr_serial.attr,
279279
NULL,
280280
};
281-
282-
static const struct attribute_group meson_sm_sysfs_attr_group = {
283-
.attrs = meson_sm_sysfs_attributes,
284-
};
281+
ATTRIBUTE_GROUPS(meson_sm_sysfs);
285282

286283
static const struct of_device_id meson_sm_ids[] = {
287284
{ .compatible = "amlogic,meson-gxbb-sm", .data = &gxbb_chip },
@@ -323,9 +320,6 @@ static int __init meson_sm_probe(struct platform_device *pdev)
323320
if (devm_of_platform_populate(dev))
324321
goto out_in_base;
325322

326-
if (sysfs_create_group(&pdev->dev.kobj, &meson_sm_sysfs_attr_group))
327-
goto out_in_base;
328-
329323
pr_info("secure-monitor enabled\n");
330324

331325
return 0;
@@ -340,6 +334,7 @@ static struct platform_driver meson_sm_driver = {
340334
.driver = {
341335
.name = "meson-sm",
342336
.of_match_table = of_match_ptr(meson_sm_ids),
337+
.dev_groups = meson_sm_sysfs_groups,
343338
},
344339
};
345340
module_platform_driver_probe(meson_sm_driver, meson_sm_probe);

0 commit comments

Comments
 (0)