On Thu, May 16, 2019 at 10:14:56PM +0000, Matt Sickler wrote:
> >-----Original Message-----
> >From: devel <driverdev-devel-boun...@linuxdriverproject.org> On Behalf Of
> >Previously the next card number was assigned from a static int local 
> >variable,
> >which was read and later incremented.  This was not thread- safe, so now we
> >use an atomic_t and atomic_fetch_add instead.
> 
> Switching to atomic_fetch_add is definitely an improvement over what that code
> was doing prior, but is that the proper solution?  How do other parts of the
> kernel handle giving devices unique ID numbers?

You use an "ida" structure.  That's the correct solution here, don't
mess with an atomic variable, that's not needed.

thanks,

greg k-h
_______________________________________________
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

Reply via email to