[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <PH3PPF7A88A980A3B69C3F4AAE8DFE1CFDFE59FA@PH3PPF7A88A980A.namprd11.prod.outlook.com>
Date: Fri, 30 Jan 2026 17:50:54 +0000
From: "Loktionov, Aleksandr" <aleksandr.loktionov@...el.com>
To: "Vecera, Ivan" <ivecera@...hat.com>, "netdev@...r.kernel.org"
<netdev@...r.kernel.org>
CC: "Lobakin, Aleksander" <aleksander.lobakin@...el.com>, Andrew Lunn
<andrew+netdev@...n.ch>, "Kubalewski, Arkadiusz"
<arkadiusz.kubalewski@...el.com>, "David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>, Jakub Kicinski <kuba@...nel.org>, "Jiri
Pirko" <jiri@...nulli.us>, Jonathan Lemon <jonathan.lemon@...il.com>, "Leon
Romanovsky" <leon@...nel.org>, Mark Bloch <mbloch@...dia.com>, Paolo Abeni
<pabeni@...hat.com>, Prathosh Satish <Prathosh.Satish@...rochip.com>,
"Kitszel, Przemyslaw" <przemyslaw.kitszel@...el.com>, Richard Cochran
<richardcochran@...il.com>, Saeed Mahameed <saeedm@...dia.com>, Tariq Toukan
<tariqt@...dia.com>, "Nguyen, Anthony L" <anthony.l.nguyen@...el.com>, "Vadim
Fedorenko" <vadim.fedorenko@...ux.dev>, "intel-wired-lan@...ts.osuosl.org"
<intel-wired-lan@...ts.osuosl.org>, "linux-kernel@...r.kernel.org"
<linux-kernel@...r.kernel.org>, "linux-rdma@...r.kernel.org"
<linux-rdma@...r.kernel.org>
Subject: RE: [Intel-wired-lan] [PATCH net-next v3 4/9] dpll: Support dynamic
pin index allocation
> -----Original Message-----
> From: Intel-wired-lan <intel-wired-lan-bounces@...osl.org> On Behalf
> Of Ivan Vecera
> Sent: Friday, January 30, 2026 5:54 PM
> To: netdev@...r.kernel.org
> Cc: Lobakin, Aleksander <aleksander.lobakin@...el.com>; Andrew Lunn
> <andrew+netdev@...n.ch>; Kubalewski, Arkadiusz
> <arkadiusz.kubalewski@...el.com>; David S. Miller
> <davem@...emloft.net>; Eric Dumazet <edumazet@...gle.com>; Jakub
> Kicinski <kuba@...nel.org>; Jiri Pirko <jiri@...nulli.us>; Jonathan
> Lemon <jonathan.lemon@...il.com>; Leon Romanovsky <leon@...nel.org>;
> Mark Bloch <mbloch@...dia.com>; Paolo Abeni <pabeni@...hat.com>;
> Prathosh Satish <Prathosh.Satish@...rochip.com>; Kitszel, Przemyslaw
> <przemyslaw.kitszel@...el.com>; Richard Cochran
> <richardcochran@...il.com>; Saeed Mahameed <saeedm@...dia.com>; Tariq
> Toukan <tariqt@...dia.com>; Nguyen, Anthony L
> <anthony.l.nguyen@...el.com>; Vadim Fedorenko
> <vadim.fedorenko@...ux.dev>; intel-wired-lan@...ts.osuosl.org; linux-
> kernel@...r.kernel.org; linux-rdma@...r.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@...hat.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 <aleksandr.loktionov@...el.com>
Powered by blists - more mailing lists