dri-devel Archive mirror
 help / color / mirror / Atom feed
From: Zack Rusin <zack.rusin@broadcom.com>
To: Maaz Mombasawala <maaz.mombasawala@broadcom.com>
Cc: dri-devel@lists.freedesktop.org,
	bcm-kernel-feedback-list@broadcom.com,  ian.forbes@broadcom.com,
	martin.krastev@broadcom.com
Subject: Re: [PATCH] drm/vmwgfx: Stop using dev_private to store driver data.
Date: Wed, 1 May 2024 22:02:02 -0400	[thread overview]
Message-ID: <CABQX2QN1iOGoADT==EfMRif5ZmEGwR1u2+nzkM1DLiaeQUmOyA@mail.gmail.com> (raw)
In-Reply-To: <20240502004033.107533-1-maaz.mombasawala@broadcom.com>

On Wed, May 1, 2024 at 8:41 PM Maaz Mombasawala
<maaz.mombasawala@broadcom.com> wrote:
>
> Currently vmwgfx uses the dev_private opaque pointer in drm_device to store
> driver data in vmw_private struct. Using dev_private is deprecated, and the
> recommendation is to embed struct drm_device in the larger per-device
> structure.
>
> The vmwgfx driver already embeds struct drm_device in its struct
> vmw_private, so switch to using that exclusively and stop using
> dev_private.
>
> Signed-off-by: Maaz Mombasawala <maaz.mombasawala@broadcom.com>
> ---
>  drivers/gpu/drm/vmwgfx/vmwgfx_drv.c | 2 --
>  drivers/gpu/drm/vmwgfx/vmwgfx_drv.h | 2 +-
>  drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | 4 ++--
>  3 files changed, 3 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
> index bdad93864b98..97e48e93dbbf 100644
> --- a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
> +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
> @@ -858,8 +858,6 @@ static int vmw_driver_load(struct vmw_private *dev_priv, u32 pci_id)
>         bool refuse_dma = false;
>         struct pci_dev *pdev = to_pci_dev(dev_priv->drm.dev);
>
> -       dev_priv->drm.dev_private = dev_priv;
> -
>         vmw_sw_context_init(dev_priv);
>
>         mutex_init(&dev_priv->cmdbuf_mutex);
> diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h
> index 4ecaea0026fc..df89e468a1fc 100644
> --- a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h
> +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h
> @@ -638,7 +638,7 @@ static inline struct vmw_surface *vmw_res_to_srf(struct vmw_resource *res)
>
>  static inline struct vmw_private *vmw_priv(struct drm_device *dev)
>  {
> -       return (struct vmw_private *)dev->dev_private;
> +       return container_of(dev, struct vmw_private, drm);
>  }
>
>  static inline struct vmw_private *vmw_priv_from_ttm(struct ttm_device *bdev)
> diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
> index 13b2820cae51..b3f0fb6828de 100644
> --- a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
> +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
> @@ -276,7 +276,7 @@ static void vmw_du_put_cursor_mob(struct vmw_cursor_plane *vcp,
>  static int vmw_du_get_cursor_mob(struct vmw_cursor_plane *vcp,
>                                  struct vmw_plane_state *vps)
>  {
> -       struct vmw_private *dev_priv = vcp->base.dev->dev_private;
> +       struct vmw_private *dev_priv = vmw_priv(vcp->base.dev);
>         u32 size = vmw_du_cursor_mob_size(vps->base.crtc_w, vps->base.crtc_h);
>         u32 i;
>         u32 cursor_max_dim, mob_max_size;
> @@ -515,7 +515,7 @@ void vmw_du_cursor_plane_destroy(struct drm_plane *plane)
>         struct vmw_cursor_plane *vcp = vmw_plane_to_vcp(plane);
>         u32 i;
>
> -       vmw_cursor_update_position(plane->dev->dev_private, false, 0, 0);
> +       vmw_cursor_update_position(vmw_priv(plane->dev), false, 0, 0);
>
>         for (i = 0; i < ARRAY_SIZE(vcp->cursor_mobs); i++)
>                 vmw_du_destroy_cursor_mob(&vcp->cursor_mobs[i]);
> --
> 2.34.1
>

Looks good.
Reviewed-by: Zack Rusin <zack.rusin@broadcom.com>

z

      reply	other threads:[~2024-05-02  2:02 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-02  0:40 [PATCH] drm/vmwgfx: Stop using dev_private to store driver data Maaz Mombasawala
2024-05-02  2:02 ` Zack Rusin [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='CABQX2QN1iOGoADT==EfMRif5ZmEGwR1u2+nzkM1DLiaeQUmOyA@mail.gmail.com' \
    --to=zack.rusin@broadcom.com \
    --cc=bcm-kernel-feedback-list@broadcom.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=ian.forbes@broadcom.com \
    --cc=maaz.mombasawala@broadcom.com \
    --cc=martin.krastev@broadcom.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 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 read-only IMAP folder(s) and NNTP newsgroup(s).