RE: [Intel-wired-lan] [PATCH net-next v3 4/9] dpll: Support dynamic pin index allocation
From: Loktionov, Aleksandr
Date: Fri Jan 30 2026 - 12:52:54 EST
> -----Original Message-----
> From: Intel-wired-lan <intel-wired-lan-bounces@xxxxxxxxxx> On Behalf
> Of Ivan Vecera
> Sent: Friday, January 30, 2026 5:54 PM
> To: netdev@xxxxxxxxxxxxxxx
> Cc: Lobakin, Aleksander <aleksander.lobakin@xxxxxxxxx>; Andrew Lunn
> <andrew+netdev@xxxxxxx>; Kubalewski, Arkadiusz
> <arkadiusz.kubalewski@xxxxxxxxx>; David S. Miller
> <davem@xxxxxxxxxxxxx>; Eric Dumazet <edumazet@xxxxxxxxxx>; Jakub
> Kicinski <kuba@xxxxxxxxxx>; Jiri Pirko <jiri@xxxxxxxxxxx>; Jonathan
> Lemon <jonathan.lemon@xxxxxxxxx>; Leon Romanovsky <leon@xxxxxxxxxx>;
> Mark Bloch <mbloch@xxxxxxxxxx>; Paolo Abeni <pabeni@xxxxxxxxxx>;
> Prathosh Satish <Prathosh.Satish@xxxxxxxxxxxxx>; Kitszel, Przemyslaw
> <przemyslaw.kitszel@xxxxxxxxx>; Richard Cochran
> <richardcochran@xxxxxxxxx>; Saeed Mahameed <saeedm@xxxxxxxxxx>; Tariq
> Toukan <tariqt@xxxxxxxxxx>; Nguyen, Anthony L
> <anthony.l.nguyen@xxxxxxxxx>; Vadim Fedorenko
> <vadim.fedorenko@xxxxxxxxx>; intel-wired-lan@xxxxxxxxxxxxxxxx; linux-
> kernel@xxxxxxxxxxxxxxx; linux-rdma@xxxxxxxxxxxxxxx
> 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@xxxxxxxxxx>
> ---
> 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 <aleksandr.loktionov@xxxxxxxxx>