Re: [PATCH v2 5/9] staging: kpc2000: use atomic_t to assign card numbers.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, May 16, 2019 at 10:14:56PM +0000, Matt Sickler wrote:
> >-----Original Message-----
> >From: devel <driverdev-devel-bounces@xxxxxxxxxxxxxxxxxxxxxx> 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
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel



[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux