From: Sean Paul <seanpaul@chromium.org>
To: Thierry Reding <thierry.reding@gmail.com>
Cc: Daniel Vetter <daniel.vetter@intel.com>, dri-devel@lists.freedesktop.org
Subject: Re: [PATCH 1/6] drm: Rename drm_mode_object_get()
Date: Wed, 8 Feb 2017 14:23:54 -0500 [thread overview]
Message-ID: <20170208192354.GE14321@art_vandelay> (raw)
In-Reply-To: <20170208182408.5442-2-thierry.reding@gmail.com>
On Wed, Feb 08, 2017 at 07:24:03PM +0100, Thierry Reding wrote:
> From: Thierry Reding <treding@nvidia.com>
>
> Subsequent patches will introduce reference counting APIs that are more
> consistent with similar APIs throughout the Linux kernel. These APIs use
> the _get() and _put() suffixes and will collide with this existing
> function.
>
> Rename the function to drm_mode_object_add() which is a slightly more
> accurate description of what it does. Also the kerneldoc for this
> function gives an indication that it's badly named because it doesn't
> actually acquire a reference to anything.
>
Reviewed-by: Sean Paul <seanpaul@chromium.org>
> Signed-off-by: Thierry Reding <treding@nvidia.com>
> ---
> drivers/gpu/drm/drm_connector.c | 6 +++---
> drivers/gpu/drm/drm_crtc.c | 2 +-
> drivers/gpu/drm/drm_crtc_internal.h | 12 +++++-------
> drivers/gpu/drm/drm_encoder.c | 2 +-
> drivers/gpu/drm/drm_framebuffer.c | 4 ++--
> drivers/gpu/drm/drm_mode_object.c | 18 +++++++-----------
> drivers/gpu/drm/drm_modes.c | 2 +-
> drivers/gpu/drm/drm_plane.c | 2 +-
> drivers/gpu/drm/drm_property.c | 6 +++---
> 9 files changed, 24 insertions(+), 30 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_connector.c b/drivers/gpu/drm/drm_connector.c
> index 45464c8b797d..0616062b055a 100644
> --- a/drivers/gpu/drm/drm_connector.c
> +++ b/drivers/gpu/drm/drm_connector.c
> @@ -189,9 +189,9 @@ int drm_connector_init(struct drm_device *dev,
> struct ida *connector_ida =
> &drm_connector_enum_list[connector_type].ida;
>
> - ret = drm_mode_object_get_reg(dev, &connector->base,
> - DRM_MODE_OBJECT_CONNECTOR,
> - false, drm_connector_free);
> + ret = __drm_mode_object_add(dev, &connector->base,
> + DRM_MODE_OBJECT_CONNECTOR,
> + false, drm_connector_free);
> if (ret)
> return ret;
>
> diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
> index 6915f897bd8e..e2284539f82c 100644
> --- a/drivers/gpu/drm/drm_crtc.c
> +++ b/drivers/gpu/drm/drm_crtc.c
> @@ -282,7 +282,7 @@ int drm_crtc_init_with_planes(struct drm_device *dev, struct drm_crtc *crtc,
> spin_lock_init(&crtc->commit_lock);
>
> drm_modeset_lock_init(&crtc->mutex);
> - ret = drm_mode_object_get(dev, &crtc->base, DRM_MODE_OBJECT_CRTC);
> + ret = drm_mode_object_add(dev, &crtc->base, DRM_MODE_OBJECT_CRTC);
> if (ret)
> return ret;
>
> diff --git a/drivers/gpu/drm/drm_crtc_internal.h b/drivers/gpu/drm/drm_crtc_internal.h
> index 955c5690bf64..43bbf48ee129 100644
> --- a/drivers/gpu/drm/drm_crtc_internal.h
> +++ b/drivers/gpu/drm/drm_crtc_internal.h
> @@ -98,15 +98,13 @@ int drm_mode_destroyblob_ioctl(struct drm_device *dev,
> void *data, struct drm_file *file_priv);
>
> /* drm_mode_object.c */
> -int drm_mode_object_get_reg(struct drm_device *dev,
> - struct drm_mode_object *obj,
> - uint32_t obj_type,
> - bool register_obj,
> - void (*obj_free_cb)(struct kref *kref));
> +int __drm_mode_object_add(struct drm_device *dev, struct drm_mode_object *obj,
> + uint32_t obj_type, bool register_obj,
> + void (*obj_free_cb)(struct kref *kref));
> +int drm_mode_object_add(struct drm_device *dev, struct drm_mode_object *obj,
> + uint32_t obj_type);
> void drm_mode_object_register(struct drm_device *dev,
> struct drm_mode_object *obj);
> -int drm_mode_object_get(struct drm_device *dev,
> - struct drm_mode_object *obj, uint32_t obj_type);
> struct drm_mode_object *__drm_mode_object_find(struct drm_device *dev,
> uint32_t id, uint32_t type);
> void drm_mode_object_unregister(struct drm_device *dev,
> diff --git a/drivers/gpu/drm/drm_encoder.c b/drivers/gpu/drm/drm_encoder.c
> index 129450713bb7..634ae0244ea9 100644
> --- a/drivers/gpu/drm/drm_encoder.c
> +++ b/drivers/gpu/drm/drm_encoder.c
> @@ -110,7 +110,7 @@ int drm_encoder_init(struct drm_device *dev,
> {
> int ret;
>
> - ret = drm_mode_object_get(dev, &encoder->base, DRM_MODE_OBJECT_ENCODER);
> + ret = drm_mode_object_add(dev, &encoder->base, DRM_MODE_OBJECT_ENCODER);
> if (ret)
> return ret;
>
> diff --git a/drivers/gpu/drm/drm_framebuffer.c b/drivers/gpu/drm/drm_framebuffer.c
> index 28a0108a1ab8..11daa24692aa 100644
> --- a/drivers/gpu/drm/drm_framebuffer.c
> +++ b/drivers/gpu/drm/drm_framebuffer.c
> @@ -638,8 +638,8 @@ int drm_framebuffer_init(struct drm_device *dev, struct drm_framebuffer *fb,
>
> fb->funcs = funcs;
>
> - ret = drm_mode_object_get_reg(dev, &fb->base, DRM_MODE_OBJECT_FB,
> - false, drm_framebuffer_free);
> + ret = __drm_mode_object_add(dev, &fb->base, DRM_MODE_OBJECT_FB,
> + false, drm_framebuffer_free);
> if (ret)
> goto out;
>
> diff --git a/drivers/gpu/drm/drm_mode_object.c b/drivers/gpu/drm/drm_mode_object.c
> index 220a6c1f4ab9..3b405dbf1b8d 100644
> --- a/drivers/gpu/drm/drm_mode_object.c
> +++ b/drivers/gpu/drm/drm_mode_object.c
> @@ -31,11 +31,9 @@
> * Internal function to assign a slot in the object idr and optionally
> * register the object into the idr.
> */
> -int drm_mode_object_get_reg(struct drm_device *dev,
> - struct drm_mode_object *obj,
> - uint32_t obj_type,
> - bool register_obj,
> - void (*obj_free_cb)(struct kref *kref))
> +int __drm_mode_object_add(struct drm_device *dev, struct drm_mode_object *obj,
> + uint32_t obj_type, bool register_obj,
> + void (*obj_free_cb)(struct kref *kref))
> {
> int ret;
>
> @@ -59,23 +57,21 @@ int drm_mode_object_get_reg(struct drm_device *dev,
> }
>
> /**
> - * drm_mode_object_get - allocate a new modeset identifier
> + * drm_mode_object_add - allocate a new modeset identifier
> * @dev: DRM device
> * @obj: object pointer, used to generate unique ID
> * @obj_type: object type
> *
> * Create a unique identifier based on @ptr in @dev's identifier space. Used
> - * for tracking modes, CRTCs and connectors. Note that despite the _get postfix
> - * modeset identifiers are _not_ reference counted. Hence don't use this for
> - * reference counted modeset objects like framebuffers.
> + * for tracking modes, CRTCs and connectors.
> *
> * Returns:
> * Zero on success, error code on failure.
> */
> -int drm_mode_object_get(struct drm_device *dev,
> +int drm_mode_object_add(struct drm_device *dev,
> struct drm_mode_object *obj, uint32_t obj_type)
> {
> - return drm_mode_object_get_reg(dev, obj, obj_type, true, NULL);
> + return __drm_mode_object_add(dev, obj, obj_type, true, NULL);
> }
>
> void drm_mode_object_register(struct drm_device *dev,
> diff --git a/drivers/gpu/drm/drm_modes.c b/drivers/gpu/drm/drm_modes.c
> index fd22c1c891bf..f2493b9b82e6 100644
> --- a/drivers/gpu/drm/drm_modes.c
> +++ b/drivers/gpu/drm/drm_modes.c
> @@ -71,7 +71,7 @@ struct drm_display_mode *drm_mode_create(struct drm_device *dev)
> if (!nmode)
> return NULL;
>
> - if (drm_mode_object_get(dev, &nmode->base, DRM_MODE_OBJECT_MODE)) {
> + if (drm_mode_object_add(dev, &nmode->base, DRM_MODE_OBJECT_MODE)) {
> kfree(nmode);
> return NULL;
> }
> diff --git a/drivers/gpu/drm/drm_plane.c b/drivers/gpu/drm/drm_plane.c
> index c464fc4a874d..f42590049a3a 100644
> --- a/drivers/gpu/drm/drm_plane.c
> +++ b/drivers/gpu/drm/drm_plane.c
> @@ -88,7 +88,7 @@ int drm_universal_plane_init(struct drm_device *dev, struct drm_plane *plane,
> struct drm_mode_config *config = &dev->mode_config;
> int ret;
>
> - ret = drm_mode_object_get(dev, &plane->base, DRM_MODE_OBJECT_PLANE);
> + ret = drm_mode_object_add(dev, &plane->base, DRM_MODE_OBJECT_PLANE);
> if (ret)
> return ret;
>
> diff --git a/drivers/gpu/drm/drm_property.c b/drivers/gpu/drm/drm_property.c
> index 7fc070f3e49e..411e470369c0 100644
> --- a/drivers/gpu/drm/drm_property.c
> +++ b/drivers/gpu/drm/drm_property.c
> @@ -91,7 +91,7 @@ struct drm_property *drm_property_create(struct drm_device *dev, int flags,
> goto fail;
> }
>
> - ret = drm_mode_object_get(dev, &property->base, DRM_MODE_OBJECT_PROPERTY);
> + ret = drm_mode_object_add(dev, &property->base, DRM_MODE_OBJECT_PROPERTY);
> if (ret)
> goto fail;
>
> @@ -570,8 +570,8 @@ drm_property_create_blob(struct drm_device *dev, size_t length,
> if (data)
> memcpy(blob->data, data, length);
>
> - ret = drm_mode_object_get_reg(dev, &blob->base, DRM_MODE_OBJECT_BLOB,
> - true, drm_property_free_blob);
> + ret = __drm_mode_object_add(dev, &blob->base, DRM_MODE_OBJECT_BLOB,
> + true, drm_property_free_blob);
> if (ret) {
> kfree(blob);
> return ERR_PTR(-EINVAL);
> --
> 2.11.1
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
--
Sean Paul, Software Engineer, Google / Chromium OS
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
next prev parent reply other threads:[~2017-02-08 19:23 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-08 18:24 [PATCH 0/6] drm: Introduce consistent reference counting APIs Thierry Reding
2017-02-08 18:24 ` [PATCH 1/6] drm: Rename drm_mode_object_get() Thierry Reding
2017-02-08 19:23 ` Sean Paul [this message]
2017-02-08 18:24 ` [PATCH 2/6] drm: Introduce drm_mode_object_{get,put}() Thierry Reding
2017-02-08 19:28 ` Sean Paul
2017-02-09 17:08 ` Daniel Vetter
2017-02-09 20:41 ` Thierry Reding
2017-02-09 21:55 ` Emil Velikov
2017-02-14 20:12 ` Daniel Vetter
2017-02-08 18:24 ` [PATCH 3/6] drm: Introduce drm_connector_{get,put}() Thierry Reding
2017-02-08 19:33 ` Sean Paul
2017-02-08 18:24 ` [PATCH 4/6] drm: Introduce drm_framebuffer_{get,put}() Thierry Reding
2017-02-08 19:36 ` Sean Paul
2017-02-08 18:24 ` [PATCH 5/6] drm: Introduce drm_gem_object_{get,put}() Thierry Reding
2017-02-08 19:41 ` Sean Paul
2017-02-08 18:24 ` [PATCH 6/6] drm: Introduce drm_property_blob_{get,put}() Thierry Reding
2017-02-08 19:45 ` Sean Paul
2017-02-09 14:10 ` [PATCH 0/6] drm: Introduce consistent reference counting APIs Jani Nikula
2017-02-09 17:09 ` Daniel Vetter
2017-02-09 17:39 ` Jani Nikula
2017-02-09 19:07 ` Daniel Vetter
2017-02-09 20:39 ` Thierry Reding
2017-02-10 7:29 ` Jani Nikula
2017-02-10 15:58 ` Daniel Vetter
2017-02-10 14:47 ` Christian König
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=20170208192354.GE14321@art_vandelay \
--to=seanpaul@chromium.org \
--cc=daniel.vetter@intel.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=thierry.reding@gmail.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