From: <sunpeng.li@amd.com>
To: amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org
Cc: Leo Li <sunpeng.li@amd.com>, jerry.zuo@amd.com
Subject: [PATCH 1/2] drm/dp_aux: Use non-cyclic idr, add suffix option for aux device
Date: Fri, 12 Apr 2019 12:05:30 -0400 [thread overview]
Message-ID: <1555085131-8716-2-git-send-email-sunpeng.li@amd.com> (raw)
In-Reply-To: <1555085131-8716-1-git-send-email-sunpeng.li@amd.com>
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.
2. A suffix option is added to the aux device file name. It can be used
to identify the corresponding MST device.
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;
--
2.7.4
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
next prev parent reply other threads:[~2019-04-12 16:05 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 ` sunpeng.li [this message]
[not found] ` <1555085131-8716-2-git-send-email-sunpeng.li-5C7GfCeVMHo@public.gmane.org>
2019-04-16 22:16 ` [PATCH 1/2] drm/dp_aux: Use non-cyclic idr, add suffix option for aux device Lyude Paul
[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=1555085131-8716-2-git-send-email-sunpeng.li@amd.com \
--to=sunpeng.li@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=jerry.zuo@amd.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