Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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 <quic_bjorande@quicinc.com>
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
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 <dmitry.baryshkov@linaro.org>

authored by

Bjorn Andersson and committed by
Dmitry Baryshkov
3b76287c 775ce4ba

+31 -76
+18 -41
drivers/gpu/drm/msm/dp/dp_debug.c
··· 21 21 struct dp_link *link; 22 22 struct dp_panel *panel; 23 23 struct drm_connector *connector; 24 - 25 - struct dp_debug dp_debug; 26 24 }; 27 25 28 26 static int dp_debug_show(struct seq_file *seq, void *p) ··· 197 199 .write = dp_test_active_write 198 200 }; 199 201 200 - static void dp_debug_init(struct dp_debug *dp_debug, struct dentry *root, bool is_edp) 202 + int dp_debug_init(struct device *dev, struct dp_panel *panel, 203 + struct dp_link *link, 204 + struct drm_connector *connector, 205 + struct dentry *root, bool is_edp) 201 206 { 202 - struct dp_debug_private *debug = container_of(dp_debug, 203 - struct dp_debug_private, dp_debug); 207 + struct dp_debug_private *debug; 208 + 209 + if (!dev || !panel || !link) { 210 + DRM_ERROR("invalid input\n"); 211 + return -EINVAL; 212 + } 213 + 214 + debug = devm_kzalloc(dev, sizeof(*debug), GFP_KERNEL); 215 + if (!debug) 216 + return -ENOMEM; 217 + 218 + debug->link = link; 219 + debug->panel = panel; 204 220 205 221 debugfs_create_file("dp_debug", 0444, root, 206 222 debug, &dp_debug_fops); ··· 232 220 root, 233 221 debug, &dp_test_type_fops); 234 222 } 235 - } 236 223 237 - struct dp_debug *dp_debug_get(struct device *dev, struct dp_panel *panel, 238 - struct dp_link *link, 239 - struct drm_connector *connector, 240 - struct dentry *root, bool is_edp) 241 - { 242 - struct dp_debug_private *debug; 243 - struct dp_debug *dp_debug; 244 - int rc; 245 - 246 - if (!dev || !panel || !link) { 247 - DRM_ERROR("invalid input\n"); 248 - rc = -EINVAL; 249 - goto error; 250 - } 251 - 252 - debug = devm_kzalloc(dev, sizeof(*debug), GFP_KERNEL); 253 - if (!debug) { 254 - rc = -ENOMEM; 255 - goto error; 256 - } 257 - 258 - debug->dp_debug.debug_en = false; 259 - debug->link = link; 260 - debug->panel = panel; 261 - 262 - dp_debug = &debug->dp_debug; 263 - dp_debug->vdisplay = 0; 264 - dp_debug->hdisplay = 0; 265 - dp_debug->vrefresh = 0; 266 - 267 - dp_debug_init(dp_debug, root, is_edp); 268 - 269 - return dp_debug; 270 - error: 271 - return ERR_PTR(rc); 224 + return 0; 272 225 }
+11 -27
drivers/gpu/drm/msm/dp/dp_debug.h
··· 9 9 #include "dp_panel.h" 10 10 #include "dp_link.h" 11 11 12 - /** 13 - * struct dp_debug 14 - * @debug_en: specifies whether debug mode enabled 15 - * @vdisplay: used to filter out vdisplay value 16 - * @hdisplay: used to filter out hdisplay value 17 - * @vrefresh: used to filter out vrefresh value 18 - * @tpg_state: specifies whether tpg feature is enabled 19 - */ 20 - struct dp_debug { 21 - bool debug_en; 22 - int aspect_ratio; 23 - int vdisplay; 24 - int hdisplay; 25 - int vrefresh; 26 - }; 27 - 28 12 #if defined(CONFIG_DEBUG_FS) 29 13 30 14 /** ··· 25 41 * This function sets up the debug module and provides a way 26 42 * for debugfs input to be communicated with existing modules 27 43 */ 28 - struct dp_debug *dp_debug_get(struct device *dev, struct dp_panel *panel, 29 - struct dp_link *link, 30 - struct drm_connector *connector, 31 - struct dentry *root, 32 - bool is_edp); 44 + int dp_debug_init(struct device *dev, struct dp_panel *panel, 45 + struct dp_link *link, 46 + struct drm_connector *connector, 47 + struct dentry *root, 48 + bool is_edp); 33 49 34 50 #else 35 51 36 52 static inline 37 - struct dp_debug *dp_debug_get(struct device *dev, struct dp_panel *panel, 38 - struct dp_link *link, 39 - struct drm_connector *connector, 40 - struct dentry *root, 41 - bool is_edp) 53 + int dp_debug_init(struct device *dev, struct dp_panel *panel, 54 + struct dp_link *link, 55 + struct drm_connector *connector, 56 + struct dentry *root, 57 + bool is_edp) 42 58 { 43 - return ERR_PTR(-EINVAL); 59 + return -EINVAL; 44 60 } 45 61 46 62 #endif /* defined(CONFIG_DEBUG_FS) */
+2 -8
drivers/gpu/drm/msm/dp/dp_display.c
··· 93 93 struct dp_link *link; 94 94 struct dp_panel *panel; 95 95 struct dp_ctrl *ctrl; 96 - struct dp_debug *debug; 97 96 98 97 struct dp_display_mode dp_mode; 99 98 struct msm_dp dp_display; ··· 1458 1459 dp = container_of(dp_display, struct dp_display_private, dp_display); 1459 1460 dev = &dp->dp_display.pdev->dev; 1460 1461 1461 - dp->debug = dp_debug_get(dev, dp->panel, 1462 - dp->link, dp->dp_display.connector, 1463 - root, is_edp); 1464 - if (IS_ERR(dp->debug)) { 1465 - rc = PTR_ERR(dp->debug); 1462 + rc = dp_debug_init(dev, dp->panel, dp->link, dp->dp_display.connector, root, is_edp); 1463 + if (rc) 1466 1464 DRM_ERROR("failed to initialize debug, rc = %d\n", rc); 1467 - dp->debug = NULL; 1468 - } 1469 1465 } 1470 1466 1471 1467 int msm_dp_modeset_init(struct msm_dp *dp_display, struct drm_device *dev,