Skip to contentSkip to conversation

drm: of: Mark empty drm_of_get_data_lanes_count and drm_of_get_data_lanes_ep static

PATCH In review Marek Vasut 3 participants 7 messages Jun 12, 2022

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/3 drm: of: Mark empty drm_of_get_data_lanes_count and drm_of_get_data_lanes_ep static

Mark empty implementations of drm_of_get_data_lanes_count and drm_of_get_data_lanes_ep as static inline, just like the rest of empty implementations of various functions in drm_of.h . Add missing comma to drm_of_get_data_lanes_count_ep() .

Fixes fc801750b197 ("drm: of: Add drm_of_get_data_lanes_count and drm_of_get_data_lanes_ep")
Cc Andrzej Hajda <[email protected]>
Cc Laurent Pinchart <[email protected]>
Cc Lucas Stach <[email protected]>
Cc Maxime Ripard <[email protected]>
Cc Robert Foss <[email protected]>
Cc Sam Ravnborg <[email protected]>

To: [email protected]

---
 include/drm/drm_of.h | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)
include/drm/drm_of.h +8 -6
index 92387eabcb6f0..10ab58c407467 100644
@@ -112,16 +112,18 @@ drm_of_lvds_get_data_mapping(const struct device_node *port)
 	return -EINVAL;
 }
 
-int drm_of_get_data_lanes_count(const struct device_node *endpoint,
-				const unsigned int min, const unsigned int max)
+static inline int
+drm_of_get_data_lanes_count(const struct device_node *endpoint,
+			    const unsigned int min, const unsigned int max)
 {
 	return -EINVAL;
 }
 
-int drm_of_get_data_lanes_count_ep(const struct device_node *port,
-				   int port_reg, int reg
-				   const unsigned int min,
-				   const unsigned int max)
+static inline int
+drm_of_get_data_lanes_count_ep(const struct device_node *port,
+			       int port_reg, int reg,
+			       const unsigned int min,
+			       const unsigned int max)
 {
 	return -EINVAL;
 }
Signature · 1 line
2.35.1
#1 lore raw

PATCH 2/3 drm/bridge: tc358775: Fix drm_of_get_data_lanes_count_ep conversion

Initialize dsi_lanes to -1, so that in case the endpoint is missing, probe would fail as it did before the conversion, instead of depending on uninitialized variable and thus undefined behavior.

Fixes 56426faa1492 ("drm/bridge: tc358775: Convert to drm_of_get_data_lanes_count_ep")
Cc Andrzej Hajda <[email protected]>
Cc Laurent Pinchart <[email protected]>
Cc Lucas Stach <[email protected]>
Cc Maxime Ripard <[email protected]>
Cc Robert Foss <[email protected]>
Cc Sam Ravnborg <[email protected]>

To: [email protected]

---
 drivers/gpu/drm/bridge/tc358775.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/bridge/tc358775.c +1 -1
index 5b1fb8e2f9a7d..e5d00a6e7880b 100644
@@ -529,7 +529,7 @@ static int tc358775_parse_dt(struct device_node *np, struct tc_data *tc)
 	struct device_node *endpoint;
 	struct device_node *parent;
 	struct device_node *remote;
-	int dsi_lanes;
+	int dsi_lanes = -1;
 
 	/*
 	 * To get the data-lanes of dsi, we need to access the dsi0_out of port1
Signature · 1 line
2.35.1
Acked-by on v1 2/3
#2 lore raw

Re: [PATCH 2/3] drm/bridge: tc358775: Fix drm_of_get_data_lanes_count_ep conversion

Quoted 13 lines · Marek Vasut

Initialize dsi_lanes to -1, so that in case the endpoint is missing, probe would fail as it did before the conversion, instead of depending on uninitialized variable and thus undefined behavior.

Fixes 56426faa1492 ("drm/bridge: tc358775: Convert to drm_of_get_data_lanes_count_ep")
Cc Andrzej Hajda <[email protected]>
Cc Laurent Pinchart <[email protected]>
Cc Lucas Stach <[email protected]>
Cc Maxime Ripard <[email protected]>
Cc Robert Foss <[email protected]>
Cc Sam Ravnborg <[email protected]>
Quoted 1 line

To: [email protected]

#3 lore raw

PATCH 3/3 drm/bridge: rcar: Drop unused variables due to drm_of_get_data_lanes_count_ep

In reply to Marek Vasut

The rcar_mipi_dsi_parse_dt() now contains two uninitialized variables due to conversion to common drm_of_get_data_lanes_count_ep() helper. Drop them.

Fixes d643daaf1694 ("drm/bridge: rcar: Convert to drm_of_get_data_lanes_count_ep")
Cc Andrzej Hajda <[email protected]>
Cc Laurent Pinchart <[email protected]>
Cc Lucas Stach <[email protected]>
Cc Maxime Ripard <[email protected]>
Cc Robert Foss <[email protected]>
Cc Sam Ravnborg <[email protected]>

To: [email protected]

---
 drivers/gpu/drm/rcar-du/rcar_mipi_dsi.c | 2 --
 1 file changed, 2 deletions(-)
drivers/gpu/drm/rcar-du/rcar_mipi_dsi.c +0 -2
index 67dce337098a5..31ed285073e0f 100644
@@ -679,8 +679,6 @@ static const struct mipi_dsi_host_ops rcar_mipi_dsi_host_ops = {
 
 static int rcar_mipi_dsi_parse_dt(struct rcar_mipi_dsi *dsi)
 {
-	struct device_node *ep;
-	u32 data_lanes[4];
 	int ret;
 
 	ret = drm_of_get_data_lanes_count_ep(dsi->dev->of_node, 1, 0, 1, 4);
Signature · 1 line
2.35.1
Acked-by on v1 3/3
#4 lore raw

Re: [PATCH 3/3] drm/bridge: rcar: Drop unused variables due to drm_of_get_data_lanes_count_ep

Quoted 13 lines · Marek Vasut

The rcar_mipi_dsi_parse_dt() now contains two uninitialized variables due to conversion to common drm_of_get_data_lanes_count_ep() helper. Drop them.

Fixes d643daaf1694 ("drm/bridge: rcar: Convert to drm_of_get_data_lanes_count_ep")
Cc Andrzej Hajda <[email protected]>
Cc Laurent Pinchart <[email protected]>
Cc Lucas Stach <[email protected]>
Cc Maxime Ripard <[email protected]>
Cc Robert Foss <[email protected]>
Cc Sam Ravnborg <[email protected]>
Quoted 1 line

To: [email protected]

Acked-by on v1 1/3
#5 lore raw
In reply to Marek Vasut
Quoted 14 lines · Marek Vasut

Mark empty implementations of drm_of_get_data_lanes_count and drm_of_get_data_lanes_ep as static inline, just like the rest of empty implementations of various functions in drm_of.h . Add missing comma to drm_of_get_data_lanes_count_ep() .

Fixes fc801750b197 ("drm: of: Add drm_of_get_data_lanes_count and drm_of_get_data_lanes_ep")
Cc Andrzej Hajda <[email protected]>
Cc Laurent Pinchart <[email protected]>
Cc Lucas Stach <[email protected]>
Cc Maxime Ripard <[email protected]>
Cc Robert Foss <[email protected]>
Cc Sam Ravnborg <[email protected]>
Quoted 1 line

To: [email protected]

reviewer Reviewed-by on v1 1/3
#6 lore raw
In reply to Marek Vasut

Hi Marek,

Thank you for the patch.

Quoted 14 lines · Marek Vasut

Mark empty implementations of drm_of_get_data_lanes_count and drm_of_get_data_lanes_ep as static inline, just like the rest of empty implementations of various functions in drm_of.h . Add missing comma to drm_of_get_data_lanes_count_ep() .

Fixes fc801750b197 ("drm: of: Add drm_of_get_data_lanes_count and drm_of_get_data_lanes_ep")
Cc Andrzej Hajda <[email protected]>
Cc Laurent Pinchart <[email protected]>
Cc Lucas Stach <[email protected]>
Cc Maxime Ripard <[email protected]>
Cc Robert Foss <[email protected]>
Cc Sam Ravnborg <[email protected]>
Quoted 1 line

To: [email protected]

Quoted 9 lines
---
 include/drm/drm_of.h | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)
include/drm/drm_of.h +0 -0
index 92387eabcb6f0..10ab58c407467 100644

include/drm/drm_of.h drm_of_lvds_get_data_mapping(const struct device_node *port) · line 117

Quoted 8 lines
include/drm/drm_of.h +3 -2
@@ -112,16 +112,18 @@ drm_of_lvds_get_data_mapping(const struct device_node *port)
 	return -EINVAL;
 }
 
-int drm_of_get_data_lanes_count(const struct device_node *endpoint,
-				const unsigned int min, const unsigned int max)
+static inline int
+drm_of_get_data_lanes_count(const struct device_node *endpoint,
+			    const unsigned int min, const unsigned int max)

Unrelated to this patch, do we need "const" for the unsigned int arguments ?

Quoted 16 lines
include/drm/drm_of.h +5 -4
 {
 	return -EINVAL;
 }
 
-int drm_of_get_data_lanes_count_ep(const struct device_node *port,
-				   int port_reg, int reg
-				   const unsigned int min,
-				   const unsigned int max)
+static inline int
+drm_of_get_data_lanes_count_ep(const struct device_node *port,
+			       int port_reg, int reg,
+			       const unsigned int min,
+			       const unsigned int max)
 {
 	return -EINVAL;
 }
Signature · 3 lines
Regards,

Laurent Pinchart