Skip to contentSkip to conversation

drm/dp: Use non-cyclic idr

PATCH In review [email protected] 6 participants 10 messages Apr 22, 2019 – Apr 24, 2019 4 messages not in the archive

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/3 drm/dp: Use non-cyclic idr

From: Leo Li <[email protected]>

In preparation for adding aux devices for DP MST, make the IDR non-cyclic. That way, hotplug cycling MST devices won't needlessly increment the minor version index.

---
 drivers/gpu/drm/drm_dp_aux_dev.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/gpu/drm/drm_dp_aux_dev.c +1 -2
index 0e4f25d..6d84611 100644
@@ -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);
Signature · 6 lines
2.7.4

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#1 lore raw

PATCH 2/3 drm/dp_mst: Expose build_mst_prop_path()

From: Leo Li <[email protected]>

To give identifiable attributes to MST DP aux devices, we can use the MST relative address. Expose this function for later use.

---
 drivers/gpu/drm/drm_dp_mst_topology.c | 4 ++--
 include/drm/drm_dp_mst_helper.h       | 4 ++++
 2 files changed, 6 insertions(+), 2 deletions(-)
drivers/gpu/drm/drm_dp_mst_topology.c +2 -2
index 2ab16c9..86ff8e2 100644
@@ -1120,7 +1120,7 @@ static void drm_dp_check_mstb_guid(struct drm_dp_mst_branch *mstb, u8 *guid)
 	}
 }
 
-static void build_mst_prop_path(const struct drm_dp_mst_branch *mstb,
+void drm_dp_build_mst_prop_path(const struct drm_dp_mst_branch *mstb,
 				int pnum,
 				char *proppath,
 				size_t proppath_size)
@@ -1202,7 +1202,7 @@ static void drm_dp_add_port(struct drm_dp_mst_branch *mstb,
 	if (created && !port->input) {
 		char proppath[255];
 
-		build_mst_prop_path(mstb, port->port_num, proppath, sizeof(proppath));
+		drm_dp_build_mst_prop_path(mstb, port->port_num, proppath, sizeof(proppath));
 		port->connector = (*mstb->mgr->cbs->add_connector)(mstb->mgr, port, proppath);
 		if (!port->connector) {
 			/* remove it from the port list */
include/drm/drm_dp_mst_helper.h +4 -0
index 371cc28..81c8d79 100644
@@ -602,6 +602,10 @@ void drm_dp_mst_deallocate_vcpi(struct drm_dp_mst_topology_mgr *mgr,
 int drm_dp_find_vcpi_slots(struct drm_dp_mst_topology_mgr *mgr,
 			   int pbn);
 
+void drm_dp_build_mst_prop_path(const struct drm_dp_mst_branch *mstb,
+				   int pnum,
+				   char *proppath,
+				   size_t proppath_size);
 
 int drm_dp_update_payload_part1(struct drm_dp_mst_topology_mgr *mgr);
 
Signature · 6 lines
2.7.4

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Reviewed-by on v1 2/3
#2 lore raw

Re: [PATCH 2/3] drm/dp_mst: Expose build_mst_prop_path()

Quoted 16 lines · On Mon, Apr 22, 2019 at 07:56:27PM -0400, [email protected] wrote:

From: Leo Li <[email protected]>

To give identifiable attributes to MST DP aux devices, we can use the MST relative address. Expose this function for later use.

---
 drivers/gpu/drm/drm_dp_mst_topology.c | 4 ++--
 include/drm/drm_dp_mst_helper.h       | 4 ++++
 2 files changed, 6 insertions(+), 2 deletions(-)
drivers/gpu/drm/drm_dp_mst_topology.c +0 -0
index 2ab16c9..86ff8e2 100644

drivers/gpu/drm/drm_dp_mst_topology.c static void drm_dp_check_mstb_guid(struct drm_dp_mst_branch *mstb, u8 *guid) · line 1126

Quoted 8 lines
drivers/gpu/drm/drm_dp_mst_topology.c +1 -1
@@ -1120,7 +1120,7 @@ static void drm_dp_check_mstb_guid(struct drm_dp_mst_branch *mstb, u8 *guid)
 	}
 }
 
-static void build_mst_prop_path(const struct drm_dp_mst_branch *mstb,
+void drm_dp_build_mst_prop_path(const struct drm_dp_mst_branch *mstb,
 				int pnum,
 				char *proppath,
 				size_t proppath_size)

I was wondering if we need to export this but looks like both drm_dp_mst_topology.o and drm_dp_aux_dev.o both end up in drm_kms_helper.ko, so the answer is no.

Quoted 26 lines
drivers/gpu/drm/drm_dp_mst_topology.c +1 -1
@@ -1202,7 +1202,7 @@ static void drm_dp_add_port(struct drm_dp_mst_branch *mstb,
 	if (created && !port->input) {
 		char proppath[255];
 
-		build_mst_prop_path(mstb, port->port_num, proppath, sizeof(proppath));
+		drm_dp_build_mst_prop_path(mstb, port->port_num, proppath, sizeof(proppath));
 		port->connector = (*mstb->mgr->cbs->add_connector)(mstb->mgr, port, proppath);
 		if (!port->connector) {
 			/* remove it from the port list */
include/drm/drm_dp_mst_helper.h +4 -0
index 371cc28..81c8d79 100644
@@ -602,6 +602,10 @@ void drm_dp_mst_deallocate_vcpi(struct drm_dp_mst_topology_mgr *mgr,
 int drm_dp_find_vcpi_slots(struct drm_dp_mst_topology_mgr *mgr,
 			   int pbn);
 
+void drm_dp_build_mst_prop_path(const struct drm_dp_mst_branch *mstb,
+				   int pnum,
+				   char *proppath,
+				   size_t proppath_size);
 
 int drm_dp_update_payload_part1(struct drm_dp_mst_topology_mgr *mgr);
 
Signature · 1 line
2.7.4
Signature · 6 lines
Ville Syrjälä
Intel
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#3 lore raw

Re: [PATCH 2/3] drm/dp_mst: Expose build_mst_prop_path()

In reply to [email protected]

Closer, but are we sure we want to use the MST prop path for this? Why not add a sysfs attribute with the corresponding DRM connector name instead since the connector itself will have a path property. That way we can associate aux devices for eDP and DP devices with their corresponding connectors as well

Quoted 56 lines · On Mon, 2019-04-22 at 19:56 -0400, [email protected] wrote:

From: Leo Li <[email protected]>

To give identifiable attributes to MST DP aux devices, we can use the MST relative address. Expose this function for later use.

---
 drivers/gpu/drm/drm_dp_mst_topology.c | 4 ++--
 include/drm/drm_dp_mst_helper.h       | 4 ++++
 2 files changed, 6 insertions(+), 2 deletions(-)
drivers/gpu/drm/drm_dp_mst_topology.c +1 -1
index 2ab16c9..86ff8e2 100644
@@ -1120,7 +1120,7 @@ static void drm_dp_check_mstb_guid(struct
 drm_dp_mst_branch *mstb, u8 *guid)
 	}
 }
 
-static void build_mst_prop_path(const struct drm_dp_mst_branch *mstb,
+void drm_dp_build_mst_prop_path(const struct drm_dp_mst_branch *mstb,
 				int pnum,
 				char *proppath,
drivers/gpu/drm/drm_dp_mst_topology.c +1 -1
 				size_t proppath_size)
@@ -1202,7 +1202,7 @@ static void drm_dp_add_port(struct drm_dp_mst_branch
 *mstb,
 	if (created && !port->input) {
 		char proppath[255];
 
-		build_mst_prop_path(mstb, port->port_num, proppath,
 sizeof(proppath));
+		drm_dp_build_mst_prop_path(mstb, port->port_num, proppath,
 sizeof(proppath));

port->connector = (*mstb->mgr->cbs->add_connector)(mstb->mgr,
port, proppath);

drivers/gpu/drm/drm_dp_mst_topology.c +0 -0
 		if (!port->connector) {
 			/* remove it from the port list */
include/drm/drm_dp_mst_helper.h +4 -0
index 371cc28..81c8d79 100644
@@ -602,6 +602,10 @@ void drm_dp_mst_deallocate_vcpi(struct
 drm_dp_mst_topology_mgr *mgr,
 int drm_dp_find_vcpi_slots(struct drm_dp_mst_topology_mgr *mgr,
 			   int pbn);
 
+void drm_dp_build_mst_prop_path(const struct drm_dp_mst_branch *mstb,
+				   int pnum,
+				   char *proppath,
+				   size_t proppath_size);
 
 int drm_dp_update_payload_part1(struct drm_dp_mst_topology_mgr *mgr);
Signature · 7 lines
Cheers,
	Lyude Paul

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

A message that is not in the archive (sent off-list or not yet received): 4575edc89d88122baf2cf8dd1e12ea34a69cbb7b.camel-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org

#5 lore raw

Re: [PATCH 2/3] drm/dp_mst: Expose build_mst_prop_path()

Quoted 4 lines · Lyude Paul

Closer, but are we sure we want to use the MST prop path for this? Why not add a sysfs attribute with the corresponding DRM connector name instead since the connector itself will have a path property. That way we can associate aux devices for eDP and DP devices with their corresponding connectors as well

I thought about that as well, but I hit a wall when trying to get the SST connector from the aux device. Perhaps there's a simpler way that I'm overlooking?

It's easier for MST, since the mst_port can be obtained via container_of dp_aux. port->connector would then give what we want.

For SST though, each driver calls drm_aux_register() with an aux struct that they've initialized. I'm not sure how I can reliably get the drm_connector from that.

Maybe drm_dp_aux should have a back reference to the connector? FWICT all drivers using drm_aux_register() should be able to provide the associated connector when calling it.

Leo

Quoted 51 lines · On Mon, 2019-04-22 at 19:56 -0400, [email protected] wrote:
Quoted 49 lines

From: Leo Li <[email protected]>

To give identifiable attributes to MST DP aux devices, we can use the MST relative address. Expose this function for later use.

---
  drivers/gpu/drm/drm_dp_mst_topology.c | 4 ++--
  include/drm/drm_dp_mst_helper.h       | 4 ++++
  2 files changed, 6 insertions(+), 2 deletions(-)
drivers/gpu/drm/drm_dp_mst_topology.c +1 -1
index 2ab16c9..86ff8e2 100644
@@ -1120,7 +1120,7 @@ static void drm_dp_check_mstb_guid(struct
 drm_dp_mst_branch *mstb, u8 *guid)
  	}
  }
 
-static void build_mst_prop_path(const struct drm_dp_mst_branch *mstb,
+void drm_dp_build_mst_prop_path(const struct drm_dp_mst_branch *mstb,
  				int pnum,
  				char *proppath,

size_t proppath_size)

drivers/gpu/drm/drm_dp_mst_topology.c +1 -1
@@ -1202,7 +1202,7 @@ static void drm_dp_add_port(struct drm_dp_mst_branch
 *mstb,
  	if (created && !port->input) {
  		char proppath[255];
 
-		build_mst_prop_path(mstb, port->port_num, proppath,
 sizeof(proppath));
+		drm_dp_build_mst_prop_path(mstb, port->port_num, proppath,
 sizeof(proppath));

port->connector = (*mstb->mgr->cbs->add_connector)(mstb->mgr,
port, proppath);
if (!port->connector) {
/* remove it from the port list */

include/drm/drm_dp_mst_helper.h +0 -0
index 371cc28..81c8d79 100644
@@ -602,6 +602,10 @@ void drm_dp_mst_deallocate_vcpi(struct
 drm_dp_mst_topology_mgr *mgr,
  int drm_dp_find_vcpi_slots(struct drm_dp_mst_topology_mgr *mgr,
  			   int pbn);
 
Quoted 7 lines

include/drm/drm_dp_mst_helper.h void drm_dp_mst_deallocate_vcpi(struct drm_dp_mst_topology_mgr *mgr, · line 610

Quoted 7 lines
include/drm/drm_dp_mst_helper.h +4 -0
+void drm_dp_build_mst_prop_path(const struct drm_dp_mst_branch *mstb,
+				   int pnum,
+				   char *proppath,
+				   size_t proppath_size);
 
  int drm_dp_update_payload_part1(struct drm_dp_mst_topology_mgr *mgr);

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): d45af824-bda7-a0d4-0a6d-b51c199c3412-5C7GfCeVMHo@public.gmane.org

#7 lore raw

Re: [PATCH 2/3] drm/dp_mst: Expose build_mst_prop_path()

Quoted 13 lines · Sun peng (Leo)
Quoted 4 lines · Lyude Paul

Closer, but are we sure we want to use the MST prop path for this? Why not add a sysfs attribute with the corresponding DRM connector name instead since the connector itself will have a path property. That way we can associate aux devices for eDP and DP devices with their corresponding connectors as well

I thought about that as well, but I hit a wall when trying to get the SST connector from the aux device. Perhaps there's a simpler way that I'm overlooking?

Quoted 6 lines

It's easier for MST, since the mst_port can be obtained via container_of dp_aux. port->connector would then give what we want.

For SST though, each driver calls drm_aux_register() with an aux struct that they've initialized. I'm not sure how I can reliably get the drm_connector from that.

On i915 the aux is a child of the connector, so no extra attributes/links needed. Maybe other drivers should/could follow that apporach as well?

Signature · 6 lines
Ville Syrjälä
Intel
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): [email protected]

#9 lore raw

Re: [PATCH 2/3] drm/dp_mst: Expose build_mst_prop_path()

Quoted 20 lines · Ville Syrjälä
Quoted 19 lines · Sun peng (Leo)
Quoted 8 lines · Lyude Paul

Closer, but are we sure we want to use the MST prop path for this? Why not add
a sysfs attribute with the corresponding DRM connector name instead since the
connector itself will have a path property. That way we can associate aux
devices for eDP and DP devices with their corresponding connectors as well

I thought about that as well, but I hit a wall when trying to get the SST connector from the aux device. Perhaps there's a simpler way that I'm overlooking?

It's easier for MST, since the mst_port can be obtained via container_of dp_aux. port->connector would then give what we want.

Quoted 7 lines
Quoted 3 lines

For SST though, each driver calls drm_aux_register() with an aux struct that they've initialized. I'm not sure how I can reliably get the drm_connector from that.

On i915 the aux is a child of the connector, so no extra attributes/links needed. Maybe other drivers should/could follow that apporach as well?

ooo, good point. Yeah that seems like it would be worth a shot since it'd be a little nicer then just adding more sysfs attributes. But otherwise if that doesn't work, adding a connector parameter to drm_dp_aux_register() should be fine.

Quoted 1 line
Signature · 7 lines
Cheers,
	Lyude Paul

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
#10 lore raw

PATCH 3/3 drm/dp_mst: Register AUX devices for MST ports

In reply to [email protected]

From: Ville Syrjälä <[email protected]>

All available downstream ports - physical and logical - are exposed for each MST device. They are listed in /dev/, following the same naming scheme as SST devices by appending an incremental ID.

Additionally, a 'path' attribute is attached to the device. This is to allow udev to provide more identifiable symlinks to these devices, similar to /dev/disks. For example, adding the following udev rule:

SUBSYSTEMS=="drm_dp_aux_dev", ATTR{path}=="?*", SYMLINK+="drm_dp_aux/by-path/$attr{path}"

With a MST topology like so:

               +---------+
               |  ASIC   |
               +---------+
              Conn-0|
                    |
               +----v----+
          +----| MST HUB |----+
          |    +---------+    |
          |                   |
          |Port-1       Port-2|
    +-----v-----+       +-----v-----+
    |  MST      |       |  SST      |
    |  Display  |       |  Display  |
    +-----------+       +-----------+
          |Port-1

x

Will create the following symlinks in 'drm_dp_aux/by-path/':

AUX Device Name | MST Device
----------------------+----------------------------------

card0_sst:0 (*)       | MST Hub
card0_mst:0-1         | MST Display
card0_mst:0-1-1       | MST Display's disconnected DP out
card0_mst:0-1-8       | MST Display's internal sink
card0_mst:0-2         | SST Display

(*) Note that the first digit is suppose to mean 'Connector ID'. However, that's only true for 'mst:' paths. A TODO item has been left to address this.

Although all downstream ports are exposed, only some will work. On certain MST displays, the upstream physical port will ACK DPCD reads. However, reads on the local logical port to the internal sink will *NAK*. i.e. reading mst:0-1 ACKs, but mst:0-1-8 NAKs.

There may also be duplicates. Some displays will return the same GUID when reading DPCD from both mst:0-1 and mst:0-1-8.

There are some device-dependent behavior as well. The MST hub used during testing will actually *ACK* read requests on a disconnected physical port, whereas the MST displays will NAK.

In light of these discrepancies, it's simpler to expose all downstream ports - both physical and logical - and let the user decide what to use.

---
 drivers/gpu/drm/drm_dp_aux_dev.c      |  53 ++++++++++++++++-
 drivers/gpu/drm/drm_dp_mst_topology.c | 103 +++++++++++++++++++++++++++++-----
 include/drm/drm_dp_helper.h           |   4 ++
 include/drm/drm_dp_mst_helper.h       |   6 ++
 4 files changed, 151 insertions(+), 15 deletions(-)
drivers/gpu/drm/drm_dp_aux_dev.c +51 -2
index 6d84611..4218bbf 100644
@@ -34,6 +34,7 @@
 #include <linux/uaccess.h>
 #include <linux/uio.h>
 #include <drm/drm_dp_helper.h>
+#include <drm/drm_dp_mst_helper.h>
 #include <drm/drm_crtc.h>
 #include <drm/drmP.h>
 
@@ -114,10 +115,50 @@ static ssize_t name_show(struct device *dev,
 
 	return res;
 }
+
+static int is_drm_primary_device(struct device *dev, void *data)
+{
+	return strstr(dev_name(dev), "card") != NULL;
+}
+
+static ssize_t path_show(struct device *dev,
+			 struct device_attribute *attr, char *buf)
+{
+	struct drm_dp_aux_dev *aux_dev =
+		drm_dp_aux_dev_get_by_minor(MINOR(dev->devt));
+	struct drm_dp_aux *aux = aux_dev->aux;
+	struct drm_dp_mst_port *port;
+	struct device *card;
+	char temp[64];
+	ssize_t res;
+
+	card = device_find_child(dev->parent, NULL,
+	                         is_drm_primary_device);
+
+	if (!aux->is_remote) {
+		/*
+		 * TODO: AUX index does not correlate with connector ID. See if
+		 * connector ID can be used instead.
+		 */
+		res = sprintf(buf, "%s_%s:%d\n",
+		              dev_name(card), "sst", aux_dev->index);
+		return res;
+	}
+
+	port = container_of(aux, struct drm_dp_mst_port, aux);
+	drm_dp_build_mst_prop_path(port->parent, port->port_num,
+				   temp, sizeof(temp));
+	res = sprintf(buf, "%s_%s\n", dev_name(card), temp);
+
+	return res;
+}
+
 static DEVICE_ATTR_RO(name);
+static DEVICE_ATTR_RO(path);
 
 static struct attribute *drm_dp_aux_attrs[] = {
 	&dev_attr_name.attr,
+	&dev_attr_path.attr,
 	NULL,
 };
 ATTRIBUTE_GROUPS(drm_dp_aux);
@@ -160,7 +201,11 @@ static ssize_t auxdev_read_iter(struct kiocb *iocb, struct iov_iter *to)
 			break;
 		}
 
-		res = drm_dp_dpcd_read(aux_dev->aux, pos, buf, todo);
+		if (aux_dev->aux->is_remote)
+			res = drm_dp_mst_dpcd_read(aux_dev->aux, pos, buf, todo);
+		else
+			res = drm_dp_dpcd_read(aux_dev->aux, pos, buf, todo);
+
 		if (res <= 0)
 			break;
 
@@ -207,7 +252,11 @@ static ssize_t auxdev_write_iter(struct kiocb *iocb, struct iov_iter *from)
 			break;
 		}
 
-		res = drm_dp_dpcd_write(aux_dev->aux, pos, buf, todo);
+		if (aux_dev->aux->is_remote)
+			res = drm_dp_mst_dpcd_write(aux_dev->aux, pos, buf, todo);
+		else
+			res = drm_dp_dpcd_write(aux_dev->aux, pos, buf, todo);
+
 		if (res <= 0)
 			break;
 
drivers/gpu/drm/drm_dp_mst_topology.c +90 -13

182 lines not on this page · raw message

include/drm/drm_dp_helper.h +4 -0
index 509667e..6dea76a 100644
@@ -1265,6 +1265,10 @@ struct drm_dp_aux {
 	 * @cec: struct containing fields used for CEC-Tunneling-over-AUX.
 	 */
 	struct drm_dp_aux_cec cec;
+	/**
+	 * @is_remote: Is this "AUX CH" actually using sideband messaging.
+	 */
+	bool is_remote;
 };
 
 ssize_t drm_dp_dpcd_read(struct drm_dp_aux *aux, unsigned int offset,
include/drm/drm_dp_mst_helper.h +6 -0
index 81c8d79..4de8256 100644
@@ -619,6 +619,12 @@ void drm_dp_mst_dump_topology(struct seq_file *m,
 
 void drm_dp_mst_topology_mgr_suspend(struct drm_dp_mst_topology_mgr *mgr);
 int drm_dp_mst_topology_mgr_resume(struct drm_dp_mst_topology_mgr *mgr);
+
+ssize_t drm_dp_mst_dpcd_read(struct drm_dp_aux *aux,
+			     unsigned int offset, void *buffer, size_t size);
+ssize_t drm_dp_mst_dpcd_write(struct drm_dp_aux *aux,
+			      unsigned int offset, void *buffer, size_t size);
+
 struct drm_dp_mst_topology_state *drm_atomic_get_mst_topology_state(struct drm_atomic_state *state,
 								    struct drm_dp_mst_topology_mgr *mgr);
 int drm_dp_atomic_find_vcpi_slots(struct drm_atomic_state *state,
Signature · 6 lines
2.7.4

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Reviewed-by on v1 1/3
#11 lore raw
In reply to [email protected]
Quoted 7 lines · On Mon, Apr 22, 2019 at 07:56:26PM -0400, [email protected] wrote:

From: Leo Li <[email protected]>

In preparation for adding aux devices for DP MST, make the IDR non-cyclic. That way, hotplug cycling MST devices won't needlessly increment the minor version index.

I don't recall any specific reason for the cyclic variant, so

Quoted 20 lines
---
 drivers/gpu/drm/drm_dp_aux_dev.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/gpu/drm/drm_dp_aux_dev.c +1 -2
index 0e4f25d..6d84611 100644
@@ -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);
Signature · 1 line
2.7.4
Signature · 6 lines
Ville Syrjälä
Intel
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

A message that is not in the archive (sent off-list or not yet received): 1555977388-14203-1-git-send-email-sunpeng.li-5C7GfCeVMHo@public.gmane.org

Reviewed-by
#13 lore raw

lgtm

Quoted 27 lines · On Mon, 2019-04-22 at 19:56 -0400, [email protected] wrote:

From: Leo Li <[email protected]>

In preparation for adding aux devices for DP MST, make the IDR non-cyclic. That way, hotplug cycling MST devices won't needlessly increment the minor version index.

---
 drivers/gpu/drm/drm_dp_aux_dev.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/gpu/drm/drm_dp_aux_dev.c +1 -2
index 0e4f25d..6d84611 100644
@@ -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);

Signature · 7 lines
Cheers,
	Lyude Paul

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx