virtualization.lists.linux-foundation.org archive mirror
 help / color / mirror / Atom feed
From: Sam Ravnborg <sam@ravnborg.org>
To: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Intel Graphics Development <intel-gfx@lists.freedesktop.org>,
	DRI Development <dri-devel@lists.freedesktop.org>,
	virtualization@lists.linux-foundation.org,
	Gerd Hoffmann <kraxel@redhat.com>,
	Thomas Zimmermann <tzimmermann@suse.de>,
	Dave Airlie <airlied@redhat.com>,
	Daniel Vetter <daniel.vetter@intel.com>
Subject: Re: [PATCH 40/44] drm/cirrus: Don't use drm_device->dev_private
Date: Wed, 8 Apr 2020 10:01:46 +0200	[thread overview]
Message-ID: <20200408080146.GS14965@ravnborg.org> (raw)
In-Reply-To: <20200403135828.2542770-41-daniel.vetter@ffwll.ch>

On Fri, Apr 03, 2020 at 03:58:24PM +0200, Daniel Vetter wrote:
> Upcasting using a container_of macro is more typesafe, faster and
> easier for the compiler to optimize.
> 
> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
> Cc: Dave Airlie <airlied@redhat.com>
> Cc: Gerd Hoffmann <kraxel@redhat.com>
> Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
> Cc: "Noralf Trønnes" <noralf@tronnes.org>
> Cc: Sam Ravnborg <sam@ravnborg.org>
> Cc: Eric Anholt <eric@anholt.net>
> Cc: Thomas Zimmermann <tzimmermann@suse.de>
> Cc: virtualization@lists.linux-foundation.org
Acked-by: Sam Ravnborg <sam@ravnborg.org>

> ---
>  drivers/gpu/drm/cirrus/cirrus.c | 9 +++++----
>  1 file changed, 5 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/gpu/drm/cirrus/cirrus.c b/drivers/gpu/drm/cirrus/cirrus.c
> index 4b65637147ba..744a8e337e41 100644
> --- a/drivers/gpu/drm/cirrus/cirrus.c
> +++ b/drivers/gpu/drm/cirrus/cirrus.c
> @@ -59,6 +59,8 @@ struct cirrus_device {
>  	void __iomem		       *mmio;
>  };
>  
> +#define to_cirrus(_dev) container_of(_dev, struct cirrus_device, dev)
> +
>  /* ------------------------------------------------------------------ */
>  /*
>   * The meat of this driver. The core passes us a mode and we have to program
> @@ -311,7 +313,7 @@ static int cirrus_mode_set(struct cirrus_device *cirrus,
>  static int cirrus_fb_blit_rect(struct drm_framebuffer *fb,
>  			       struct drm_rect *rect)
>  {
> -	struct cirrus_device *cirrus = fb->dev->dev_private;
> +	struct cirrus_device *cirrus = to_cirrus(fb->dev);
>  	void *vmap;
>  	int idx, ret;
>  
> @@ -436,7 +438,7 @@ static void cirrus_pipe_enable(struct drm_simple_display_pipe *pipe,
>  			       struct drm_crtc_state *crtc_state,
>  			       struct drm_plane_state *plane_state)
>  {
> -	struct cirrus_device *cirrus = pipe->crtc.dev->dev_private;
> +	struct cirrus_device *cirrus = to_cirrus(pipe->crtc.dev);
>  
>  	cirrus_mode_set(cirrus, &crtc_state->mode, plane_state->fb);
>  	cirrus_fb_blit_fullscreen(plane_state->fb);
> @@ -445,7 +447,7 @@ static void cirrus_pipe_enable(struct drm_simple_display_pipe *pipe,
>  static void cirrus_pipe_update(struct drm_simple_display_pipe *pipe,
>  			       struct drm_plane_state *old_state)
>  {
> -	struct cirrus_device *cirrus = pipe->crtc.dev->dev_private;
> +	struct cirrus_device *cirrus = to_cirrus(pipe->crtc.dev);
>  	struct drm_plane_state *state = pipe->plane.state;
>  	struct drm_crtc *crtc = &pipe->crtc;
>  	struct drm_rect rect;
> @@ -573,7 +575,6 @@ static int cirrus_pci_probe(struct pci_dev *pdev,
>  		return PTR_ERR(cirrus);
>  
>  	dev = &cirrus->dev;
> -	dev->dev_private = cirrus;
>  
>  	cirrus->vram = devm_ioremap(&pdev->dev, pci_resource_start(pdev, 0),
>  				    pci_resource_len(pdev, 0));
> -- 
> 2.25.1
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

      parent reply	other threads:[~2020-04-08  8:01 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20200403135828.2542770-1-daniel.vetter@ffwll.ch>
2020-04-03 13:58 ` [PATCH 30/44] drm/qxl: Use devm_drm_dev_alloc Daniel Vetter
2020-04-06  6:55   ` Gerd Hoffmann
2020-04-06 12:11   ` Thomas Zimmermann
2020-04-07  7:19     ` Daniel Vetter
2020-04-03 13:58 ` [PATCH 31/44] drm/qxl: Don't use drm_device->dev_private Daniel Vetter
2020-04-06  6:55   ` Gerd Hoffmann
2020-04-03 13:58 ` [PATCH 39/44] drm/cirrus: Use devm_drm_dev_alloc Daniel Vetter
2020-04-05 10:04   ` Noralf Trønnes
2020-04-08  8:01   ` Sam Ravnborg
2020-04-03 13:58 ` [PATCH 40/44] drm/cirrus: Don't use drm_device->dev_private Daniel Vetter
2020-04-03 17:40   ` Eric Anholt
2020-04-06 11:58   ` Thomas Zimmermann
2020-04-08  8:04     ` Sam Ravnborg
2020-04-08  8:01   ` Sam Ravnborg [this message]

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=20200408080146.GS14965@ravnborg.org \
    --to=sam@ravnborg.org \
    --cc=airlied@redhat.com \
    --cc=daniel.vetter@ffwll.ch \
    --cc=daniel.vetter@intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=kraxel@redhat.com \
    --cc=tzimmermann@suse.de \
    --cc=virtualization@lists.linux-foundation.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).