Re: [PATCHv5 2/5] pci: Add device disconnected state

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

 



On Mon, Feb 06, 2017 at 06:40:46PM +0100, Greg Kroah-Hartman wrote:
> On Mon, Feb 06, 2017 at 09:32:02AM -0800, Christoph Hellwig wrote:
> > On Fri, Feb 03, 2017 at 09:53:30PM +0100, Greg Kroah-Hartman wrote:
> > > > +/* pci_dev priv_flags */
> > > > +#define PCI_DEV_DISCONNECTED 0
> > > > +
> > > > +static inline int pci_dev_set_disconnected(struct pci_dev *dev, void *unused)
> > > > +{
> > > > +	set_bit(PCI_DEV_DISCONNECTED, &dev->priv_flags);
> > > 
> > > Why a single bit?  Are you trying to do this without locking or
> > > something?  And if you want a bit, what's wrong with a C bit type?  Or
> > > just a boolean?
> > 
> > What's a C bit type?
> 
> Sorry, was thinking of:
> 	unsigned foo:2;
> don't know what the "real" name for that is...

The C standard calls that a 'bit field'. I originally used that for this
flag, but Bjorn was concerned about the atomicity of getting this bit set,
conflicting with setting adjacent bits. It's unlikely that would happen
considering the pci driver's current usage, but he's correct that it's
possible without additional locking.

A bool would work just as well for the intended usage, though we may
eventually want all the currently defined bit fields to use the set/test
bit APIs, so this gets us started in that direction.



[Index of Archives]     [DMA Engine]     [Linux Coverity]     [Linux USB]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Greybus]

  Powered by Linux