From 3b76287ce88b6e55b6144b5783473d2beeae4380 Mon Sep 17 00:00:00 2001 From: Bjorn Andersson Date: Thu, 28 Mar 2024 07:40:00 -0700 Subject: drm/msm/dp: Drop unused dp_debug struct The members of struct dp_debug are no longer used, so the only purpose of this struct is as a type of the return value of dp_debug_get(), to signal success/error. Drop the struct in favor of signalling the result of initialization using an int, then merge dp_debug_get() with dp_debug_init() to avoid the unnecessar boilerplate code. Signed-off-by: Bjorn Andersson Reviewed-by: Dmitry Baryshkov Patchwork: https://patchwork.freedesktop.org/patch/585343/ Link: https://lore.kernel.org/r/20240328-msm-dp-cleanup-v2-1-a5aed9798d32@quicinc.com Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/msm/dp/dp_debug.c | 59 ++++++++++++--------------------------- 1 file changed, 18 insertions(+), 41 deletions(-) (limited to 'drivers/gpu/drm/msm/dp/dp_debug.c') diff --git a/drivers/gpu/drm/msm/dp/dp_debug.c b/drivers/gpu/drm/msm/dp/dp_debug.c index eca5a02f9003..b8611f6d2296 100644 --- a/drivers/gpu/drm/msm/dp/dp_debug.c +++ b/drivers/gpu/drm/msm/dp/dp_debug.c @@ -21,8 +21,6 @@ struct dp_debug_private { struct dp_link *link; struct dp_panel *panel; struct drm_connector *connector; - - struct dp_debug dp_debug; }; static int dp_debug_show(struct seq_file *seq, void *p) @@ -199,10 +197,24 @@ static const struct file_operations test_active_fops = { .write = dp_test_active_write }; -static void dp_debug_init(struct dp_debug *dp_debug, struct dentry *root, bool is_edp) +int dp_debug_init(struct device *dev, struct dp_panel *panel, + struct dp_link *link, + struct drm_connector *connector, + struct dentry *root, bool is_edp) { - struct dp_debug_private *debug = container_of(dp_debug, - struct dp_debug_private, dp_debug); + struct dp_debug_private *debug; + + if (!dev || !panel || !link) { + DRM_ERROR("invalid input\n"); + return -EINVAL; + } + + debug = devm_kzalloc(dev, sizeof(*debug), GFP_KERNEL); + if (!debug) + return -ENOMEM; + + debug->link = link; + debug->panel = panel; debugfs_create_file("dp_debug", 0444, root, debug, &dp_debug_fops); @@ -220,41 +232,6 @@ static void dp_debug_init(struct dp_debug *dp_debug, struct dentry *root, bool i root, debug, &dp_test_type_fops); } -} -struct dp_debug *dp_debug_get(struct device *dev, struct dp_panel *panel, - struct dp_link *link, - struct drm_connector *connector, - struct dentry *root, bool is_edp) -{ - struct dp_debug_private *debug; - struct dp_debug *dp_debug; - int rc; - - if (!dev || !panel || !link) { - DRM_ERROR("invalid input\n"); - rc = -EINVAL; - goto error; - } - - debug = devm_kzalloc(dev, sizeof(*debug), GFP_KERNEL); - if (!debug) { - rc = -ENOMEM; - goto error; - } - - debug->dp_debug.debug_en = false; - debug->link = link; - debug->panel = panel; - - dp_debug = &debug->dp_debug; - dp_debug->vdisplay = 0; - dp_debug->hdisplay = 0; - dp_debug->vrefresh = 0; - - dp_debug_init(dp_debug, root, is_edp); - - return dp_debug; - error: - return ERR_PTR(rc); + return 0; } -- cgit v1.2.3