* [PATCH DRM] drm: Introduce drm_global_item_{get/put}()
@ 2018-03-13 12:02 ` Haneen Mohammed
0 siblings, 0 replies; 6+ messages in thread
From: Haneen Mohammed @ 2018-03-13 12:02 UTC (permalink / raw)
To: Daniel Vetter, Gustavo Padovan, Sean Paul, David Airlie
Cc: outreachy-kernel, dri-devel, hamohammed.sa
For consistency with other reference counting APIs in the kernel,
introduce drm_global_item_{get/put} functions instead of
drm_global_item_{ref/unref}.
Compatibility aliases are added to keep existing code working.
The semantic patch scripts/coccinelle/api/drm-get-put.cocci has been
extended to account for the new helpers.
Signed-off-by: Haneen Mohammed <hamohammed.sa@gmail.com>
---
drivers/gpu/drm/drm_global.c | 43 +++++++++++++++++++++++++++-----
include/drm/drm_global.h | 2 ++
scripts/coccinelle/api/drm-get-put.cocci | 10 ++++++++
3 files changed, 49 insertions(+), 6 deletions(-)
diff --git a/drivers/gpu/drm/drm_global.c b/drivers/gpu/drm/drm_global.c
index b2dc21e..76cf948 100644
--- a/drivers/gpu/drm/drm_global.c
+++ b/drivers/gpu/drm/drm_global.c
@@ -64,7 +64,7 @@ void drm_global_release(void)
}
/**
- * drm_global_item_ref - Initialize and acquire reference to memory
+ * drm_global_item_get - Initialize and acquire reference to memory
* object
* @ref: Object for initialization
*
@@ -75,7 +75,7 @@ void drm_global_release(void)
* Returns:
* Zero on success, non-zero otherwise.
*/
-int drm_global_item_ref(struct drm_global_reference *ref)
+int drm_global_item_get(struct drm_global_reference *ref)
{
int ret = 0;
struct drm_global_item *item = &glob[ref->global_type];
@@ -107,10 +107,10 @@ int drm_global_item_ref(struct drm_global_reference *ref)
mutex_unlock(&item->mutex);
return ret;
}
-EXPORT_SYMBOL(drm_global_item_ref);
+EXPORT_SYMBOL(drm_global_item_get);
/**
- * drm_global_item_unref - Drop reference to memory
+ * drm_global_item_put - Drop reference to memory
* object
* @ref: Object being removed
*
@@ -120,7 +120,7 @@ EXPORT_SYMBOL(drm_global_item_ref);
*
*/
-void drm_global_item_unref(struct drm_global_reference *ref)
+void drm_global_item_put(struct drm_global_reference *ref)
{
struct drm_global_item *item = &glob[ref->global_type];
@@ -133,5 +133,36 @@ void drm_global_item_unref(struct drm_global_reference *ref)
}
mutex_unlock(&item->mutex);
}
-EXPORT_SYMBOL(drm_global_item_unref);
+EXPORT_SYMBOL(drm_global_item_put);
+/**
+ * drm_global_item_ref - Initialize and acquire reference to memory
+ * object
+ * @ref: Object for initialization
+ *
+ * This is a compatibility alias for drm_global_item_get() and should
+ * not be used by new code.
+ *
+ * Returns:
+ * Zero on success, non-zero otherwise.
+ */
+int drm_global_item_ref(struct drm_global_reference *ref)
+{
+ return drm_global_item_get(ref);
+}
+EXPORT_SYMBOL(drm_global_item_ref);
+
+/**
+ * drm_global_item_unref - Drop reference to memory
+ * object
+ * @ref: Object being removed
+ *
+ * This is a compatibility alias for drm_global_item_get() and should not
+ * be used by new code.
+ */
+
+void drm_global_item_unref(struct drm_global_reference *ref)
+{
+ drm_global_item_put(ref);
+}
+EXPORT_SYMBOL(drm_global_item_unref);
diff --git a/include/drm/drm_global.h b/include/drm/drm_global.h
index 3a83060..5eb6f0c 100644
--- a/include/drm/drm_global.h
+++ b/include/drm/drm_global.h
@@ -47,6 +47,8 @@ struct drm_global_reference {
void drm_global_init(void);
void drm_global_release(void);
+int drm_global_item_get(struct drm_global_reference *ref);
+void drm_global_item_put(struct drm_global_reference *ref);
int drm_global_item_ref(struct drm_global_reference *ref);
void drm_global_item_unref(struct drm_global_reference *ref);
diff --git a/scripts/coccinelle/api/drm-get-put.cocci b/scripts/coccinelle/api/drm-get-put.cocci
index 91fceb8..db1c465 100644
--- a/scripts/coccinelle/api/drm-get-put.cocci
+++ b/scripts/coccinelle/api/drm-get-put.cocci
@@ -54,6 +54,12 @@ expression object;
|
- drm_dev_unref(object)
+ drm_dev_put(object)
+|
+- drm_global_item_ref(object)
++ drm_global_item_get(object)
+|
+- drm_global_item_unref(object)
++ drm_global_item_put(object)
)
@r depends on report@
@@ -87,6 +93,10 @@ drm_property_unreference_blob@p(object)
drm_property_reference_blob@p(object)
|
drm_dev_unref@p(object)
+|
+drm_global_item_ref@p(object)
+|
+drm_global_item_unref@p(object)
)
@script:python depends on report@
--
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] 6+ messages in thread
* [PATCH DRM] drm: Introduce drm_global_item_{get/put}()
@ 2018-03-13 12:02 ` Haneen Mohammed
0 siblings, 0 replies; 6+ messages in thread
From: Haneen Mohammed @ 2018-03-13 12:02 UTC (permalink / raw)
To: Daniel Vetter, Gustavo Padovan, Sean Paul, David Airlie
Cc: outreachy-kernel, hamohammed.sa, dri-devel
For consistency with other reference counting APIs in the kernel,
introduce drm_global_item_{get/put} functions instead of
drm_global_item_{ref/unref}.
Compatibility aliases are added to keep existing code working.
The semantic patch scripts/coccinelle/api/drm-get-put.cocci has been
extended to account for the new helpers.
Signed-off-by: Haneen Mohammed <hamohammed.sa@gmail.com>
---
drivers/gpu/drm/drm_global.c | 43 +++++++++++++++++++++++++++-----
include/drm/drm_global.h | 2 ++
scripts/coccinelle/api/drm-get-put.cocci | 10 ++++++++
3 files changed, 49 insertions(+), 6 deletions(-)
diff --git a/drivers/gpu/drm/drm_global.c b/drivers/gpu/drm/drm_global.c
index b2dc21e..76cf948 100644
--- a/drivers/gpu/drm/drm_global.c
+++ b/drivers/gpu/drm/drm_global.c
@@ -64,7 +64,7 @@ void drm_global_release(void)
}
/**
- * drm_global_item_ref - Initialize and acquire reference to memory
+ * drm_global_item_get - Initialize and acquire reference to memory
* object
* @ref: Object for initialization
*
@@ -75,7 +75,7 @@ void drm_global_release(void)
* Returns:
* Zero on success, non-zero otherwise.
*/
-int drm_global_item_ref(struct drm_global_reference *ref)
+int drm_global_item_get(struct drm_global_reference *ref)
{
int ret = 0;
struct drm_global_item *item = &glob[ref->global_type];
@@ -107,10 +107,10 @@ int drm_global_item_ref(struct drm_global_reference *ref)
mutex_unlock(&item->mutex);
return ret;
}
-EXPORT_SYMBOL(drm_global_item_ref);
+EXPORT_SYMBOL(drm_global_item_get);
/**
- * drm_global_item_unref - Drop reference to memory
+ * drm_global_item_put - Drop reference to memory
* object
* @ref: Object being removed
*
@@ -120,7 +120,7 @@ EXPORT_SYMBOL(drm_global_item_ref);
*
*/
-void drm_global_item_unref(struct drm_global_reference *ref)
+void drm_global_item_put(struct drm_global_reference *ref)
{
struct drm_global_item *item = &glob[ref->global_type];
@@ -133,5 +133,36 @@ void drm_global_item_unref(struct drm_global_reference *ref)
}
mutex_unlock(&item->mutex);
}
-EXPORT_SYMBOL(drm_global_item_unref);
+EXPORT_SYMBOL(drm_global_item_put);
+/**
+ * drm_global_item_ref - Initialize and acquire reference to memory
+ * object
+ * @ref: Object for initialization
+ *
+ * This is a compatibility alias for drm_global_item_get() and should
+ * not be used by new code.
+ *
+ * Returns:
+ * Zero on success, non-zero otherwise.
+ */
+int drm_global_item_ref(struct drm_global_reference *ref)
+{
+ return drm_global_item_get(ref);
+}
+EXPORT_SYMBOL(drm_global_item_ref);
+
+/**
+ * drm_global_item_unref - Drop reference to memory
+ * object
+ * @ref: Object being removed
+ *
+ * This is a compatibility alias for drm_global_item_get() and should not
+ * be used by new code.
+ */
+
+void drm_global_item_unref(struct drm_global_reference *ref)
+{
+ drm_global_item_put(ref);
+}
+EXPORT_SYMBOL(drm_global_item_unref);
diff --git a/include/drm/drm_global.h b/include/drm/drm_global.h
index 3a83060..5eb6f0c 100644
--- a/include/drm/drm_global.h
+++ b/include/drm/drm_global.h
@@ -47,6 +47,8 @@ struct drm_global_reference {
void drm_global_init(void);
void drm_global_release(void);
+int drm_global_item_get(struct drm_global_reference *ref);
+void drm_global_item_put(struct drm_global_reference *ref);
int drm_global_item_ref(struct drm_global_reference *ref);
void drm_global_item_unref(struct drm_global_reference *ref);
diff --git a/scripts/coccinelle/api/drm-get-put.cocci b/scripts/coccinelle/api/drm-get-put.cocci
index 91fceb8..db1c465 100644
--- a/scripts/coccinelle/api/drm-get-put.cocci
+++ b/scripts/coccinelle/api/drm-get-put.cocci
@@ -54,6 +54,12 @@ expression object;
|
- drm_dev_unref(object)
+ drm_dev_put(object)
+|
+- drm_global_item_ref(object)
++ drm_global_item_get(object)
+|
+- drm_global_item_unref(object)
++ drm_global_item_put(object)
)
@r depends on report@
@@ -87,6 +93,10 @@ drm_property_unreference_blob@p(object)
drm_property_reference_blob@p(object)
|
drm_dev_unref@p(object)
+|
+drm_global_item_ref@p(object)
+|
+drm_global_item_unref@p(object)
)
@script:python depends on report@
--
2.7.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [Outreachy kernel] [PATCH DRM] drm: Introduce drm_global_item_{get/put}()
2018-03-13 12:02 ` Haneen Mohammed
@ 2018-03-19 21:06 ` Daniel Vetter
-1 siblings, 0 replies; 6+ messages in thread
From: Daniel Vetter @ 2018-03-19 21:06 UTC (permalink / raw)
To: Haneen Mohammed, Christian König, Thomas Hellstrom,
Sinclair Yeh, Alex Deucher
Cc: David Airlie, dri-devel, outreachy-kernel, Daniel Vetter
On Tue, Mar 13, 2018 at 1:02 PM, Haneen Mohammed
<hamohammed.sa@gmail.com> wrote:
> For consistency with other reference counting APIs in the kernel,
> introduce drm_global_item_{get/put} functions instead of
> drm_global_item_{ref/unref}.
>
> Compatibility aliases are added to keep existing code working.
>
> The semantic patch scripts/coccinelle/api/drm-get-put.cocci has been
> extended to account for the new helpers.
>
> Signed-off-by: Haneen Mohammed <hamohammed.sa@gmail.com>
Somehow this fell through the cracks. drm_global.c is only used by ttm
and vmwgfx, adding relevant maintainers.
-Daniel
> ---
> drivers/gpu/drm/drm_global.c | 43 +++++++++++++++++++++++++++-----
> include/drm/drm_global.h | 2 ++
> scripts/coccinelle/api/drm-get-put.cocci | 10 ++++++++
> 3 files changed, 49 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_global.c b/drivers/gpu/drm/drm_global.c
> index b2dc21e..76cf948 100644
> --- a/drivers/gpu/drm/drm_global.c
> +++ b/drivers/gpu/drm/drm_global.c
> @@ -64,7 +64,7 @@ void drm_global_release(void)
> }
>
> /**
> - * drm_global_item_ref - Initialize and acquire reference to memory
> + * drm_global_item_get - Initialize and acquire reference to memory
> * object
> * @ref: Object for initialization
> *
> @@ -75,7 +75,7 @@ void drm_global_release(void)
> * Returns:
> * Zero on success, non-zero otherwise.
> */
> -int drm_global_item_ref(struct drm_global_reference *ref)
> +int drm_global_item_get(struct drm_global_reference *ref)
> {
> int ret = 0;
> struct drm_global_item *item = &glob[ref->global_type];
> @@ -107,10 +107,10 @@ int drm_global_item_ref(struct drm_global_reference *ref)
> mutex_unlock(&item->mutex);
> return ret;
> }
> -EXPORT_SYMBOL(drm_global_item_ref);
> +EXPORT_SYMBOL(drm_global_item_get);
>
> /**
> - * drm_global_item_unref - Drop reference to memory
> + * drm_global_item_put - Drop reference to memory
> * object
> * @ref: Object being removed
> *
> @@ -120,7 +120,7 @@ EXPORT_SYMBOL(drm_global_item_ref);
> *
> */
>
> -void drm_global_item_unref(struct drm_global_reference *ref)
> +void drm_global_item_put(struct drm_global_reference *ref)
> {
> struct drm_global_item *item = &glob[ref->global_type];
>
> @@ -133,5 +133,36 @@ void drm_global_item_unref(struct drm_global_reference *ref)
> }
> mutex_unlock(&item->mutex);
> }
> -EXPORT_SYMBOL(drm_global_item_unref);
> +EXPORT_SYMBOL(drm_global_item_put);
>
> +/**
> + * drm_global_item_ref - Initialize and acquire reference to memory
> + * object
> + * @ref: Object for initialization
> + *
> + * This is a compatibility alias for drm_global_item_get() and should
> + * not be used by new code.
> + *
> + * Returns:
> + * Zero on success, non-zero otherwise.
> + */
> +int drm_global_item_ref(struct drm_global_reference *ref)
> +{
> + return drm_global_item_get(ref);
> +}
> +EXPORT_SYMBOL(drm_global_item_ref);
> +
> +/**
> + * drm_global_item_unref - Drop reference to memory
> + * object
> + * @ref: Object being removed
> + *
> + * This is a compatibility alias for drm_global_item_get() and should not
> + * be used by new code.
> + */
> +
> +void drm_global_item_unref(struct drm_global_reference *ref)
> +{
> + drm_global_item_put(ref);
> +}
> +EXPORT_SYMBOL(drm_global_item_unref);
> diff --git a/include/drm/drm_global.h b/include/drm/drm_global.h
> index 3a83060..5eb6f0c 100644
> --- a/include/drm/drm_global.h
> +++ b/include/drm/drm_global.h
> @@ -47,6 +47,8 @@ struct drm_global_reference {
>
> void drm_global_init(void);
> void drm_global_release(void);
> +int drm_global_item_get(struct drm_global_reference *ref);
> +void drm_global_item_put(struct drm_global_reference *ref);
> int drm_global_item_ref(struct drm_global_reference *ref);
> void drm_global_item_unref(struct drm_global_reference *ref);
>
> diff --git a/scripts/coccinelle/api/drm-get-put.cocci b/scripts/coccinelle/api/drm-get-put.cocci
> index 91fceb8..db1c465 100644
> --- a/scripts/coccinelle/api/drm-get-put.cocci
> +++ b/scripts/coccinelle/api/drm-get-put.cocci
> @@ -54,6 +54,12 @@ expression object;
> |
> - drm_dev_unref(object)
> + drm_dev_put(object)
> +|
> +- drm_global_item_ref(object)
> ++ drm_global_item_get(object)
> +|
> +- drm_global_item_unref(object)
> ++ drm_global_item_put(object)
> )
>
> @r depends on report@
> @@ -87,6 +93,10 @@ drm_property_unreference_blob@p(object)
> drm_property_reference_blob@p(object)
> |
> drm_dev_unref@p(object)
> +|
> +drm_global_item_ref@p(object)
> +|
> +drm_global_item_unref@p(object)
> )
>
> @script:python depends on report@
> --
> 2.7.4
>
> --
> You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to outreachy-kernel+unsubscribe@googlegroups.com.
> To post to this group, send email to outreachy-kernel@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/20180313120205.GA12094%40Haneen.
> For more options, visit https://groups.google.com/d/optout.
--
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - 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] 6+ messages in thread
* Re: [Outreachy kernel] [PATCH DRM] drm: Introduce drm_global_item_{get/put}()
@ 2018-03-19 21:06 ` Daniel Vetter
0 siblings, 0 replies; 6+ messages in thread
From: Daniel Vetter @ 2018-03-19 21:06 UTC (permalink / raw)
To: Haneen Mohammed, Christian König, Thomas Hellstrom,
Sinclair Yeh, Alex Deucher
Cc: Daniel Vetter, Gustavo Padovan, Sean Paul, David Airlie,
outreachy-kernel, dri-devel
On Tue, Mar 13, 2018 at 1:02 PM, Haneen Mohammed
<hamohammed.sa@gmail.com> wrote:
> For consistency with other reference counting APIs in the kernel,
> introduce drm_global_item_{get/put} functions instead of
> drm_global_item_{ref/unref}.
>
> Compatibility aliases are added to keep existing code working.
>
> The semantic patch scripts/coccinelle/api/drm-get-put.cocci has been
> extended to account for the new helpers.
>
> Signed-off-by: Haneen Mohammed <hamohammed.sa@gmail.com>
Somehow this fell through the cracks. drm_global.c is only used by ttm
and vmwgfx, adding relevant maintainers.
-Daniel
> ---
> drivers/gpu/drm/drm_global.c | 43 +++++++++++++++++++++++++++-----
> include/drm/drm_global.h | 2 ++
> scripts/coccinelle/api/drm-get-put.cocci | 10 ++++++++
> 3 files changed, 49 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_global.c b/drivers/gpu/drm/drm_global.c
> index b2dc21e..76cf948 100644
> --- a/drivers/gpu/drm/drm_global.c
> +++ b/drivers/gpu/drm/drm_global.c
> @@ -64,7 +64,7 @@ void drm_global_release(void)
> }
>
> /**
> - * drm_global_item_ref - Initialize and acquire reference to memory
> + * drm_global_item_get - Initialize and acquire reference to memory
> * object
> * @ref: Object for initialization
> *
> @@ -75,7 +75,7 @@ void drm_global_release(void)
> * Returns:
> * Zero on success, non-zero otherwise.
> */
> -int drm_global_item_ref(struct drm_global_reference *ref)
> +int drm_global_item_get(struct drm_global_reference *ref)
> {
> int ret = 0;
> struct drm_global_item *item = &glob[ref->global_type];
> @@ -107,10 +107,10 @@ int drm_global_item_ref(struct drm_global_reference *ref)
> mutex_unlock(&item->mutex);
> return ret;
> }
> -EXPORT_SYMBOL(drm_global_item_ref);
> +EXPORT_SYMBOL(drm_global_item_get);
>
> /**
> - * drm_global_item_unref - Drop reference to memory
> + * drm_global_item_put - Drop reference to memory
> * object
> * @ref: Object being removed
> *
> @@ -120,7 +120,7 @@ EXPORT_SYMBOL(drm_global_item_ref);
> *
> */
>
> -void drm_global_item_unref(struct drm_global_reference *ref)
> +void drm_global_item_put(struct drm_global_reference *ref)
> {
> struct drm_global_item *item = &glob[ref->global_type];
>
> @@ -133,5 +133,36 @@ void drm_global_item_unref(struct drm_global_reference *ref)
> }
> mutex_unlock(&item->mutex);
> }
> -EXPORT_SYMBOL(drm_global_item_unref);
> +EXPORT_SYMBOL(drm_global_item_put);
>
> +/**
> + * drm_global_item_ref - Initialize and acquire reference to memory
> + * object
> + * @ref: Object for initialization
> + *
> + * This is a compatibility alias for drm_global_item_get() and should
> + * not be used by new code.
> + *
> + * Returns:
> + * Zero on success, non-zero otherwise.
> + */
> +int drm_global_item_ref(struct drm_global_reference *ref)
> +{
> + return drm_global_item_get(ref);
> +}
> +EXPORT_SYMBOL(drm_global_item_ref);
> +
> +/**
> + * drm_global_item_unref - Drop reference to memory
> + * object
> + * @ref: Object being removed
> + *
> + * This is a compatibility alias for drm_global_item_get() and should not
> + * be used by new code.
> + */
> +
> +void drm_global_item_unref(struct drm_global_reference *ref)
> +{
> + drm_global_item_put(ref);
> +}
> +EXPORT_SYMBOL(drm_global_item_unref);
> diff --git a/include/drm/drm_global.h b/include/drm/drm_global.h
> index 3a83060..5eb6f0c 100644
> --- a/include/drm/drm_global.h
> +++ b/include/drm/drm_global.h
> @@ -47,6 +47,8 @@ struct drm_global_reference {
>
> void drm_global_init(void);
> void drm_global_release(void);
> +int drm_global_item_get(struct drm_global_reference *ref);
> +void drm_global_item_put(struct drm_global_reference *ref);
> int drm_global_item_ref(struct drm_global_reference *ref);
> void drm_global_item_unref(struct drm_global_reference *ref);
>
> diff --git a/scripts/coccinelle/api/drm-get-put.cocci b/scripts/coccinelle/api/drm-get-put.cocci
> index 91fceb8..db1c465 100644
> --- a/scripts/coccinelle/api/drm-get-put.cocci
> +++ b/scripts/coccinelle/api/drm-get-put.cocci
> @@ -54,6 +54,12 @@ expression object;
> |
> - drm_dev_unref(object)
> + drm_dev_put(object)
> +|
> +- drm_global_item_ref(object)
> ++ drm_global_item_get(object)
> +|
> +- drm_global_item_unref(object)
> ++ drm_global_item_put(object)
> )
>
> @r depends on report@
> @@ -87,6 +93,10 @@ drm_property_unreference_blob@p(object)
> drm_property_reference_blob@p(object)
> |
> drm_dev_unref@p(object)
> +|
> +drm_global_item_ref@p(object)
> +|
> +drm_global_item_unref@p(object)
> )
>
> @script:python depends on report@
> --
> 2.7.4
>
> --
> You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to outreachy-kernel+unsubscribe@googlegroups.com.
> To post to this group, send email to outreachy-kernel@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/20180313120205.GA12094%40Haneen.
> For more options, visit https://groups.google.com/d/optout.
--
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Outreachy kernel] [PATCH DRM] drm: Introduce drm_global_item_{get/put}()
2018-03-19 21:06 ` Daniel Vetter
@ 2018-03-20 14:17 ` Sinclair Yeh
-1 siblings, 0 replies; 6+ messages in thread
From: Sinclair Yeh @ 2018-03-20 14:17 UTC (permalink / raw)
To: Daniel Vetter
Cc: Haneen Mohammed, Thomas Hellstrom, David Airlie, dri-devel,
outreachy-kernel, Daniel Vetter, Christian König
LGTM
thanks!
Sinclair
On Mon, Mar 19, 2018 at 10:06:20PM +0100, Daniel Vetter wrote:
> On Tue, Mar 13, 2018 at 1:02 PM, Haneen Mohammed
> <hamohammed.sa@gmail.com> wrote:
> > For consistency with other reference counting APIs in the kernel,
> > introduce drm_global_item_{get/put} functions instead of
> > drm_global_item_{ref/unref}.
> >
> > Compatibility aliases are added to keep existing code working.
> >
> > The semantic patch scripts/coccinelle/api/drm-get-put.cocci has been
> > extended to account for the new helpers.
> >
> > Signed-off-by: Haneen Mohammed <hamohammed.sa@gmail.com>
>
> Somehow this fell through the cracks. drm_global.c is only used by ttm
> and vmwgfx, adding relevant maintainers.
> -Daniel
>
> > ---
> > drivers/gpu/drm/drm_global.c | 43 +++++++++++++++++++++++++++-----
> > include/drm/drm_global.h | 2 ++
> > scripts/coccinelle/api/drm-get-put.cocci | 10 ++++++++
> > 3 files changed, 49 insertions(+), 6 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/drm_global.c b/drivers/gpu/drm/drm_global.c
> > index b2dc21e..76cf948 100644
> > --- a/drivers/gpu/drm/drm_global.c
> > +++ b/drivers/gpu/drm/drm_global.c
> > @@ -64,7 +64,7 @@ void drm_global_release(void)
> > }
> >
> > /**
> > - * drm_global_item_ref - Initialize and acquire reference to memory
> > + * drm_global_item_get - Initialize and acquire reference to memory
> > * object
> > * @ref: Object for initialization
> > *
> > @@ -75,7 +75,7 @@ void drm_global_release(void)
> > * Returns:
> > * Zero on success, non-zero otherwise.
> > */
> > -int drm_global_item_ref(struct drm_global_reference *ref)
> > +int drm_global_item_get(struct drm_global_reference *ref)
> > {
> > int ret = 0;
> > struct drm_global_item *item = &glob[ref->global_type];
> > @@ -107,10 +107,10 @@ int drm_global_item_ref(struct drm_global_reference *ref)
> > mutex_unlock(&item->mutex);
> > return ret;
> > }
> > -EXPORT_SYMBOL(drm_global_item_ref);
> > +EXPORT_SYMBOL(drm_global_item_get);
> >
> > /**
> > - * drm_global_item_unref - Drop reference to memory
> > + * drm_global_item_put - Drop reference to memory
> > * object
> > * @ref: Object being removed
> > *
> > @@ -120,7 +120,7 @@ EXPORT_SYMBOL(drm_global_item_ref);
> > *
> > */
> >
> > -void drm_global_item_unref(struct drm_global_reference *ref)
> > +void drm_global_item_put(struct drm_global_reference *ref)
> > {
> > struct drm_global_item *item = &glob[ref->global_type];
> >
> > @@ -133,5 +133,36 @@ void drm_global_item_unref(struct drm_global_reference *ref)
> > }
> > mutex_unlock(&item->mutex);
> > }
> > -EXPORT_SYMBOL(drm_global_item_unref);
> > +EXPORT_SYMBOL(drm_global_item_put);
> >
> > +/**
> > + * drm_global_item_ref - Initialize and acquire reference to memory
> > + * object
> > + * @ref: Object for initialization
> > + *
> > + * This is a compatibility alias for drm_global_item_get() and should
> > + * not be used by new code.
> > + *
> > + * Returns:
> > + * Zero on success, non-zero otherwise.
> > + */
> > +int drm_global_item_ref(struct drm_global_reference *ref)
> > +{
> > + return drm_global_item_get(ref);
> > +}
> > +EXPORT_SYMBOL(drm_global_item_ref);
> > +
> > +/**
> > + * drm_global_item_unref - Drop reference to memory
> > + * object
> > + * @ref: Object being removed
> > + *
> > + * This is a compatibility alias for drm_global_item_get() and should not
> > + * be used by new code.
> > + */
> > +
> > +void drm_global_item_unref(struct drm_global_reference *ref)
> > +{
> > + drm_global_item_put(ref);
> > +}
> > +EXPORT_SYMBOL(drm_global_item_unref);
> > diff --git a/include/drm/drm_global.h b/include/drm/drm_global.h
> > index 3a83060..5eb6f0c 100644
> > --- a/include/drm/drm_global.h
> > +++ b/include/drm/drm_global.h
> > @@ -47,6 +47,8 @@ struct drm_global_reference {
> >
> > void drm_global_init(void);
> > void drm_global_release(void);
> > +int drm_global_item_get(struct drm_global_reference *ref);
> > +void drm_global_item_put(struct drm_global_reference *ref);
> > int drm_global_item_ref(struct drm_global_reference *ref);
> > void drm_global_item_unref(struct drm_global_reference *ref);
> >
> > diff --git a/scripts/coccinelle/api/drm-get-put.cocci b/scripts/coccinelle/api/drm-get-put.cocci
> > index 91fceb8..db1c465 100644
> > --- a/scripts/coccinelle/api/drm-get-put.cocci
> > +++ b/scripts/coccinelle/api/drm-get-put.cocci
> > @@ -54,6 +54,12 @@ expression object;
> > |
> > - drm_dev_unref(object)
> > + drm_dev_put(object)
> > +|
> > +- drm_global_item_ref(object)
> > ++ drm_global_item_get(object)
> > +|
> > +- drm_global_item_unref(object)
> > ++ drm_global_item_put(object)
> > )
> >
> > @r depends on report@
> > @@ -87,6 +93,10 @@ drm_property_unreference_blob@p(object)
> > drm_property_reference_blob@p(object)
> > |
> > drm_dev_unref@p(object)
> > +|
> > +drm_global_item_ref@p(object)
> > +|
> > +drm_global_item_unref@p(object)
> > )
> >
> > @script:python depends on report@
> > --
> > 2.7.4
> >
> > --
> > You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
> > To unsubscribe from this group and stop receiving emails from it, send an email to outreachy-kernel+unsubscribe@googlegroups.com.
> > To post to this group, send email to outreachy-kernel@googlegroups.com.
> > To view this discussion on the web visit https://urldefense.proofpoint.com/v2/url?u=https-3A__groups.google.com_d_msgid_outreachy-2Dkernel_20180313120205.GA12094-2540Haneen&d=DwIBaQ&c=uilaK90D4TOVoH58JNXRgQ&r=HaJ2a6NYExoV0cntAYcoqA&m=lzwHnvRNz61FBHPvl4HfIBLShUjYqqwqPa71bjZfD8s&s=DyQDIfuyq7myO_vPBFx2Q0Zcfw02bS6dmgl7-0Jpu_g&e=.
> > For more options, visit https://urldefense.proofpoint.com/v2/url?u=https-3A__groups.google.com_d_optout&d=DwIBaQ&c=uilaK90D4TOVoH58JNXRgQ&r=HaJ2a6NYExoV0cntAYcoqA&m=lzwHnvRNz61FBHPvl4HfIBLShUjYqqwqPa71bjZfD8s&s=e6bdl63FX0aaxoLxsziLGjrJMNg0yc4DcP9y9tRi7AM&e=.
>
>
>
> --
> Daniel Vetter
> Software Engineer, Intel Corporation
> +41 (0) 79 365 57 48 - https://urldefense.proofpoint.com/v2/url?u=http-3A__blog.ffwll.ch&d=DwIBaQ&c=uilaK90D4TOVoH58JNXRgQ&r=HaJ2a6NYExoV0cntAYcoqA&m=lzwHnvRNz61FBHPvl4HfIBLShUjYqqwqPa71bjZfD8s&s=__U-EO6t1rL8vdlANyHATVi-smcnlKxMwyznL5ntZ7s&e=
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Outreachy kernel] [PATCH DRM] drm: Introduce drm_global_item_{get/put}()
@ 2018-03-20 14:17 ` Sinclair Yeh
0 siblings, 0 replies; 6+ messages in thread
From: Sinclair Yeh @ 2018-03-20 14:17 UTC (permalink / raw)
To: Daniel Vetter
Cc: Haneen Mohammed, Christian König, Thomas Hellstrom,
Alex Deucher, Daniel Vetter, Gustavo Padovan, Sean Paul,
David Airlie, outreachy-kernel, dri-devel
LGTM
thanks!
Sinclair
On Mon, Mar 19, 2018 at 10:06:20PM +0100, Daniel Vetter wrote:
> On Tue, Mar 13, 2018 at 1:02 PM, Haneen Mohammed
> <hamohammed.sa@gmail.com> wrote:
> > For consistency with other reference counting APIs in the kernel,
> > introduce drm_global_item_{get/put} functions instead of
> > drm_global_item_{ref/unref}.
> >
> > Compatibility aliases are added to keep existing code working.
> >
> > The semantic patch scripts/coccinelle/api/drm-get-put.cocci has been
> > extended to account for the new helpers.
> >
> > Signed-off-by: Haneen Mohammed <hamohammed.sa@gmail.com>
>
> Somehow this fell through the cracks. drm_global.c is only used by ttm
> and vmwgfx, adding relevant maintainers.
> -Daniel
>
> > ---
> > drivers/gpu/drm/drm_global.c | 43 +++++++++++++++++++++++++++-----
> > include/drm/drm_global.h | 2 ++
> > scripts/coccinelle/api/drm-get-put.cocci | 10 ++++++++
> > 3 files changed, 49 insertions(+), 6 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/drm_global.c b/drivers/gpu/drm/drm_global.c
> > index b2dc21e..76cf948 100644
> > --- a/drivers/gpu/drm/drm_global.c
> > +++ b/drivers/gpu/drm/drm_global.c
> > @@ -64,7 +64,7 @@ void drm_global_release(void)
> > }
> >
> > /**
> > - * drm_global_item_ref - Initialize and acquire reference to memory
> > + * drm_global_item_get - Initialize and acquire reference to memory
> > * object
> > * @ref: Object for initialization
> > *
> > @@ -75,7 +75,7 @@ void drm_global_release(void)
> > * Returns:
> > * Zero on success, non-zero otherwise.
> > */
> > -int drm_global_item_ref(struct drm_global_reference *ref)
> > +int drm_global_item_get(struct drm_global_reference *ref)
> > {
> > int ret = 0;
> > struct drm_global_item *item = &glob[ref->global_type];
> > @@ -107,10 +107,10 @@ int drm_global_item_ref(struct drm_global_reference *ref)
> > mutex_unlock(&item->mutex);
> > return ret;
> > }
> > -EXPORT_SYMBOL(drm_global_item_ref);
> > +EXPORT_SYMBOL(drm_global_item_get);
> >
> > /**
> > - * drm_global_item_unref - Drop reference to memory
> > + * drm_global_item_put - Drop reference to memory
> > * object
> > * @ref: Object being removed
> > *
> > @@ -120,7 +120,7 @@ EXPORT_SYMBOL(drm_global_item_ref);
> > *
> > */
> >
> > -void drm_global_item_unref(struct drm_global_reference *ref)
> > +void drm_global_item_put(struct drm_global_reference *ref)
> > {
> > struct drm_global_item *item = &glob[ref->global_type];
> >
> > @@ -133,5 +133,36 @@ void drm_global_item_unref(struct drm_global_reference *ref)
> > }
> > mutex_unlock(&item->mutex);
> > }
> > -EXPORT_SYMBOL(drm_global_item_unref);
> > +EXPORT_SYMBOL(drm_global_item_put);
> >
> > +/**
> > + * drm_global_item_ref - Initialize and acquire reference to memory
> > + * object
> > + * @ref: Object for initialization
> > + *
> > + * This is a compatibility alias for drm_global_item_get() and should
> > + * not be used by new code.
> > + *
> > + * Returns:
> > + * Zero on success, non-zero otherwise.
> > + */
> > +int drm_global_item_ref(struct drm_global_reference *ref)
> > +{
> > + return drm_global_item_get(ref);
> > +}
> > +EXPORT_SYMBOL(drm_global_item_ref);
> > +
> > +/**
> > + * drm_global_item_unref - Drop reference to memory
> > + * object
> > + * @ref: Object being removed
> > + *
> > + * This is a compatibility alias for drm_global_item_get() and should not
> > + * be used by new code.
> > + */
> > +
> > +void drm_global_item_unref(struct drm_global_reference *ref)
> > +{
> > + drm_global_item_put(ref);
> > +}
> > +EXPORT_SYMBOL(drm_global_item_unref);
> > diff --git a/include/drm/drm_global.h b/include/drm/drm_global.h
> > index 3a83060..5eb6f0c 100644
> > --- a/include/drm/drm_global.h
> > +++ b/include/drm/drm_global.h
> > @@ -47,6 +47,8 @@ struct drm_global_reference {
> >
> > void drm_global_init(void);
> > void drm_global_release(void);
> > +int drm_global_item_get(struct drm_global_reference *ref);
> > +void drm_global_item_put(struct drm_global_reference *ref);
> > int drm_global_item_ref(struct drm_global_reference *ref);
> > void drm_global_item_unref(struct drm_global_reference *ref);
> >
> > diff --git a/scripts/coccinelle/api/drm-get-put.cocci b/scripts/coccinelle/api/drm-get-put.cocci
> > index 91fceb8..db1c465 100644
> > --- a/scripts/coccinelle/api/drm-get-put.cocci
> > +++ b/scripts/coccinelle/api/drm-get-put.cocci
> > @@ -54,6 +54,12 @@ expression object;
> > |
> > - drm_dev_unref(object)
> > + drm_dev_put(object)
> > +|
> > +- drm_global_item_ref(object)
> > ++ drm_global_item_get(object)
> > +|
> > +- drm_global_item_unref(object)
> > ++ drm_global_item_put(object)
> > )
> >
> > @r depends on report@
> > @@ -87,6 +93,10 @@ drm_property_unreference_blob@p(object)
> > drm_property_reference_blob@p(object)
> > |
> > drm_dev_unref@p(object)
> > +|
> > +drm_global_item_ref@p(object)
> > +|
> > +drm_global_item_unref@p(object)
> > )
> >
> > @script:python depends on report@
> > --
> > 2.7.4
> >
> > --
> > You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
> > To unsubscribe from this group and stop receiving emails from it, send an email to outreachy-kernel+unsubscribe@googlegroups.com.
> > To post to this group, send email to outreachy-kernel@googlegroups.com.
> > To view this discussion on the web visit https://urldefense.proofpoint.com/v2/url?u=https-3A__groups.google.com_d_msgid_outreachy-2Dkernel_20180313120205.GA12094-2540Haneen&d=DwIBaQ&c=uilaK90D4TOVoH58JNXRgQ&r=HaJ2a6NYExoV0cntAYcoqA&m=lzwHnvRNz61FBHPvl4HfIBLShUjYqqwqPa71bjZfD8s&s=DyQDIfuyq7myO_vPBFx2Q0Zcfw02bS6dmgl7-0Jpu_g&e=.
> > For more options, visit https://urldefense.proofpoint.com/v2/url?u=https-3A__groups.google.com_d_optout&d=DwIBaQ&c=uilaK90D4TOVoH58JNXRgQ&r=HaJ2a6NYExoV0cntAYcoqA&m=lzwHnvRNz61FBHPvl4HfIBLShUjYqqwqPa71bjZfD8s&s=e6bdl63FX0aaxoLxsziLGjrJMNg0yc4DcP9y9tRi7AM&e=.
>
>
>
> --
> Daniel Vetter
> Software Engineer, Intel Corporation
> +41 (0) 79 365 57 48 - https://urldefense.proofpoint.com/v2/url?u=http-3A__blog.ffwll.ch&d=DwIBaQ&c=uilaK90D4TOVoH58JNXRgQ&r=HaJ2a6NYExoV0cntAYcoqA&m=lzwHnvRNz61FBHPvl4HfIBLShUjYqqwqPa71bjZfD8s&s=__U-EO6t1rL8vdlANyHATVi-smcnlKxMwyznL5ntZ7s&e=
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2018-03-20 14:20 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-13 12:02 [PATCH DRM] drm: Introduce drm_global_item_{get/put}() Haneen Mohammed
2018-03-13 12:02 ` Haneen Mohammed
2018-03-19 21:06 ` [Outreachy kernel] " Daniel Vetter
2018-03-19 21:06 ` Daniel Vetter
2018-03-20 14:17 ` Sinclair Yeh
2018-03-20 14:17 ` Sinclair Yeh
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.