[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHp75VedAiB_wSaq+oaNriC3HfLC=ft21O=ZYW_wCARPS7v3QQ@mail.gmail.com>
Date: Tue, 2 Apr 2024 22:28:25 +0300
From: Andy Shevchenko <andy.shevchenko@...il.com>
To: Hugo Villeneuve <hugo@...ovil.com>
Cc: gregkh@...uxfoundation.org, jirislaby@...nel.org,
linux-kernel@...r.kernel.org, linux-serial@...r.kernel.org,
Hugo Villeneuve <hvilleneuve@...onoff.com>
Subject: Re: [PATCH v3 4/5] serial: sc16is7xx: split into core and I2C/SPI
parts (sc16is7xx_lines)
On Tue, Apr 2, 2024 at 8:45 PM Hugo Villeneuve <hugo@...ovil.com> wrote:
>
> From: Hugo Villeneuve <hvilleneuve@...onoff.com>
>
> Before, sc16is7xx_lines was checked for a free (zero) bit first, and then
> later it was set only if UART port registration succeeded. Now that
> sc16is7xx_lines is shared for the I2C and SPI drivers, there is a
> possibility that the two drivers can simultaneously try to reserve the same
> line bit at the same time.
>
> To prevent this, make sure line allocation is reserved atomically, and use
> a new variable to hold the status of UART port regisration.
registration
> Now that we no longer need to search if a bit is set, it is now possible
> to simplify sc16is7xx_lines allocation by using the IDA framework.
..
> -static DECLARE_BITMAP(sc16is7xx_lines, SC16IS7XX_MAX_DEVS);
> +static DEFINE_IDA(sc16is7xx_lines);
Don't we need to replace bitmap.h with idr.h with this change in place?
--
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists