Re: [PATCH fwctl 2/5] fwctl/bnxt_en: Refactor aux bus functions to be more generic
From: Leon Romanovsky
Date: Sun Jan 25 2026 - 11:46:07 EST
On Sun, Jan 25, 2026 at 07:20:28PM +0530, Pavan Chebbi wrote:
> > > + int auxdev_id;
> > > + atomic_t auxdev_state[__BNXT_AUXDEV_MAX];
> > > +#define BNXT_ADEV_STATE_NONE 0
> > > +#define BNXT_ADEV_STATE_INIT 1
> > > +#define BNXT_ADEV_STATE_ADD 2
> >
> > This is indeed an incorrect use of atomic_t. This type only ensures that
> > individual arithmetic operations are performed atomically. It does not
> > eliminate the need for the locks that were removed.
>
> Thanks for your review. Since the individual bp's auxdev state is
> going to be set only during probe(), and is read-only elsewhere,
> atomic operations are enough, no?
No. You can change the state of a specific auxdev by unbinding its driver.
You must hold the appropriate lock whenever you read or depend on
auxdev_state, and an atomic_t is not required for this case.
Thanks