Skip to content

Commit 97f265e

Browse files
Jiri Pirkokuba-moo
authored andcommitted
dpll: allocate pin ids in cycle
Pin ID is just a number. Nobody should rely on a certain value, instead, user should use either pin-id-get op or RTNetlink to get it. Unify the pin ID allocation behavior with what there is already implemented for dpll devices. Signed-off-by: Jiri Pirko <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 4746b36 commit 97f265e

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

drivers/dpll/dpll_core.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ DEFINE_MUTEX(dpll_lock);
2222
DEFINE_XARRAY_FLAGS(dpll_device_xa, XA_FLAGS_ALLOC);
2323
DEFINE_XARRAY_FLAGS(dpll_pin_xa, XA_FLAGS_ALLOC);
2424

25-
static u32 dpll_xa_id;
25+
static u32 dpll_device_xa_id;
26+
static u32 dpll_pin_xa_id;
2627

2728
#define ASSERT_DPLL_REGISTERED(d) \
2829
WARN_ON_ONCE(!xa_get_mark(&dpll_device_xa, (d)->id, DPLL_REGISTERED))
@@ -246,7 +247,7 @@ dpll_device_alloc(const u64 clock_id, u32 device_idx, struct module *module)
246247
dpll->clock_id = clock_id;
247248
dpll->module = module;
248249
ret = xa_alloc_cyclic(&dpll_device_xa, &dpll->id, dpll, xa_limit_32b,
249-
&dpll_xa_id, GFP_KERNEL);
250+
&dpll_device_xa_id, GFP_KERNEL);
250251
if (ret < 0) {
251252
kfree(dpll);
252253
return ERR_PTR(ret);
@@ -446,7 +447,8 @@ dpll_pin_alloc(u64 clock_id, u32 pin_idx, struct module *module,
446447
refcount_set(&pin->refcount, 1);
447448
xa_init_flags(&pin->dpll_refs, XA_FLAGS_ALLOC);
448449
xa_init_flags(&pin->parent_refs, XA_FLAGS_ALLOC);
449-
ret = xa_alloc(&dpll_pin_xa, &pin->id, pin, xa_limit_16b, GFP_KERNEL);
450+
ret = xa_alloc_cyclic(&dpll_pin_xa, &pin->id, pin, xa_limit_32b,
451+
&dpll_pin_xa_id, GFP_KERNEL);
450452
if (ret)
451453
goto err;
452454
return pin;

0 commit comments

Comments
 (0)