On Wed, Jul 28, 2021 at 04:58:14PM -0500, Shanker R Donthineni wrote: > On 7/28/21 3:23 PM, Bjorn Helgaas wrote: > > On Wed, Jul 28, 2021 at 01:54:16PM -0500, Shanker R Donthineni wrote: > >> On 7/27/21 5:12 PM, Bjorn Helgaas wrote: > >>> On Fri, Jul 09, 2021 at 06:08:06PM +0530, Amey Narkhede wrote: > >>>> Add has_pcie_flr bitfield in struct pci_dev to indicate support for PCIe > >>>> FLR to avoid reading PCI_EXP_DEVCAP multiple times. > >> - pcie_capability_read_dword(dev, PCI_EXP_DEVCAP, &cap); > >> - return cap & PCI_EXP_DEVCAP_FLR; > >> + return !!FIELD_GET(PCI_EXP_DEVCAP_FLR, dev->devcap); > > > > Nice, thanks for reminding me of FIELD_GET(). I like how that works > > without having to #define *_SHIFT values. I personally don't care for > > "!!" and would probably write something like: > > > > return FIELD_GET(PCI_EXP_DEVCAP_FLR, dev->devcap) == 1; > > Both are same since FLR is a single bit value. Right; this is a style preference, not a correctness question.