Skip to content

Commit 21d456a

Browse files
committed
drm/malidp: convert platform driver to use dev_groups
Platform drivers now have the option to have the platform core create and remove any needed sysfs attribute files. So take advantage of that and do not register "by hand" a sysfs file. Cc: Liviu Dudau <[email protected]> Cc: Brian Starkey <[email protected]> Cc: Mali DP Maintainers <[email protected]> Cc: [email protected] Signed-off-by: Emil Velikov <[email protected]> Tested-by: Liviu Dudau <[email protected]> Acked-by: Liviu Dudau <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent 0f53f2d commit 21d456a

File tree

1 file changed

+6
-21
lines changed

1 file changed

+6
-21
lines changed

drivers/gpu/drm/arm/malidp_drv.c

Lines changed: 6 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -657,20 +657,11 @@ static ssize_t core_id_show(struct device *dev, struct device_attribute *attr,
657657

658658
static DEVICE_ATTR_RO(core_id);
659659

660-
static int malidp_init_sysfs(struct device *dev)
661-
{
662-
int ret = device_create_file(dev, &dev_attr_core_id);
663-
664-
if (ret)
665-
DRM_ERROR("failed to create device file for core_id\n");
666-
667-
return ret;
668-
}
669-
670-
static void malidp_fini_sysfs(struct device *dev)
671-
{
672-
device_remove_file(dev, &dev_attr_core_id);
673-
}
660+
static struct attribute *mali_dp_attrs[] = {
661+
&dev_attr_core_id.attr,
662+
NULL,
663+
};
664+
ATTRIBUTE_GROUPS(mali_dp);
674665

675666
#define MAX_OUTPUT_CHANNELS 3
676667

@@ -832,10 +823,6 @@ static int malidp_bind(struct device *dev)
832823
if (ret < 0)
833824
goto query_hw_fail;
834825

835-
ret = malidp_init_sysfs(dev);
836-
if (ret)
837-
goto init_fail;
838-
839826
/* Set the CRTC's port so that the encoder component can find it */
840827
malidp->crtc.port = of_graph_get_port_by_id(dev->of_node, 0);
841828

@@ -893,8 +880,6 @@ static int malidp_bind(struct device *dev)
893880
bind_fail:
894881
of_node_put(malidp->crtc.port);
895882
malidp->crtc.port = NULL;
896-
init_fail:
897-
malidp_fini_sysfs(dev);
898883
malidp_fini(drm);
899884
query_hw_fail:
900885
pm_runtime_put(dev);
@@ -927,7 +912,6 @@ static void malidp_unbind(struct device *dev)
927912
component_unbind_all(dev, drm);
928913
of_node_put(malidp->crtc.port);
929914
malidp->crtc.port = NULL;
930-
malidp_fini_sysfs(dev);
931915
malidp_fini(drm);
932916
pm_runtime_put(dev);
933917
if (pm_runtime_enabled(dev))
@@ -1023,6 +1007,7 @@ static struct platform_driver malidp_platform_driver = {
10231007
.name = "mali-dp",
10241008
.pm = &malidp_pm_ops,
10251009
.of_match_table = malidp_drm_of_match,
1010+
.dev_groups = mali_dp_groups,
10261011
},
10271012
};
10281013

0 commit comments

Comments
 (0)