dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Kieran Bingham <kieran.bingham@ideasonboard.com>
To: Jacopo Mondi <jacopo@jmondi.org>,
	Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Cc: linux-renesas-soc@vger.kernel.org,
	Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>,
	dri-devel@lists.freedesktop.org
Subject: Re: [PATCH 7/9] drm: rcar-du: Replace dev_private with container_of
Date: Mon, 14 Dec 2020 17:11:29 +0000	[thread overview]
Message-ID: <c7e2b82f-2cd6-6495-bbd8-2eb9731f7f20@ideasonboard.com> (raw)
In-Reply-To: <20201214105808.xrjyul6hrjsremli@uno.localdomain>

Hi Laurent,

On 14/12/2020 10:58, Jacopo Mondi wrote:
> Hi Laurent,
> 
> On Sat, Dec 05, 2020 at 12:01:37AM +0200, Laurent Pinchart wrote:
>> Now that drm_device is embedded in rcar_du_device, we can use
>> container_of to get the rcar_du_device pointer from the drm_device,
>> instead of using the drm_device.dev_private field.
>>
>> Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
> 
> De gustibus non est disputandum


Err ... um ... what he said - whatever that is ... maybe ...

/me checks if google is still working to translate ...

Oh ok ;-)

Well - Yes, I like to_*(from) conversion macros ... so

Reviewed-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>

> 
> Reviewed-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
> 
> Thanks
>   j
> 
>> ---
>>  drivers/gpu/drm/rcar-du/rcar_du_drv.c   | 2 --
>>  drivers/gpu/drm/rcar-du/rcar_du_drv.h   | 5 +++++
>>  drivers/gpu/drm/rcar-du/rcar_du_kms.c   | 8 ++++----
>>  drivers/gpu/drm/rcar-du/rcar_du_plane.c | 2 +-
>>  4 files changed, 10 insertions(+), 7 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/rcar-du/rcar_du_drv.c b/drivers/gpu/drm/rcar-du/rcar_du_drv.c
>> index 4ab99ac49891..d6a8b7899952 100644
>> --- a/drivers/gpu/drm/rcar-du/rcar_du_drv.c
>> +++ b/drivers/gpu/drm/rcar-du/rcar_du_drv.c
>> @@ -587,8 +587,6 @@ static int rcar_du_probe(struct platform_device *pdev)
>>  		return PTR_ERR(rcdu->mmio);
>>
>>  	/* DRM/KMS objects */
>> -	rcdu->ddev.dev_private = rcdu;
>> -
>>  	ret = rcar_du_modeset_init(rcdu);
>>  	if (ret < 0) {
>>  		if (ret != -EPROBE_DEFER)
>> diff --git a/drivers/gpu/drm/rcar-du/rcar_du_drv.h b/drivers/gpu/drm/rcar-du/rcar_du_drv.h
>> index e5b6f456357e..98d6bac3f2fa 100644
>> --- a/drivers/gpu/drm/rcar-du/rcar_du_drv.h
>> +++ b/drivers/gpu/drm/rcar-du/rcar_du_drv.h
>> @@ -102,6 +102,11 @@ struct rcar_du_device {
>>  	unsigned int vspd1_sink;
>>  };
>>
>> +static inline struct rcar_du_device *to_rcar_du_device(struct drm_device *dev)
>> +{
>> +	return container_of(dev, struct rcar_du_device, ddev);
>> +}
>> +
>>  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 57bb0dc22807..d6b71a9361ca 100644
>> --- a/drivers/gpu/drm/rcar-du/rcar_du_kms.c
>> +++ b/drivers/gpu/drm/rcar-du/rcar_du_kms.c
>> @@ -327,7 +327,7 @@ const struct rcar_du_format_info *rcar_du_format_info(u32 fourcc)
>>  int rcar_du_dumb_create(struct drm_file *file, struct drm_device *dev,
>>  			struct drm_mode_create_dumb *args)
>>  {
>> -	struct rcar_du_device *rcdu = dev->dev_private;
>> +	struct rcar_du_device *rcdu = to_rcar_du_device(dev);
>>  	unsigned int min_pitch = DIV_ROUND_UP(args->width * args->bpp, 8);
>>  	unsigned int align;
>>
>> @@ -349,7 +349,7 @@ static struct drm_framebuffer *
>>  rcar_du_fb_create(struct drm_device *dev, struct drm_file *file_priv,
>>  		  const struct drm_mode_fb_cmd2 *mode_cmd)
>>  {
>> -	struct rcar_du_device *rcdu = dev->dev_private;
>> +	struct rcar_du_device *rcdu = to_rcar_du_device(dev);
>>  	const struct rcar_du_format_info *format;
>>  	unsigned int chroma_pitch;
>>  	unsigned int max_pitch;
>> @@ -421,7 +421,7 @@ rcar_du_fb_create(struct drm_device *dev, struct drm_file *file_priv,
>>  static int rcar_du_atomic_check(struct drm_device *dev,
>>  				struct drm_atomic_state *state)
>>  {
>> -	struct rcar_du_device *rcdu = dev->dev_private;
>> +	struct rcar_du_device *rcdu = to_rcar_du_device(dev);
>>  	int ret;
>>
>>  	ret = drm_atomic_helper_check(dev, state);
>> @@ -437,7 +437,7 @@ static int rcar_du_atomic_check(struct drm_device *dev,
>>  static void rcar_du_atomic_commit_tail(struct drm_atomic_state *old_state)
>>  {
>>  	struct drm_device *dev = old_state->dev;
>> -	struct rcar_du_device *rcdu = dev->dev_private;
>> +	struct rcar_du_device *rcdu = to_rcar_du_device(dev);
>>  	struct drm_crtc_state *crtc_state;
>>  	struct drm_crtc *crtc;
>>  	unsigned int i;
>> diff --git a/drivers/gpu/drm/rcar-du/rcar_du_plane.c b/drivers/gpu/drm/rcar-du/rcar_du_plane.c
>> index 5f69ff4502c1..02e5f11f38eb 100644
>> --- a/drivers/gpu/drm/rcar-du/rcar_du_plane.c
>> +++ b/drivers/gpu/drm/rcar-du/rcar_du_plane.c
>> @@ -128,7 +128,7 @@ static int rcar_du_plane_hwalloc(struct rcar_du_plane *plane,
>>  int rcar_du_atomic_check_planes(struct drm_device *dev,
>>  				struct drm_atomic_state *state)
>>  {
>> -	struct rcar_du_device *rcdu = dev->dev_private;
>> +	struct rcar_du_device *rcdu = to_rcar_du_device(dev);
>>  	unsigned int group_freed_planes[RCAR_DU_MAX_GROUPS] = { 0, };
>>  	unsigned int group_free_planes[RCAR_DU_MAX_GROUPS] = { 0, };
>>  	bool needs_realloc = false;
>> --
>> Regards,
>>
>> Laurent Pinchart
>>

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

  reply	other threads:[~2020-12-14 17:11 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-04 22:01 [PATCH 0/9] drm: rcar-du: Fix LVDS-related crash Laurent Pinchart
2020-12-04 22:01 ` [PATCH 1/9] drm: rcar-du: Fix crash when using LVDS1 clock for CRTC Laurent Pinchart
2020-12-07  8:15   ` Geert Uytterhoeven
2020-12-08  0:42     ` Laurent Pinchart
2020-12-14  9:43   ` Jacopo Mondi
2020-12-14 15:36   ` Kieran Bingham
2020-12-04 22:01 ` [PATCH 2/9] drm: rcar-du: Release vsp device reference in all error paths Laurent Pinchart
2020-12-14 10:03   ` Jacopo Mondi
2020-12-14 15:42   ` Kieran Bingham
2020-12-04 22:01 ` [PATCH 3/9] drm: rcar-du: Drop unneeded encoder cleanup in error path Laurent Pinchart
2020-12-14 10:11   ` Jacopo Mondi
2020-12-14 13:19     ` Laurent Pinchart
2020-12-14 15:59   ` Kieran Bingham
2020-12-04 22:01 ` [PATCH 4/9] drm: rcar-du: Use DRM-managed allocation for VSP planes Laurent Pinchart
2020-12-14 16:20   ` Kieran Bingham
2020-12-14 16:26     ` Laurent Pinchart
2020-12-15 15:42       ` Geert Uytterhoeven
2020-12-04 22:01 ` [PATCH 5/9] drm: rcar-du: Use DRM-managed allocation for encoders Laurent Pinchart
2020-12-14 10:37   ` Jacopo Mondi
2020-12-14 13:28     ` Laurent Pinchart
2020-12-04 22:01 ` [PATCH 6/9] drm: rcar-du: Embed drm_device in rcar_du_device Laurent Pinchart
2020-12-14 10:55   ` Jacopo Mondi
2020-12-14 17:02   ` Kieran Bingham
2020-12-04 22:01 ` [PATCH 7/9] drm: rcar-du: Replace dev_private with container_of Laurent Pinchart
2020-12-14 10:58   ` Jacopo Mondi
2020-12-14 17:11     ` Kieran Bingham [this message]
2020-12-04 22:01 ` [PATCH 8/9] drm: rcar-du: Skip encoder allocation for LVDS1 in dual-link mode Laurent Pinchart
2020-12-14 11:04   ` Jacopo Mondi
2020-12-14 13:32     ` Laurent Pinchart
2020-12-14 17:21   ` Kieran Bingham
2020-12-04 22:01 ` [PATCH 9/9] drm: rcar-du: Drop local encoder variable Laurent Pinchart
2020-12-14 11:05   ` Jacopo Mondi
2020-12-14 17:16   ` Kieran Bingham

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=c7e2b82f-2cd6-6495-bbd8-2eb9731f7f20@ideasonboard.com \
    --to=kieran.bingham@ideasonboard.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=jacopo@jmondi.org \
    --cc=kuninori.morimoto.gx@renesas.com \
    --cc=laurent.pinchart+renesas@ideasonboard.com \
    --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