dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Vetter <daniel@ffwll.ch>
To: Dave Airlie <airlied@gmail.com>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH 12/12] drm/legacy: remove some legacy lock struct members
Date: Tue, 23 Apr 2019 20:57:35 +0200	[thread overview]
Message-ID: <20190423185735.GH9857@phenom.ffwll.local> (raw)
In-Reply-To: <20190423020041.32702-13-airlied@gmail.com>

On Tue, Apr 23, 2019 at 12:00:41PM +1000, Dave Airlie wrote:
> From: Dave Airlie <airlied@redhat.com>
> 
> This removes these unless legacy is enabled.
> 
> The lock count init is unneeded anyways since it's kzalloc.
> 
> Signed-off-by: Dave Airlie <airlied@redhat.com>
> ---
>  drivers/gpu/drm/drm_auth.c   |  4 ++--
>  drivers/gpu/drm/drm_file.c   |  1 -
>  drivers/gpu/drm/drm_legacy.h | 10 ++++++++++
>  include/drm/drm_auth.h       |  2 ++
>  include/drm/drm_file.h       |  2 ++
>  5 files changed, 16 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_auth.c b/drivers/gpu/drm/drm_auth.c
> index ef8c4353829b..c3df628bc048 100644
> --- a/drivers/gpu/drm/drm_auth.c
> +++ b/drivers/gpu/drm/drm_auth.c
> @@ -103,8 +103,8 @@ struct drm_master *drm_master_create(struct drm_device *dev)
>  		return NULL;
>  
>  	kref_init(&master->refcount);
> -	spin_lock_init(&master->lock.spinlock);
> -	init_waitqueue_head(&master->lock.lock_queue);
> +
> +	drm_master_legacy_init(master);
>  	idr_init(&master->magic_map);
>  	master->dev = dev;
>  
> diff --git a/drivers/gpu/drm/drm_file.c b/drivers/gpu/drm/drm_file.c
> index 263fbef73fe5..233f114d2186 100644
> --- a/drivers/gpu/drm/drm_file.c
> +++ b/drivers/gpu/drm/drm_file.c
> @@ -128,7 +128,6 @@ struct drm_file *drm_file_alloc(struct drm_minor *minor)
>  
>  	/* for compatibility root is always authenticated */
>  	file->authenticated = capable(CAP_SYS_ADMIN);
> -	file->lock_count = 0;
>  
>  	INIT_LIST_HEAD(&file->lhead);
>  	INIT_LIST_HEAD(&file->fbs);
> diff --git a/drivers/gpu/drm/drm_legacy.h b/drivers/gpu/drm/drm_legacy.h
> index 4200e6bd3778..5d97c06d78e4 100644
> --- a/drivers/gpu/drm/drm_legacy.h
> +++ b/drivers/gpu/drm/drm_legacy.h
> @@ -233,4 +233,14 @@ void drm_legacy_lock_master_cleanup(struct drm_device *dev, struct drm_master *m
>  #else
>  static inline void drm_legacy_lock_master_cleanup(struct drm_device *dev, struct drm_master *master) {}
>  #endif
> +
> +#if IS_ENABLED(CONFIG_DRM_LEGACY)
> +static inline void drm_master_legacy_init(struct drm_master *master)
> +{
> +	spin_lock_init(&master->lock.spinlock);
> +	init_waitqueue_head(&master->lock.lock_queue);
> +}

Probably small enough that the static inline won't upset anyone, but feel
free to bikeshed around.

> +#else
> +static inline void drm_master_legacy_init(struct drm_master *master) {}
> +#endif
>  #endif /* __DRM_LEGACY_H__ */
> diff --git a/include/drm/drm_auth.h b/include/drm/drm_auth.h
> index 86bff9841b54..722199f434f0 100644
> --- a/include/drm/drm_auth.h
> +++ b/include/drm/drm_auth.h
> @@ -80,7 +80,9 @@ struct drm_master {
>  	 * &drm_device.master_mutex.
>  	 */
>  	struct idr magic_map;
> +#if IS_ENABLED(CONFIG_DRM_LEGACY)
>  	struct drm_lock_data lock;

Ditch the kerneldoc and put this at the end behind a
	/* private: */
comment to hide it even harder?

Either way: Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
> +#endif
>  	void *driver_priv;
>  
>  	/* Tree of display resource leases, each of which is a drm_master struct
> diff --git a/include/drm/drm_file.h b/include/drm/drm_file.h
> index 6710b612e2f6..67af60bb527a 100644
> --- a/include/drm/drm_file.h
> +++ b/include/drm/drm_file.h
> @@ -335,7 +335,9 @@ struct drm_file {
>  	struct drm_prime_file_private prime;
>  
>  	/* private: */
> +#if IS_ENABLED(CONFIG_DRM_LEGACY)
>  	unsigned long lock_count; /* DRI1 legacy lock count */
> +#endif
>  };
>  
>  /**
> -- 
> 2.20.1
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

      reply	other threads:[~2019-04-23 18:57 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-23  2:00 drm: make legacy support code optional Dave Airlie
2019-04-23  2:00 ` [PATCH 01/12] drm/nouveau: add kconfig option to turn off nouveau legacy contexts. (v2) Dave Airlie
2019-04-23  2:00 ` [PATCH 02/12] drm/legacy: move drm_legacy_master_rmmaps to non-driver legacy header Dave Airlie
2019-04-23  2:00 ` [PATCH 03/12] drm/legacy: move map cleanups into drm_bufs.c Dave Airlie
2019-04-23  2:00 ` [PATCH 04/12] drm/radeon: drop unused ati pcigart include Dave Airlie
2019-04-23 13:07   ` Christian König
2019-04-23  2:00 ` [PATCH 05/12] drm/legacy: move lock cleanup for master into lock file Dave Airlie
2019-04-23 18:44   ` Daniel Vetter
2019-04-23  2:00 ` [PATCH 06/12] drm/legacy: move map_hash create/destroy into inlines Dave Airlie
2019-04-23 18:45   ` Daniel Vetter
2019-04-23 18:58     ` Daniel Vetter
2019-04-23 19:48   ` Sam Ravnborg
2019-04-23  2:00 ` [PATCH 07/12] drm/legacy: move init/destroy of struct members " Dave Airlie
2019-04-23 18:46   ` Daniel Vetter
2019-04-23 19:52   ` Sam Ravnborg
2019-04-23  2:00 ` [PATCH 08/12] drm/legacy: move legacy dev reinit into an inline Dave Airlie
2019-04-23 18:47   ` Daniel Vetter
2019-04-23 19:55   ` Sam Ravnborg
2019-04-23  2:00 ` [PATCH 09/12] drm/legacy: don't include any of ati_pcigart in legacy Dave Airlie
2019-04-23 18:50   ` Daniel Vetter
2019-04-23 19:58     ` Sam Ravnborg
2019-04-23  2:00 ` [PATCH 10/12] drm: allow removal of legacy codepaths (v4) Dave Airlie
2019-04-23 18:53   ` Daniel Vetter
2019-04-23  2:00 ` [PATCH 11/12] drm/legacy: place all drm legacy members under DRM_LEGACY Dave Airlie
2019-04-23 18:55   ` Daniel Vetter
2019-04-23  2:00 ` [PATCH 12/12] drm/legacy: remove some legacy lock struct members Dave Airlie
2019-04-23 18:57   ` Daniel Vetter [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=20190423185735.GH9857@phenom.ffwll.local \
    --to=daniel@ffwll.ch \
    --cc=airlied@gmail.com \
    --cc=dri-devel@lists.freedesktop.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