From: Lyude Paul <lyude-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
To: sunpeng.li-5C7GfCeVMHo@public.gmane.org,
amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org,
dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
Cc: jerry.zuo-5C7GfCeVMHo@public.gmane.org,
harry.wentland-5C7GfCeVMHo@public.gmane.org,
ville.syrjala-VuQAYsv1563Yd54FQh9/CA@public.gmane.org
Subject: Re: [PATCH 1/2] drm/dp_aux: Use non-cyclic idr, add suffix option for aux device
Date: Tue, 16 Apr 2019 18:16:33 -0400 [thread overview]
Message-ID: <d616d0485a41b93e3da660b936af64968b88ec5a.camel@redhat.com> (raw)
In-Reply-To: <1555085131-8716-2-git-send-email-sunpeng.li-5C7GfCeVMHo@public.gmane.org>
Sorry for the slow response, I've been really busy ;_;
On Fri, 2019-04-12 at 12:05 -0400, sunpeng.li@amd.com wrote:
> From: Leo Li <sunpeng.li@amd.com>
>
> In preparation for adding aux devices for DP MST:
>
> 1. A non-cyclic idr is used for the device minor version. That way,
> hotplug cycling MST devices won't needlessly increment the minor
> version index.
I really like this btw, cyclic idrs are really annoying for drm_dp_aux_dev,
even outside of MST (try reloading a drm driver a couple of times and you'll
understand ;). I think we should split this into another commit though
> 2. A suffix option is added to the aux device file name. It can be used
> to identify the corresponding MST device.
I like this idea, but I think there may be a better way that we can do this.
Using /dev/nvme* as an example, we have the standard dev paths (/dev/nvme0,
/dev/nvme0n1, etc.). But we can also access them through /dev/disk/by-
{id,label,partlabel,partuuid,path,uuid}.
So what if we added something similar for aux devices? We start off with the
standard /dev/drm_dp_aux*, then provide more descriptive symlinks and
directories:
(feel free to come up with better naming then this if you can)
/dev/drm_dp_aux/card0-DP-1 -> /dev/drm_dp_aux1
/dev/drm_dp_aux/card0-DP-2 -> /dev/drm_dp_aux2
etc.
>
> Signed-off-by: Leo Li <sunpeng.li@amd.com>
> ---
> drivers/gpu/drm/drm_crtc_helper_internal.h | 5 +++--
> drivers/gpu/drm/drm_dp_aux_dev.c | 8 ++++----
> drivers/gpu/drm/drm_dp_helper.c | 2 +-
> 3 files changed, 8 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_crtc_helper_internal.h
> b/drivers/gpu/drm/drm_crtc_helper_internal.h
> index b5ac158..9f0907b 100644
> --- a/drivers/gpu/drm/drm_crtc_helper_internal.h
> +++ b/drivers/gpu/drm/drm_crtc_helper_internal.h
> @@ -46,7 +46,7 @@ static inline int drm_fb_helper_modinit(void)
> #ifdef CONFIG_DRM_DP_AUX_CHARDEV
> int drm_dp_aux_dev_init(void);
> void drm_dp_aux_dev_exit(void);
> -int drm_dp_aux_register_devnode(struct drm_dp_aux *aux);
> +int drm_dp_aux_register_devnode(struct drm_dp_aux *aux, const char
> *suffix);
> void drm_dp_aux_unregister_devnode(struct drm_dp_aux *aux);
> #else
> static inline int drm_dp_aux_dev_init(void)
> @@ -58,7 +58,8 @@ static inline void drm_dp_aux_dev_exit(void)
> {
> }
>
> -static inline int drm_dp_aux_register_devnode(struct drm_dp_aux *aux)
> +static inline int drm_dp_aux_register_devnode(struct drm_dp_aux *aux,
> + const char *suffix)
> {
> return 0;
> }
> diff --git a/drivers/gpu/drm/drm_dp_aux_dev.c
> b/drivers/gpu/drm/drm_dp_aux_dev.c
> index 0e4f25d..2310a67 100644
> --- a/drivers/gpu/drm/drm_dp_aux_dev.c
> +++ b/drivers/gpu/drm/drm_dp_aux_dev.c
> @@ -80,8 +80,7 @@ static struct drm_dp_aux_dev *alloc_drm_dp_aux_dev(struct
> drm_dp_aux *aux)
> kref_init(&aux_dev->refcount);
>
> mutex_lock(&aux_idr_mutex);
> - index = idr_alloc_cyclic(&aux_idr, aux_dev, 0, DRM_AUX_MINORS,
> - GFP_KERNEL);
> + index = idr_alloc(&aux_idr, aux_dev, 0, DRM_AUX_MINORS, GFP_KERNEL);
> mutex_unlock(&aux_idr_mutex);
> if (index < 0) {
> kfree(aux_dev);
> @@ -290,7 +289,7 @@ void drm_dp_aux_unregister_devnode(struct drm_dp_aux
> *aux)
> kref_put(&aux_dev->refcount, release_drm_dp_aux_dev);
> }
>
> -int drm_dp_aux_register_devnode(struct drm_dp_aux *aux)
> +int drm_dp_aux_register_devnode(struct drm_dp_aux *aux, const char *suffix)
> {
> struct drm_dp_aux_dev *aux_dev;
> int res;
> @@ -301,7 +300,8 @@ int drm_dp_aux_register_devnode(struct drm_dp_aux *aux)
>
> aux_dev->dev = device_create(drm_dp_aux_dev_class, aux->dev,
> MKDEV(drm_dev_major, aux_dev->index),
> NULL,
> - "drm_dp_aux%d", aux_dev->index);
> + "drm_dp_aux%d%s", aux_dev->index,
> + suffix ? suffix : "");
> if (IS_ERR(aux_dev->dev)) {
> res = PTR_ERR(aux_dev->dev);
> aux_dev->dev = NULL;
> diff --git a/drivers/gpu/drm/drm_dp_helper.c
> b/drivers/gpu/drm/drm_dp_helper.c
> index e2266ac..13f1005 100644
> --- a/drivers/gpu/drm/drm_dp_helper.c
> +++ b/drivers/gpu/drm/drm_dp_helper.c
> @@ -1143,7 +1143,7 @@ int drm_dp_aux_register(struct drm_dp_aux *aux)
> strlcpy(aux->ddc.name, aux->name ? aux->name : dev_name(aux->dev),
> sizeof(aux->ddc.name));
>
> - ret = drm_dp_aux_register_devnode(aux);
> + ret = drm_dp_aux_register_devnode(aux, NULL);
> if (ret)
> return ret;
>
--
Cheers,
Lyude Paul
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
next prev parent reply other threads:[~2019-04-16 22:16 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-12 16:05 [RFC 0/2] Add AUX device entries for DP MST devices sunpeng.li
2019-04-12 16:05 ` [PATCH 1/2] drm/dp_aux: Use non-cyclic idr, add suffix option for aux device sunpeng.li
[not found] ` <1555085131-8716-2-git-send-email-sunpeng.li-5C7GfCeVMHo@public.gmane.org>
2019-04-16 22:16 ` Lyude Paul [this message]
[not found] ` <d616d0485a41b93e3da660b936af64968b88ec5a.camel-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2019-04-17 23:10 ` Li, Sun peng (Leo)
[not found] ` <dcbb8aaa-0855-b2a6-9aa1-d42ce441740a-5C7GfCeVMHo@public.gmane.org>
2019-04-22 17:39 ` Lyude Paul
[not found] ` <1555085131-8716-1-git-send-email-sunpeng.li-5C7GfCeVMHo@public.gmane.org>
2019-04-12 16:05 ` [PATCH 2/2] drm/dp_mst: Register aux-dev nodes for MST ports sunpeng.li-5C7GfCeVMHo
2019-04-16 22:22 ` Lyude Paul
[not found] ` <a67eaacd5601de0cab21b04d7432454892e47304.camel-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2019-04-17 13:09 ` Ville Syrjälä
2019-04-12 17:30 ` [RFC 0/2] Add AUX device entries for DP MST devices Ville Syrjälä
[not found] ` <20190412173011.GK3888-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2019-04-15 18:50 ` Li, Sun peng (Leo)
2019-04-16 15:28 ` Li, Sun peng (Leo)
[not found] ` <042b83bf-e256-2ff2-c7a6-b3128699b829-5C7GfCeVMHo@public.gmane.org>
2019-04-16 16:55 ` Ville Syrjälä
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=d616d0485a41b93e3da660b936af64968b88ec5a.camel@redhat.com \
--to=lyude-h+wxahxf7alqt0dzr+alfa@public.gmane.org \
--cc=amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
--cc=dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
--cc=harry.wentland-5C7GfCeVMHo@public.gmane.org \
--cc=jerry.zuo-5C7GfCeVMHo@public.gmane.org \
--cc=sunpeng.li-5C7GfCeVMHo@public.gmane.org \
--cc=ville.syrjala-VuQAYsv1563Yd54FQh9/CA@public.gmane.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