Thread (15 messages) 15 messages, 2 authors, 2026-01-30

RE: [Intel-wired-lan] [PATCH net-next v3 4/9] dpll: Support dynamic pin index allocation

From: Loktionov, Aleksandr <hidden>
Date: 2026-01-30 17:50:59
Also in: intel-wired-lan, linux-rdma, lkml

quoted hunk ↗ jump to hunk
-----Original Message-----
From: Intel-wired-lan <redacted> On Behalf
Of Ivan Vecera
Sent: Friday, January 30, 2026 5:54 PM
To: netdev@vger.kernel.org
Cc: Lobakin, Aleksander <aleksander.lobakin@intel.com>; Andrew Lunn
[off-list ref]; Kubalewski, Arkadiusz
[off-list ref]; David S. Miller
[off-list ref]; Eric Dumazet [off-list ref]; Jakub
Kicinski [off-list ref]; Jiri Pirko [off-list ref]; Jonathan
Lemon [off-list ref]; Leon Romanovsky [off-list ref];
Mark Bloch [off-list ref]; Paolo Abeni [off-list ref];
Prathosh Satish [off-list ref]; Kitszel, Przemyslaw
[off-list ref]; Richard Cochran
[off-list ref]; Saeed Mahameed [off-list ref]; Tariq
Toukan [off-list ref]; Nguyen, Anthony L
[off-list ref]; Vadim Fedorenko
[off-list ref]; intel-wired-lan@lists.osuosl.org; linux-
kernel@vger.kernel.org; linux-rdma@vger.kernel.org
Subject: [Intel-wired-lan] [PATCH net-next v3 4/9] dpll: Support
dynamic pin index allocation

Allow drivers to register DPLL pins without manually specifying a pin
index.

Currently, drivers must provide a unique pin index when calling
dpll_pin_get(). This works well for hardware-mapped pins but creates
friction for drivers handling virtual pins or those without a strict
hardware indexing scheme.

Introduce DPLL_PIN_IDX_UNSPEC (U32_MAX). When a driver passes this
value as the pin index:
1. The core allocates a unique index using an IDA 2. The allocated
index is mapped to a range starting above `INT_MAX`

This separation ensures that dynamically allocated indices never
collide with standard driver-provided hardware indices, which are
assumed to be within the `0` to `INT_MAX` range. The index is
automatically freed when the pin is released in dpll_pin_put().

Signed-off-by: Ivan Vecera <ivecera@redhat.com>
---
v2:
* fixed integer overflow in dpll_pin_idx_free()
---
 drivers/dpll/dpll_core.c | 48 ++++++++++++++++++++++++++++++++++++++-
-
 include/linux/dpll.h     |  2 ++
 2 files changed, 48 insertions(+), 2 deletions(-)
diff --git a/drivers/dpll/dpll_core.c b/drivers/dpll/dpll_core.c index
4bcffe3507cd7..b91f4dc6bb972 100644
--- a/drivers/dpll/dpll_core.c
+++ b/drivers/dpll/dpll_core.c
@@ -10,6 +10,7 @@

 #include <linux/device.h>
 #include <linux/err.h>
+#include <linux/idr.h>
 #include <linux/property.h>
 #include <linux/slab.h>
 #include <linux/string.h>
@@ -24,6 +25,7 @@ DEFINE_XARRAY_FLAGS(dpll_device_xa, XA_FLAGS_ALLOC);
DEFINE_XARRAY_FLAGS(dpll_pin_xa, XA_FLAGS_ALLOC);

 static RAW_NOTIFIER_HEAD(dpll_notifier_chain);
+static DEFINE_IDA(dpll_pin_idx_ida);

 static u32 dpll_device_xa_id;
 static u32 dpll_pin_xa_id;
@@ -464,6 +466,36 @@ void dpll_device_unregister(struct dpll_device
*dpll,  }  EXPORT_SYMBOL_GPL(dpll_device_unregister);

...
--
2.52.0

Reviewed-by: Aleksandr Loktionov <redacted>
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help