diff mbox series

[10/11] drm/bridge: msm: Convert to drm_of_get_data_lanes

Message ID 20220519112657.62283-10-marex@denx.de (mailing list archive)
State New, archived
Headers show
Series [01/11] drm: of: Add drm_of_get_data_lanes and drm_of_get_data_lanes_ep | expand

Commit Message

Marek Vasut May 19, 2022, 11:26 a.m. UTC
Convert driver to use this new helper to standardize
OF "data-lanes" parsing.

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
---
 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(-)

Comments

Dmitry Baryshkov May 19, 2022, 11:43 a.m. UTC | #1
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 <dmitry.baryshkov@linaro.org>

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 <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
> ---
>   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;
Marek Vasut May 19, 2022, 11:52 a.m. UTC | #2
On 5/19/22 13:43, Dmitry Baryshkov wrote:
> 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 <dmitry.baryshkov@linaro.org>

Can you please also test it, that it does not break anything ?

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

Will do
diff mbox series

Patch

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;