diff mbox series

[10/24] drm/omap: dss: Remove display ordering from dss/display.c

Message ID 1518428694-18018-11-git-send-email-tomi.valkeinen@ti.com
State Accepted
Commit 36c61ae2b755f1b64d5adcf43bb32932dcc4c330
Headers show
Series drm/omap: misc patches | expand

Commit Message

Tomi Valkeinen Feb. 12, 2018, 9:44 a.m. UTC
From: Peter Ujfalusi <peter.ujfalusi@ti.com>

The previous patch implements the ordering of the dss_devices based on DT
aliases in omap_drm.c, so there is no need to do the ordering in
dss/display.c anymore.

At the same time remove the alias member of the omap_dss_device struct
since it is no longer needed. The only place it was used is in the
omapdss_register_display() function.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
 drivers/gpu/drm/omapdrm/dss/display.c | 15 +++------------
 drivers/gpu/drm/omapdrm/dss/omapdss.h |  2 --
 2 files changed, 3 insertions(+), 14 deletions(-)

Comments

Laurent Pinchart Feb. 27, 2018, 1:30 p.m. UTC | #1
Hi Tomi,

Thank you for the patch.

On Monday, 12 February 2018 11:44:40 EET Tomi Valkeinen wrote:
> From: Peter Ujfalusi <peter.ujfalusi@ti.com>
> 
> The previous patch implements the ordering of the dss_devices based on DT
> aliases in omap_drm.c, so there is no need to do the ordering in
> dss/display.c anymore.
> 
> At the same time remove the alias member of the omap_dss_device struct
> since it is no longer needed. The only place it was used is in the
> omapdss_register_display() function.
> 
> Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
> ---
>  drivers/gpu/drm/omapdrm/dss/display.c | 15 +++------------
>  drivers/gpu/drm/omapdrm/dss/omapdss.h |  2 --
>  2 files changed, 3 insertions(+), 14 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/dss/display.c
> b/drivers/gpu/drm/omapdrm/dss/display.c index 3ef99f344bd3..7840837f4325
> 100644
> --- a/drivers/gpu/drm/omapdrm/dss/display.c
> +++ b/drivers/gpu/drm/omapdrm/dss/display.c
> @@ -41,7 +41,6 @@ static int disp_num_counter;
>  int omapdss_register_display(struct omap_dss_device *dssdev)
>  {
>  	struct omap_dss_driver *drv = dssdev->driver;
> -	struct list_head *cur;
>  	int id;
> 
>  	/*
> @@ -54,26 +53,18 @@ int omapdss_register_display(struct omap_dss_device
> *dssdev)
> 
>  	dssdev->alias_id = id;
> 
> -	snprintf(dssdev->alias, sizeof(dssdev->alias), "display%d", id);
> -
>  	/* Use 'label' property for name, if it exists */
>  	of_property_read_string(dssdev->dev->of_node, "label", &dssdev->name);
> 
>  	if (dssdev->name == NULL)
> -		dssdev->name = dssdev->alias;
> +		dssdev->name = devm_kasprintf(dssdev->dev, GFP_KERNEL,
> +					      "display%d", id);

Given that the size of the name is known, how about turning dssdev->name into 
a fixed-size char array ? That would remove the need for dynamic allocation.

And shouldn't you use %u instead of %d ?

> 
>  	if (drv && drv->get_timings == NULL)
>  		drv->get_timings = omapdss_default_get_timings;
> 
>  	mutex_lock(&panel_list_mutex);
> -	list_for_each(cur, &panel_list) {
> -		struct omap_dss_device *ldev = list_entry(cur,
> -							 struct omap_dss_device,
> -							 panel_list);
> -		if (strcmp(ldev->alias, dssdev->alias) > 0)
> -			break;
> -	}
> -	list_add_tail(&dssdev->panel_list, cur);
> +	list_add_tail(&dssdev->panel_list, &panel_list);
>  	mutex_unlock(&panel_list_mutex);
>  	return 0;
>  }
> diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h
> b/drivers/gpu/drm/omapdrm/dss/omapdss.h index bd5f174a3c56..ac8ca37ff889
> 100644
> --- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
> +++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> @@ -476,8 +476,6 @@ struct omap_dss_device {
> 
>  	struct list_head panel_list;
> 
> -	/* alias in the form of "display%d" */
> -	char alias[16];
>  	int alias_id;
> 
>  	enum omap_display_type type;
diff mbox series

Patch

diff --git a/drivers/gpu/drm/omapdrm/dss/display.c b/drivers/gpu/drm/omapdrm/dss/display.c
index 3ef99f344bd3..7840837f4325 100644
--- a/drivers/gpu/drm/omapdrm/dss/display.c
+++ b/drivers/gpu/drm/omapdrm/dss/display.c
@@ -41,7 +41,6 @@  static int disp_num_counter;
 int omapdss_register_display(struct omap_dss_device *dssdev)
 {
 	struct omap_dss_driver *drv = dssdev->driver;
-	struct list_head *cur;
 	int id;
 
 	/*
@@ -54,26 +53,18 @@  int omapdss_register_display(struct omap_dss_device *dssdev)
 
 	dssdev->alias_id = id;
 
-	snprintf(dssdev->alias, sizeof(dssdev->alias), "display%d", id);
-
 	/* Use 'label' property for name, if it exists */
 	of_property_read_string(dssdev->dev->of_node, "label", &dssdev->name);
 
 	if (dssdev->name == NULL)
-		dssdev->name = dssdev->alias;
+		dssdev->name = devm_kasprintf(dssdev->dev, GFP_KERNEL,
+					      "display%d", id);
 
 	if (drv && drv->get_timings == NULL)
 		drv->get_timings = omapdss_default_get_timings;
 
 	mutex_lock(&panel_list_mutex);
-	list_for_each(cur, &panel_list) {
-		struct omap_dss_device *ldev = list_entry(cur,
-							 struct omap_dss_device,
-							 panel_list);
-		if (strcmp(ldev->alias, dssdev->alias) > 0)
-			break;
-	}
-	list_add_tail(&dssdev->panel_list, cur);
+	list_add_tail(&dssdev->panel_list, &panel_list);
 	mutex_unlock(&panel_list_mutex);
 	return 0;
 }
diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h b/drivers/gpu/drm/omapdrm/dss/omapdss.h
index bd5f174a3c56..ac8ca37ff889 100644
--- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
+++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
@@ -476,8 +476,6 @@  struct omap_dss_device {
 
 	struct list_head panel_list;
 
-	/* alias in the form of "display%d" */
-	char alias[16];
 	int alias_id;
 
 	enum omap_display_type type;