Re: [PATCH v10 3/7] PCI: reserve bus range for SR-IOV device

Matthew Wilcox
2009-03-09T18:11:21Z

On Mon, Mar 09, 2009 at 11:09:02AM -0700, Randy Dunlap wrote:
> >> static inline __pure u16 virtfn_bdf(struct pci_dev *dev, int id)
> >> {
> >> return (dev->bus->number << 8) + dev->devfn + dev->sriov->offset +
> >> dev->sriov->stride * id;
> >> }
> >>
> >> #define VIRT_BUS(dev, id) (virtfn_bdf(dev, id) >> 8)
> >> #define VIRT_DEVFN(dev, id) (virtfn_bdf(dev, id) & 0xff)
> >>
> >> We rely on GCC to do CSE and not actually invoke virtfn_bdf more than
> >> once.
> >
> > Yes, that's a good idea. Will replace that function with macros.
>
> That's the opposite of most changes lately. I.e., functions (with
> typechecking) are preferred.

There's every bit as much typechecking with the approach I outlined as
there was with the original.

--
Matthew Wilcox Intel Open Source Technology Centre
"Bill, look, we understand that you're interested in selling us this
operating system, but compare it to ours. We can't possibly take such
a retrograde step."