linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
Cc: linux-renesas-soc@vger.kernel.org,
	dri-devel@lists.freedesktop.org, David Airlie <airlied@linux.ie>,
	open list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2 4/6] drm: rcar-du: Provide for_each_group helper
Date: Sun, 12 May 2019 16:48:43 +0300	[thread overview]
Message-ID: <20190512134843.GE4960@pendragon.ideasonboard.com> (raw)
In-Reply-To: <20190315170110.23280-5-kieran.bingham+renesas@ideasonboard.com>

Hi Kieran,

Thank you for the patch?

On Fri, Mar 15, 2019 at 05:01:08PM +0000, Kieran Bingham wrote:
> Refactoring of the group control code will soon require more iteration
> over the available groups. Simplify this process by introducing a group
> iteration helper.
> 
> Signed-off-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
> ---
> v2:
>  - no change
> 
>  drivers/gpu/drm/rcar-du/rcar_du_drv.h |  5 +++++
>  drivers/gpu/drm/rcar-du/rcar_du_kms.c | 10 ++--------
>  2 files changed, 7 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/gpu/drm/rcar-du/rcar_du_drv.h b/drivers/gpu/drm/rcar-du/rcar_du_drv.h
> index 1327cd0df90a..1e9dd494e8ac 100644
> --- a/drivers/gpu/drm/rcar-du/rcar_du_drv.h
> +++ b/drivers/gpu/drm/rcar-du/rcar_du_drv.h
> @@ -96,6 +96,11 @@ struct rcar_du_device {
>  	unsigned int vspd1_sink;
>  };
>  
> +#define for_each_rcdu_group(__rcdu, __group, __i) \
> +	for ((__i) = 0; (__group = &(rcdu)->groups[__i]), \
> +	     (__i) < DIV_ROUND_UP((rcdu)->num_crtcs, 2); \
> +	     __i++)

s/(rcdu)/(__rcdu)/

Assigning __group in the condition part of the for statement seems
weird, even if it should work. How about writing it as

#define for_each_rcdu_group(__rcdu, __group, __i) \
	for ((__i) = 0, (__group) = &(__rcdu)->groups[0]; \
	     (__i) < DIV_ROUND_UP((__rcdu)->num_crtcs, 2); \
	     __i++, __group++)

Apart from this,

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

>  static inline bool rcar_du_has(struct rcar_du_device *rcdu,
>  			       unsigned int feature)
>  {
> diff --git a/drivers/gpu/drm/rcar-du/rcar_du_kms.c b/drivers/gpu/drm/rcar-du/rcar_du_kms.c
> index e4befb1937f8..ece92cff2137 100644
> --- a/drivers/gpu/drm/rcar-du/rcar_du_kms.c
> +++ b/drivers/gpu/drm/rcar-du/rcar_du_kms.c
> @@ -522,9 +522,9 @@ int rcar_du_modeset_init(struct rcar_du_device *rcdu)
>  
>  	struct drm_device *dev = rcdu->ddev;
>  	struct drm_encoder *encoder;
> +	struct rcar_du_group *rgrp;
>  	unsigned int dpad0_sources;
>  	unsigned int num_encoders;
> -	unsigned int num_groups;
>  	unsigned int swindex;
>  	unsigned int hwindex;
>  	unsigned int i;
> @@ -565,11 +565,7 @@ int rcar_du_modeset_init(struct rcar_du_device *rcdu)
>  		return ret;
>  
>  	/* Initialize the groups. */
> -	num_groups = DIV_ROUND_UP(rcdu->num_crtcs, 2);
> -
> -	for (i = 0; i < num_groups; ++i) {
> -		struct rcar_du_group *rgrp = &rcdu->groups[i];
> -
> +	for_each_rcdu_group(rcdu, rgrp, i) {
>  		mutex_init(&rgrp->lock);
>  
>  		rgrp->dev = rcdu;
> @@ -606,8 +602,6 @@ int rcar_du_modeset_init(struct rcar_du_device *rcdu)
>  
>  	/* Create the CRTCs. */
>  	for (swindex = 0, hwindex = 0; swindex < rcdu->num_crtcs; ++hwindex) {
> -		struct rcar_du_group *rgrp;
> -
>  		/* Skip unpopulated DU channels. */
>  		if (!(rcdu->info->channels_mask & BIT(hwindex)))
>  			continue;

-- 
Regards,

Laurent Pinchart

  reply	other threads:[~2019-05-12 13:49 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20190315170110.23280-1-kieran.bingham+renesas@ideasonboard.com>
2019-03-15 17:01 ` [PATCH v2 1/6] drm: rcar-du: Link CRTCs to the DU device Kieran Bingham
2019-03-17 22:55   ` Laurent Pinchart
2019-03-15 17:01 ` [PATCH v2 2/6] drm: rcar-du: Add CRTC standby helpers Kieran Bingham
2019-05-12 13:24   ` Laurent Pinchart
2019-03-15 17:01 ` [PATCH v2 3/6] drm: rcar-du: Add pre/post commit CRTC helpers Kieran Bingham
2019-05-12 13:35   ` Laurent Pinchart
2019-03-15 17:01 ` [PATCH v2 4/6] drm: rcar-du: Provide for_each_group helper Kieran Bingham
2019-05-12 13:48   ` Laurent Pinchart [this message]
2019-03-15 17:01 ` [PATCH v2 5/6] drm: rcar-du: Create a group state object Kieran Bingham
2019-05-12 13:55   ` Laurent Pinchart
2019-03-15 17:01 ` [PATCH v2 6/6] drm: rcar-du: Add group hooks for atomic-commit Kieran Bingham
2019-05-12 16:41   ` Laurent Pinchart

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=20190512134843.GE4960@pendragon.ideasonboard.com \
    --to=laurent.pinchart@ideasonboard.com \
    --cc=airlied@linux.ie \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=kieran.bingham+renesas@ideasonboard.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).