Commit 185443ef authored by Marek Vasut's avatar Marek Vasut

drm/msm: Convert to drm_of_get_data_lanes_count

Convert driver to use this new helper to standardize
OF "data-lanes" parsing.
Reviewed-by: default avatarAndrzej Hajda <andrzej.hajda@intel.com>
Reviewed-by: default avatarDmitry Baryshkov <dmitry.baryshkov@linaro.org>
Signed-off-by: default avatarMarek 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: default avatarAbhinav Kumar <quic_abhinavk@quicinc.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20220524010522.528569-10-marex@denx.de
parent 254a8d0c
...@@ -102,11 +102,9 @@ static int dp_parser_ctrl_res(struct dp_parser *parser) ...@@ -102,11 +102,9 @@ static int dp_parser_ctrl_res(struct dp_parser *parser)
static int dp_parser_misc(struct dp_parser *parser) static int dp_parser_misc(struct dp_parser *parser)
{ {
struct device_node *of_node = parser->pdev->dev.of_node; struct device_node *of_node = parser->pdev->dev.of_node;
int len = 0; int len;
const char *data_lane_property = "data-lanes";
len = of_property_count_elems_of_size(of_node, len = drm_of_get_data_lanes_count(of_node, 1, DP_MAX_NUM_DP_LANES);
data_lane_property, sizeof(u32));
if (len < 0) { if (len < 0) {
DRM_WARN("Invalid property %s, default max DP lanes = %d\n", DRM_WARN("Invalid property %s, default max DP lanes = %d\n",
data_lane_property, DP_MAX_NUM_DP_LANES); data_lane_property, DP_MAX_NUM_DP_LANES);
......
...@@ -1673,11 +1673,10 @@ static int dsi_host_parse_lane_data(struct msm_dsi_host *msm_host, ...@@ -1673,11 +1673,10 @@ static int dsi_host_parse_lane_data(struct msm_dsi_host *msm_host,
return 0; return 0;
} }
num_lanes = len / sizeof(u32); num_lanes = drm_of_get_data_lanes_count(ep, 1, 4);
if (num_lanes < 0) {
if (num_lanes < 1 || num_lanes > 4) {
DRM_DEV_ERROR(dev, "bad number of data lanes\n"); DRM_DEV_ERROR(dev, "bad number of data lanes\n");
return -EINVAL; return num_lanes;
} }
msm_host->num_data_lanes = num_lanes; msm_host->num_data_lanes = num_lanes;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment