Re: [PATCH] staging: greybus: uart: replace IDR with XArray

From: Greg KH

Date: Thu Nov 12 2026 - 07:49:40 EST


On Wed, Nov 11, 2026 at 08:23:30PM +0200, Aviv Levinson wrote:
> Migrate the minor number allocation from the legacy IDR API to the
> modern XArray API to take advantage of its built-in thread safety.

But why?

> As part of this migration, the global `table_lock` mutex has been
> removed. Mutating operations now rely on XArray's internal spinlocks,
> and the lookup logic in get_gb_by_minor() has been updated to use
> rcu_read_lock() combined with kref_get_unless_zero() to safely
> pin the device reference without blocking.

How was this found and generated and tested?

And kref_get_unless_zero() is almost always a call you never want to
make.

> Signed-off-by: Aviv Levinson <levinson.aviv@xxxxxxxxx>
> ---
> drivers/staging/greybus/uart.c | 37 ++++++++++++++++++----------------
> 1 file changed, 20 insertions(+), 17 deletions(-)

So now there is more code? That feels like a step backwards, don't you
think?

thanks,

greg k-h