On 19/05/2022 14:26, Marek Vasut wrote:
Convert driver to use this new helper to standardize
OF "data-lanes" parsing.

Reviewed-by: Dmitry Baryshkov <[email protected]>

Minor nit, if you resend this series for any reason: could you please follow the usual subject prefix for the msm driver: 'drm/msm: ....'


Signed-off-by: Marek Vasut <[email protected]>
Cc: Abhinav Kumar <[email protected]>
Cc: Andrzej Hajda <[email protected]>
Cc: Dmitry Baryshkov <[email protected]>
Cc: Laurent Pinchart <[email protected]>
Cc: Lucas Stach <[email protected]>
Cc: Maxime Ripard <[email protected]>
Cc: Rob Clark <[email protected]>
Cc: Robert Foss <[email protected]>
Cc: Sam Ravnborg <[email protected]>
Cc: Sean Paul <[email protected]>
To: [email protected]
---
  drivers/gpu/drm/msm/dp/dp_parser.c | 6 ++----
  drivers/gpu/drm/msm/dsi/dsi_host.c | 7 +++----
  2 files changed, 5 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/msm/dp/dp_parser.c 
b/drivers/gpu/drm/msm/dp/dp_parser.c
index 8f9fed9fdafc4..6ef919cda0f5c 100644
--- a/drivers/gpu/drm/msm/dp/dp_parser.c
+++ b/drivers/gpu/drm/msm/dp/dp_parser.c
@@ -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(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);
diff --git a/drivers/gpu/drm/msm/dsi/dsi_host.c 
b/drivers/gpu/drm/msm/dsi/dsi_host.c
index a95d5df52653c..a0c7d23cd4939 100644
--- a/drivers/gpu/drm/msm/dsi/dsi_host.c
+++ b/drivers/gpu/drm/msm/dsi/dsi_host.c
@@ -1779,11 +1779,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(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;


--
With best wishes
Dmitry

Reply via email to