]> git.baikalelectronics.ru Git - kernel.git/commitdiff
drm/msm: Convert to drm_of_get_data_lanes_count
authorMarek Vasut <marex@denx.de>
Tue, 24 May 2022 01:05:21 +0000 (03:05 +0200)
committerMarek Vasut <marex@denx.de>
Sun, 12 Jun 2022 10:22:26 +0000 (12:22 +0200)
Convert driver to use this new helper to standardize
OF "data-lanes" parsing.

Reviewed-by: Andrzej Hajda <andrzej.hajda@intel.com>
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Abhinav Kumar <quic_abhinavk@quicinc.com>
Cc: Andrzej Hajda <andrzej.hajda@intel.com>
Cc: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: Lucas Stach <l.stach@pengutronix.de>
Cc: Maxime Ripard <maxime@cerno.tech>
Cc: Rob Clark <robdclark@gmail.com>
Cc: Robert Foss <robert.foss@linaro.org>
Cc: Sam Ravnborg <sam@ravnborg.org>
Cc: Sean Paul <sean@poorly.run>
To: dri-devel@lists.freedesktop.org
Reviewed-by: Abhinav Kumar <quic_abhinavk@quicinc.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20220524010522.528569-10-marex@denx.de
drivers/gpu/drm/msm/dp/dp_parser.c
drivers/gpu/drm/msm/dsi/dsi_host.c

index 1056b8d5755b3cff237b157134d960ea4406695a..fabd18e7dc0d8b4243e77334f25cbdcde59dc4b0 100644 (file)
@@ -102,11 +102,9 @@ static int dp_parser_ctrl_res(struct dp_parser *parser)
 static int dp_parser_misc(struct dp_parser *parser)
 {
        struct device_node *of_node = parser->pdev->dev.of_node;
-       int len = 0;
-       const char *data_lane_property = "data-lanes";
+       int len;
 
-       len = of_property_count_elems_of_size(of_node,
-                        data_lane_property, sizeof(u32));
+       len = drm_of_get_data_lanes_count(of_node, 1, DP_MAX_NUM_DP_LANES);
        if (len < 0) {
                DRM_WARN("Invalid property %s, default max DP lanes = %d\n",
                                data_lane_property, DP_MAX_NUM_DP_LANES);
index d51e70fab93db736724bdb3b937add01b0bc2910..63969e464dbeaf9ffe934e53b175f65290592cd4 100644 (file)
@@ -1673,11 +1673,10 @@ static int dsi_host_parse_lane_data(struct msm_dsi_host *msm_host,
                return 0;
        }
 
-       num_lanes = len / sizeof(u32);
-
-       if (num_lanes < 1 || num_lanes > 4) {
+       num_lanes = drm_of_get_data_lanes_count(ep, 1, 4);
+       if (num_lanes < 0) {
                DRM_DEV_ERROR(dev, "bad number of data lanes\n");
-               return -EINVAL;
+               return num_lanes;
        }
 
        msm_host->num_data_lanes = num_lanes;