* [PATCH] drm: don't let crtc_ww_class leak out
@ 2016-11-14 22:40 Rob Clark
2016-11-15 7:33 ` Daniel Vetter
0 siblings, 1 reply; 2+ messages in thread
From: Rob Clark @ 2016-11-14 22:40 UTC (permalink / raw)
To: dri-devel
kbuild spotted this error, with drm/msm patches that add a new
modeset-lock in the driver and driver built as a module:
ERROR: "crtc_ww_class" [drivers/gpu/drm/msm/msm.ko] undefined!
Really the only reason for crtc_ww_class not being internal to
drm_modeset_lock.c is that drm_modeset_lock_init() was static-inline
(for no particularly good reason).
Fix that, and move crtc_ww_class into drm_modeset_lock.c.
Signed-off-by: Rob Clark <robdclark@gmail.com>
---
This is an alternative to the "drm: export crtc_ww_class" patch.
drivers/gpu/drm/drm_crtc.c | 2 --
drivers/gpu/drm/drm_modeset_lock.c | 13 +++++++++++++
include/drm/drm_modeset_lock.h | 12 +-----------
3 files changed, 14 insertions(+), 13 deletions(-)
diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
index cf2423d..5d994cc 100644
--- a/drivers/gpu/drm/drm_crtc.c
+++ b/drivers/gpu/drm/drm_crtc.c
@@ -102,8 +102,6 @@ int drm_crtc_force_disable_all(struct drm_device *dev)
}
EXPORT_SYMBOL(drm_crtc_force_disable_all);
-DEFINE_WW_CLASS(crtc_ww_class);
-
static unsigned int drm_num_crtcs(struct drm_device *dev)
{
unsigned int num = 0;
diff --git a/drivers/gpu/drm/drm_modeset_lock.c b/drivers/gpu/drm/drm_modeset_lock.c
index 61146f5..9059fe3 100644
--- a/drivers/gpu/drm/drm_modeset_lock.c
+++ b/drivers/gpu/drm/drm_modeset_lock.c
@@ -60,6 +60,8 @@
* lists and lookup data structures.
*/
+static DEFINE_WW_CLASS(crtc_ww_class);
+
/**
* drm_modeset_lock_all - take all modeset locks
* @dev: DRM device
@@ -398,6 +400,17 @@ int drm_modeset_backoff_interruptible(struct drm_modeset_acquire_ctx *ctx)
EXPORT_SYMBOL(drm_modeset_backoff_interruptible);
/**
+ * drm_modeset_lock_init - initialize lock
+ * @lock: lock to init
+ */
+void drm_modeset_lock_init(struct drm_modeset_lock *lock)
+{
+ ww_mutex_init(&lock->mutex, &crtc_ww_class);
+ INIT_LIST_HEAD(&lock->head);
+}
+EXPORT_SYMBOL(drm_modeset_lock_init);
+
+/**
* drm_modeset_lock - take modeset lock
* @lock: lock to take
* @ctx: acquire ctx
diff --git a/include/drm/drm_modeset_lock.h b/include/drm/drm_modeset_lock.h
index c5576fb..d918ce4 100644
--- a/include/drm/drm_modeset_lock.h
+++ b/include/drm/drm_modeset_lock.h
@@ -82,8 +82,6 @@ struct drm_modeset_lock {
struct list_head head;
};
-extern struct ww_class crtc_ww_class;
-
void drm_modeset_acquire_init(struct drm_modeset_acquire_ctx *ctx,
uint32_t flags);
void drm_modeset_acquire_fini(struct drm_modeset_acquire_ctx *ctx);
@@ -91,15 +89,7 @@ void drm_modeset_drop_locks(struct drm_modeset_acquire_ctx *ctx);
void drm_modeset_backoff(struct drm_modeset_acquire_ctx *ctx);
int drm_modeset_backoff_interruptible(struct drm_modeset_acquire_ctx *ctx);
-/**
- * drm_modeset_lock_init - initialize lock
- * @lock: lock to init
- */
-static inline void drm_modeset_lock_init(struct drm_modeset_lock *lock)
-{
- ww_mutex_init(&lock->mutex, &crtc_ww_class);
- INIT_LIST_HEAD(&lock->head);
-}
+void drm_modeset_lock_init(struct drm_modeset_lock *lock);
/**
* drm_modeset_lock_fini - cleanup lock
--
2.7.4
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] drm: don't let crtc_ww_class leak out
2016-11-14 22:40 [PATCH] drm: don't let crtc_ww_class leak out Rob Clark
@ 2016-11-15 7:33 ` Daniel Vetter
0 siblings, 0 replies; 2+ messages in thread
From: Daniel Vetter @ 2016-11-15 7:33 UTC (permalink / raw)
To: Rob Clark; +Cc: dri-devel
On Mon, Nov 14, 2016 at 05:40:57PM -0500, Rob Clark wrote:
> kbuild spotted this error, with drm/msm patches that add a new
> modeset-lock in the driver and driver built as a module:
>
> ERROR: "crtc_ww_class" [drivers/gpu/drm/msm/msm.ko] undefined!
>
> Really the only reason for crtc_ww_class not being internal to
> drm_modeset_lock.c is that drm_modeset_lock_init() was static-inline
> (for no particularly good reason).
>
> Fix that, and move crtc_ww_class into drm_modeset_lock.c.
>
> Signed-off-by: Rob Clark <robdclark@gmail.com>
Applied to drm-misc, thx.
-Daniel
> ---
> This is an alternative to the "drm: export crtc_ww_class" patch.
>
> drivers/gpu/drm/drm_crtc.c | 2 --
> drivers/gpu/drm/drm_modeset_lock.c | 13 +++++++++++++
> include/drm/drm_modeset_lock.h | 12 +-----------
> 3 files changed, 14 insertions(+), 13 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
> index cf2423d..5d994cc 100644
> --- a/drivers/gpu/drm/drm_crtc.c
> +++ b/drivers/gpu/drm/drm_crtc.c
> @@ -102,8 +102,6 @@ int drm_crtc_force_disable_all(struct drm_device *dev)
> }
> EXPORT_SYMBOL(drm_crtc_force_disable_all);
>
> -DEFINE_WW_CLASS(crtc_ww_class);
> -
> static unsigned int drm_num_crtcs(struct drm_device *dev)
> {
> unsigned int num = 0;
> diff --git a/drivers/gpu/drm/drm_modeset_lock.c b/drivers/gpu/drm/drm_modeset_lock.c
> index 61146f5..9059fe3 100644
> --- a/drivers/gpu/drm/drm_modeset_lock.c
> +++ b/drivers/gpu/drm/drm_modeset_lock.c
> @@ -60,6 +60,8 @@
> * lists and lookup data structures.
> */
>
> +static DEFINE_WW_CLASS(crtc_ww_class);
> +
> /**
> * drm_modeset_lock_all - take all modeset locks
> * @dev: DRM device
> @@ -398,6 +400,17 @@ int drm_modeset_backoff_interruptible(struct drm_modeset_acquire_ctx *ctx)
> EXPORT_SYMBOL(drm_modeset_backoff_interruptible);
>
> /**
> + * drm_modeset_lock_init - initialize lock
> + * @lock: lock to init
> + */
> +void drm_modeset_lock_init(struct drm_modeset_lock *lock)
> +{
> + ww_mutex_init(&lock->mutex, &crtc_ww_class);
> + INIT_LIST_HEAD(&lock->head);
> +}
> +EXPORT_SYMBOL(drm_modeset_lock_init);
> +
> +/**
> * drm_modeset_lock - take modeset lock
> * @lock: lock to take
> * @ctx: acquire ctx
> diff --git a/include/drm/drm_modeset_lock.h b/include/drm/drm_modeset_lock.h
> index c5576fb..d918ce4 100644
> --- a/include/drm/drm_modeset_lock.h
> +++ b/include/drm/drm_modeset_lock.h
> @@ -82,8 +82,6 @@ struct drm_modeset_lock {
> struct list_head head;
> };
>
> -extern struct ww_class crtc_ww_class;
> -
> void drm_modeset_acquire_init(struct drm_modeset_acquire_ctx *ctx,
> uint32_t flags);
> void drm_modeset_acquire_fini(struct drm_modeset_acquire_ctx *ctx);
> @@ -91,15 +89,7 @@ void drm_modeset_drop_locks(struct drm_modeset_acquire_ctx *ctx);
> void drm_modeset_backoff(struct drm_modeset_acquire_ctx *ctx);
> int drm_modeset_backoff_interruptible(struct drm_modeset_acquire_ctx *ctx);
>
> -/**
> - * drm_modeset_lock_init - initialize lock
> - * @lock: lock to init
> - */
> -static inline void drm_modeset_lock_init(struct drm_modeset_lock *lock)
> -{
> - ww_mutex_init(&lock->mutex, &crtc_ww_class);
> - INIT_LIST_HEAD(&lock->head);
> -}
> +void drm_modeset_lock_init(struct drm_modeset_lock *lock);
>
> /**
> * drm_modeset_lock_fini - cleanup lock
> --
> 2.7.4
>
--
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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-11-15 7:33 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-11-14 22:40 [PATCH] drm: don't let crtc_ww_class leak out Rob Clark
2016-11-15 7:33 ` Daniel Vetter
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).