All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sebastian Reichel <sre@kernel.org>
To: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: Tomi Valkeinen <tomi.valkeinen@ti.com>, dri-devel@lists.freedesktop.org
Subject: Re: [PATCH v2 28/60] drm/omap: dss: Make omap_dss_get_next_device() more generic
Date: Sun, 10 Jun 2018 22:17:45 +0200	[thread overview]
Message-ID: <20180610201745.d6b4ktprfascpbm3@earth.universe> (raw)
In-Reply-To: <20180526172518.18710-29-laurent.pinchart@ideasonboard.com>


[-- Attachment #1.1: Type: text/plain, Size: 6045 bytes --]

Hi,

On Sat, May 26, 2018 at 08:24:46PM +0300, Laurent Pinchart wrote:
> Despite its name, the omap_dss_get_next_device() function operates on
> display devices only. Make it more generic by allowing operation on all
> devices, with a parameter to specify the device type.
> 
> While at it rename the function to omapdss_device_get_next() to match
> the naming of the other functions operating on struct omap_dss_device.
> 
> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> ---

Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>

-- Sebastian

>  drivers/gpu/drm/omapdrm/dss/base.c    | 52 +++++++++++++++++++++++++++++++++++
>  drivers/gpu/drm/omapdrm/dss/display.c | 49 ---------------------------------
>  drivers/gpu/drm/omapdrm/dss/omapdss.h |  6 ++--
>  3 files changed, 56 insertions(+), 51 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/dss/base.c b/drivers/gpu/drm/omapdrm/dss/base.c
> index 7cd3076c2140..f7b8958f15bc 100644
> --- a/drivers/gpu/drm/omapdrm/dss/base.c
> +++ b/drivers/gpu/drm/omapdrm/dss/base.c
> @@ -104,6 +104,58 @@ struct omap_dss_device *omapdss_find_device_by_port(struct device_node *src,
>  	return NULL;
>  }
>  
> +/*
> + * Search for the next device starting at @from. If display_only is true, skip
> + * non-display devices. Release the reference to the @from device, and acquire
> + * a reference to the returned device if found.
> + */
> +struct omap_dss_device *omapdss_device_get_next(struct omap_dss_device *from,
> +						bool display_only)
> +{
> +	struct omap_dss_device *dssdev;
> +	struct list_head *list;
> +
> +	mutex_lock(&omapdss_devices_lock);
> +
> +	if (list_empty(&omapdss_devices_list)) {
> +		dssdev = NULL;
> +		goto done;
> +	}
> +
> +	/*
> +	 * Start from the from entry if given or from omapdss_devices_list
> +	 * otherwise.
> +	 */
> +	list = from ? &from->list : &omapdss_devices_list;
> +
> +	list_for_each_entry(dssdev, list, list) {
> +		/*
> +		 * Stop if we reach the omapdss_devices_list, that's the end of
> +		 * the list.
> +		 */
> +		if (&dssdev->list == &omapdss_devices_list) {
> +			dssdev = NULL;
> +			goto done;
> +		}
> +
> +		/* Filter out non-display entries if display_only is set. */
> +		if (!display_only || dssdev->driver)
> +			goto done;
> +	}
> +
> +	dssdev = NULL;
> +
> +done:
> +	if (from)
> +		omap_dss_put_device(from);
> +	if (dssdev)
> +		omap_dss_get_device(dssdev);
> +
> +	mutex_unlock(&omapdss_devices_lock);
> +	return dssdev;
> +}
> +EXPORT_SYMBOL(omapdss_device_get_next);
> +
>  int omapdss_device_connect(struct omap_dss_device *src,
>  			   struct omap_dss_device *dst)
>  {
> diff --git a/drivers/gpu/drm/omapdrm/dss/display.c b/drivers/gpu/drm/omapdrm/dss/display.c
> index 383512c8a466..0c94d5208398 100644
> --- a/drivers/gpu/drm/omapdrm/dss/display.c
> +++ b/drivers/gpu/drm/omapdrm/dss/display.c
> @@ -92,52 +92,3 @@ void omap_dss_put_device(struct omap_dss_device *dssdev)
>  	module_put(dssdev->owner);
>  }
>  EXPORT_SYMBOL(omap_dss_put_device);
> -
> -/*
> - * ref count of the found device is incremented.
> - * ref count of from-device is decremented.
> - */
> -struct omap_dss_device *omap_dss_get_next_device(struct omap_dss_device *from)
> -{
> -	struct list_head *l;
> -	struct omap_dss_device *dssdev;
> -
> -	mutex_lock(&panel_list_mutex);
> -
> -	if (list_empty(&panel_list)) {
> -		dssdev = NULL;
> -		goto out;
> -	}
> -
> -	if (from == NULL) {
> -		dssdev = list_first_entry(&panel_list, struct omap_dss_device,
> -				panel_list);
> -		omap_dss_get_device(dssdev);
> -		goto out;
> -	}
> -
> -	omap_dss_put_device(from);
> -
> -	list_for_each(l, &panel_list) {
> -		dssdev = list_entry(l, struct omap_dss_device, panel_list);
> -		if (dssdev == from) {
> -			if (list_is_last(l, &panel_list)) {
> -				dssdev = NULL;
> -				goto out;
> -			}
> -
> -			dssdev = list_entry(l->next, struct omap_dss_device,
> -					panel_list);
> -			omap_dss_get_device(dssdev);
> -			goto out;
> -		}
> -	}
> -
> -	WARN(1, "'from' dssdev not found\n");
> -
> -	dssdev = NULL;
> -out:
> -	mutex_unlock(&panel_list_mutex);
> -	return dssdev;
> -}
> -EXPORT_SYMBOL(omap_dss_get_next_device);
> diff --git a/drivers/gpu/drm/omapdrm/dss/omapdss.h b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> index a6ddc881ea72..94a3f98bdd3d 100644
> --- a/drivers/gpu/drm/omapdrm/dss/omapdss.h
> +++ b/drivers/gpu/drm/omapdrm/dss/omapdss.h
> @@ -489,11 +489,15 @@ static inline bool omapdss_is_initialized(void)
>  
>  int omapdss_register_display(struct omap_dss_device *dssdev);
>  void omapdss_unregister_display(struct omap_dss_device *dssdev);
> +#define for_each_dss_display(d) \
> +	while ((d = omapdss_device_get_next(d, true)) != NULL)
>  
>  void omapdss_device_register(struct omap_dss_device *dssdev);
>  void omapdss_device_unregister(struct omap_dss_device *dssdev);
>  struct omap_dss_device *omapdss_find_device_by_port(struct device_node *src,
>  						    unsigned int port);
> +struct omap_dss_device *omapdss_device_get_next(struct omap_dss_device *from,
> +						bool display_only);
>  int omapdss_device_connect(struct omap_dss_device *src,
>  			   struct omap_dss_device *dst);
>  void omapdss_device_disconnect(struct omap_dss_device *src,
> @@ -501,8 +505,6 @@ void omapdss_device_disconnect(struct omap_dss_device *src,
>  
>  struct omap_dss_device *omap_dss_get_device(struct omap_dss_device *dssdev);
>  void omap_dss_put_device(struct omap_dss_device *dssdev);
> -#define for_each_dss_display(d) while ((d = omap_dss_get_next_device(d)) != NULL)
> -struct omap_dss_device *omap_dss_get_next_device(struct omap_dss_device *from);
>  
>  int omap_dss_get_num_overlay_managers(void);
>  
> -- 
> Regards,
> 
> Laurent Pinchart
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

[-- Attachment #2: Type: text/plain, Size: 160 bytes --]

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  reply	other threads:[~2018-06-10 20:17 UTC|newest]

Thread overview: 127+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-26 17:24 [PATCH v2 00/60] omapdrm: Reverse direction of DSS device (dis)connect operations Laurent Pinchart
2018-05-26 17:24 ` [PATCH v2 01/60] drm/omap: Allocate drm_device earlier and unref it as last step Laurent Pinchart
2018-06-10 14:16   ` Sebastian Reichel
2018-05-26 17:24 ` [PATCH v2 02/60] drm/omap: Manage the usable omap_dss_device list within omap_drm_private Laurent Pinchart
2018-06-10 15:19   ` Sebastian Reichel
2018-05-26 17:24 ` [PATCH v2 03/60] drm/omap: Do dss_device (display) ordering in omap_drv.c Laurent Pinchart
2018-06-10 15:23   ` Sebastian Reichel
2018-05-26 17:24 ` [PATCH v2 04/60] drm/omap: dss: Remove display ordering from dss/display.c Laurent Pinchart
2018-06-10 15:23   ` Sebastian Reichel
2018-05-26 17:24 ` [PATCH v2 05/60] drm/omap: dss: Gather OMAP DSS components at probe time Laurent Pinchart
2018-06-10 15:33   ` Sebastian Reichel
2018-05-26 17:24 ` [PATCH v2 06/60] drm/omap: dss: Move platform_device_register from core.c to dss.c probe Laurent Pinchart
2018-06-10 15:40   ` Sebastian Reichel
2018-05-26 17:24 ` [PATCH v2 07/60] drm/omap: dss: Handle DPI and SDI port initialization failures Laurent Pinchart
2018-06-10 16:04   ` Sebastian Reichel
2018-05-26 17:24 ` [PATCH v2 08/60] drm/omap: dss: Remove omapdss_atv_ops get_wss and set_wss operations Laurent Pinchart
2018-06-10 16:10   ` Sebastian Reichel
2018-05-26 17:24 ` [PATCH v2 09/60] drm/omap: dss: Remove DSS encoders get_timings operation Laurent Pinchart
2018-06-10 16:13   ` Sebastian Reichel
2018-05-26 17:24 ` [PATCH v2 10/60] drm/omap: dss: Remove unused omapdss_default_get_timings() Laurent Pinchart
2018-06-10 16:18   ` Sebastian Reichel
2018-05-26 17:24 ` [PATCH v2 11/60] drm/omap: dss: Constify omap_dss_driver operations structure Laurent Pinchart
2018-06-10 16:20   ` Sebastian Reichel
2018-05-26 17:24 ` [PATCH v2 12/60] drm/omap: displays: Remove videomode from omap_dss_device structure Laurent Pinchart
2018-06-10 17:44   ` Sebastian Reichel
2018-05-26 17:24 ` [PATCH v2 13/60] drm/omap: dss: Remove omap_dss_device panel fields Laurent Pinchart
2018-06-10 17:48   ` Sebastian Reichel
2018-05-26 17:24 ` [PATCH v2 14/60] drm/omap: dss: Rename omap_dss_device list field to output_list Laurent Pinchart
2018-06-10 18:55   ` Sebastian Reichel
2018-05-26 17:24 ` [PATCH v2 15/60] drm/omap: dss: Create global list of all omap_dss_device instances Laurent Pinchart
2018-06-10 19:03   ` Sebastian Reichel
2018-05-26 17:24 ` [PATCH v2 16/60] drm/omap: dss: Create and use omapdss_device_is_registered() Laurent Pinchart
2018-06-10 19:04   ` Sebastian Reichel
2018-05-26 17:24 ` [PATCH v2 17/60] drm/omap: dss: Rework output lookup by port node Laurent Pinchart
2018-06-10 19:19   ` Sebastian Reichel
2018-05-26 17:24 ` [PATCH v2 18/60] drm/omap: dss: Allow looking up any device by port Laurent Pinchart
2018-06-10 19:25   ` Sebastian Reichel
2018-05-26 17:24 ` [PATCH v2 19/60] drm/omap: dss: Move common device operations to common structure Laurent Pinchart
2018-06-10 19:42   ` Sebastian Reichel
2018-05-26 17:24 ` [PATCH v2 20/60] drm/omap: dss: Add functions to connect and disconnect devices Laurent Pinchart
2018-06-10 19:47   ` Sebastian Reichel
2018-05-26 17:24 ` [PATCH v2 21/60] drm/omap: dss: Move debug message and checks to connection handlers Laurent Pinchart
2018-06-10 19:47   ` Sebastian Reichel
2018-05-26 17:24 ` [PATCH v2 22/60] drm/omap: dss: Move src and dst check and set " Laurent Pinchart
2018-06-10 19:54   ` Sebastian Reichel
2018-05-26 17:24 ` [PATCH v2 23/60] drm/omap: displays: Remove input omap_dss_device from panel data Laurent Pinchart
2018-06-10 20:03   ` Sebastian Reichel
2018-05-26 17:24 ` [PATCH v2 24/60] drm/omap: dsi: Simplify debugfs implementation Laurent Pinchart
2018-06-10 20:08   ` Sebastian Reichel
2018-05-26 17:24 ` [PATCH v2 25/60] drm/omap: Move DSI debugfs clocks dump to dsi%u_clks files Laurent Pinchart
2018-06-10 20:09   ` Sebastian Reichel
2018-05-26 17:24 ` [PATCH v2 26/60] drm/omap: dss: Remove output devices list Laurent Pinchart
2018-06-10 20:12   ` Sebastian Reichel
2018-05-26 17:24 ` [PATCH v2 27/60] drm/omap: dss: Rename for_each_dss_dev macro to for_each_dss_display Laurent Pinchart
2018-06-10 20:17   ` Sebastian Reichel
2018-05-26 17:24 ` [PATCH v2 28/60] drm/omap: dss: Make omap_dss_get_next_device() more generic Laurent Pinchart
2018-06-10 20:17   ` Sebastian Reichel [this message]
2018-05-26 17:24 ` [PATCH v2 29/60] drm/omap: dss: Split omapdss_register_display() Laurent Pinchart
2018-06-10 20:24   ` Sebastian Reichel
2018-05-26 17:24 ` [PATCH v2 30/60] drm/omap: dss: Remove panel devices list Laurent Pinchart
2018-06-10 20:32   ` Sebastian Reichel
2018-05-26 17:24 ` [PATCH v2 31/60] drm/omap: dss: Move and rename omap_dss_(get|put)_device() Laurent Pinchart
2018-06-10 20:36   ` Sebastian Reichel
2018-05-26 17:24 ` [PATCH v2 32/60] drm/omap: dss: Store dss_device pointer in omap_dss_device Laurent Pinchart
2018-06-10 20:43   ` Sebastian Reichel
2018-05-26 17:24 ` [PATCH v2 33/60] drm/omap: dss: Move DSS mgr ops and private data to dss_device Laurent Pinchart
2018-06-10 20:43   ` Sebastian Reichel
2018-05-26 17:24 ` [PATCH v2 34/60] drm/omap: dss: Modify omapdss_find_output_from_display() to return channel Laurent Pinchart
2018-06-10 20:46   ` Sebastian Reichel
2018-05-26 17:24 ` [PATCH v2 35/60] drm/omap: dss: Replace omap_dss_device port number with bitmask Laurent Pinchart
2018-06-10 21:00   ` Sebastian Reichel
2018-05-26 17:24 ` [PATCH v2 36/60] drm/omap: dss: Extend omapdss_of_find_source_for_first_ep() to sinks Laurent Pinchart
2018-06-10 21:13   ` Sebastian Reichel
2018-05-26 17:24 ` [PATCH v2 37/60] drm/omap: displays: Don't cast dssdev to panel data unnecessarily Laurent Pinchart
2018-06-10 21:14   ` Sebastian Reichel
2018-05-26 17:24 ` [PATCH v2 38/60] drm/omap: dss: Cleanup error paths in output init functions Laurent Pinchart
2018-06-10 21:17   ` Sebastian Reichel
2018-05-26 17:24 ` [PATCH v2 39/60] drm/omap: dss: dsi: Move initialization code from bind to probe Laurent Pinchart
2018-06-10 22:32   ` Sebastian Reichel
2018-05-26 17:24 ` [PATCH v2 40/60] drm/omap: dss: hdmi4: " Laurent Pinchart
2018-06-10 22:54   ` Sebastian Reichel
2018-05-26 17:24 ` [PATCH v2 41/60] drm/omap: dss: hdmi5: " Laurent Pinchart
2018-06-10 23:08   ` Sebastian Reichel
2018-05-26 17:25 ` [PATCH v2 42/60] drm/omap: dss: venc: " Laurent Pinchart
2018-06-10 23:17   ` Sebastian Reichel
2018-05-26 17:25 ` [PATCH v2 43/60] drm/omap: dss: Acquire next dssdev at probe time Laurent Pinchart
2018-06-10 23:49   ` Sebastian Reichel
2018-05-26 17:25 ` [PATCH v2 44/60] drm/omap: dss: Add for_each_dss_output() macro Laurent Pinchart
2018-06-10 23:52   ` Sebastian Reichel
2018-06-11 17:11     ` Laurent Pinchart
2018-06-11 21:06       ` Sebastian Reichel
2018-05-26 17:25 ` [PATCH v2 45/60] drm/omap: dss: Add function to retrieve display for an output Laurent Pinchart
2018-06-10 23:49   ` Sebastian Reichel
2018-05-26 17:25 ` [PATCH v2 46/60] drm/omap: dss: Remove duplicated parameter to dss_mgr_(dis)connect() Laurent Pinchart
2018-06-10 23:48   ` Sebastian Reichel
2018-06-11 17:16     ` Laurent Pinchart
2018-06-11 21:02       ` Sebastian Reichel
2018-05-26 17:25 ` [PATCH v2 47/60] drm/omap: dss: Get regulators at probe time Laurent Pinchart
2018-06-10 23:58   ` Sebastian Reichel
2018-05-26 17:25 ` [PATCH v2 48/60] drm/omap: Remove unneeded variable assignments in omap_modeset_init Laurent Pinchart
2018-06-11  0:01   ` Sebastian Reichel
2018-05-26 17:25 ` [PATCH v2 49/60] drm/omap: Create all planes before CRTCs Laurent Pinchart
2018-06-11  0:07   ` Sebastian Reichel
2018-05-26 17:25 ` [PATCH v2 50/60] drm/omap: Group CRTC, encoder, connector and dssdev in a structure Laurent Pinchart
2018-06-11 10:50   ` Sebastian Reichel
2018-05-26 17:25 ` [PATCH v2 51/60] drm/omap: Reverse direction of DSS device (dis)connect operations Laurent Pinchart
2018-06-11 11:59   ` Sebastian Reichel
2018-06-11 19:21     ` Laurent Pinchart
2018-05-26 17:25 ` [PATCH v2 52/60] drm/omap: dss: Move connection checks to omapdss_device_(dis)connect Laurent Pinchart
2018-06-11 11:59   ` Sebastian Reichel
2018-05-26 17:25 ` [PATCH v2 53/60] drm/omap: dss: Move display type validation to initialization time Laurent Pinchart
2018-06-11 11:59   ` Sebastian Reichel
2018-05-26 17:25 ` [PATCH v2 54/60] drm/omap: dss: Merge two disconnection helpers Laurent Pinchart
2018-06-11 11:59   ` Sebastian Reichel
2018-05-26 17:25 ` [PATCH v2 55/60] drm/omap: Pass pipe pointer to omap_crtc_init() Laurent Pinchart
2018-06-11 12:00   ` Sebastian Reichel
2018-05-26 17:25 ` [PATCH v2 56/60] drm/omap: Store CRTC lookup by channel table in omap_drm_private Laurent Pinchart
2018-06-11 12:00   ` Sebastian Reichel
2018-05-26 17:25 ` [PATCH v2 57/60] drm/omap: Remove omap_crtc_output global array Laurent Pinchart
2018-06-11 12:00   ` Sebastian Reichel
2018-05-26 17:25 ` [PATCH v2 58/60] drm/omap: Remove supported output check in CRTC connect handler Laurent Pinchart
2018-06-11 12:00   ` Sebastian Reichel
2018-05-26 17:25 ` [PATCH v2 59/60] drm/omap: Set dispc_channel_connect from DSS output connect handlers Laurent Pinchart
2018-06-11 12:00   ` Sebastian Reichel
2018-05-26 17:25 ` [PATCH v2 60/60] drm/omap: dss: Remove the dss_mgr_(dis)connect() operations Laurent Pinchart
2018-06-11 12:01   ` Sebastian Reichel
2018-06-13  6:56 ` [PATCH v2 00/60] omapdrm: Reverse direction of DSS device (dis)connect operations Tomi Valkeinen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180610201745.d6b4ktprfascpbm3@earth.universe \
    --to=sre@kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=tomi.valkeinen@ti.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.