Re: [PATCH v3 02/10] PCI/PTM: Cache PTM Capability offset

From: Bjorn Helgaas
Date: Wed Sep 07 2022 - 11:50:06 EST


On Tue, Sep 06, 2022 at 04:18:23PM -0700, Sathyanarayanan Kuppuswamy wrote:
> On 9/6/22 3:23 PM, Bjorn Helgaas wrote:

> > void pci_disable_ptm(struct pci_dev *dev)
> > {
> > - int ptm;
> > + int ptm = dev->ptm_cap;
>
> I think you don't need to store it. Directly use dev->ptm?

True, no need, but the value is used three times in this function, so
I think the variable reduces clutter overall.

> > void pci_restore_ptm_state(struct pci_dev *dev)
> > {
> > + int ptm = dev->ptm_cap;
>
> It can be u16?

Done, thanks! I see that in ee8b1c478a9f ("PCI: Return u16 from
pci_find_ext_capability() and similar"), I forgot to change the inline
stub from int to u16. I'll add a patch to do that. Probably not a
prerequisite, since the stub is for !CONFIG_PCI and this code won't
be compiled at all in that case.

> > void pci_ptm_init(struct pci_dev *dev)
> > {
> > - int pos;
> > + int ptm;
>
> Why rename? Also ptm can be u16

"ptm" conveys more information than "pos" and I think it's worth using
the same name for all the functions.

Thank you!

Bjorn