Re: [PATCH v2 2/2] misc: pci_endpoint_test: Add support for capabilities

Niklas Cassel
2024-12-03T04:48:48Z

On Sat, Nov 30, 2024 at 01:51:19PM +0530, Manivannan Sadhasivam wrote:
> >
> > +static void pci_endpoint_test_get_capabilities(struct pci_endpoint_test *test)
> > +{
> > + struct pci_dev *pdev = test->pdev;
> > + struct device *dev = &pdev->dev;
> > + u32 caps;
> > + bool ep_can_do_unaligned_access;
> > +
> > + caps = pci_endpoint_test_readl(test, PCI_ENDPOINT_TEST_CAPS);
> > +
> > + ep_can_do_unaligned_access = caps & CAP_UNALIGNED_ACCESS;
> > + dev_dbg(dev, "CAP_UNALIGNED_ACCESS: %d\n", ep_can_do_unaligned_access);
>
> IDK if the users really need to know about this flag, nor it will assist in any
> debugging. Otherwise, I'd suggest to drop this debug print and just do:
>
> if (pci_endpoint_test_readl(test, PCI_ENDPOINT_TEST_CAPS))
> test->alignment = 0;
>
> - Mani

I do think that there is value in having a debug print that prints the
capabilities, especially if more caps are added in the future.

Let me send a v3 that dumps all caps (as hex) in a single print instead,
i.e. simply:

caps = pci_endpoint_test_readl(test, PCI_ENDPOINT_TEST_CAPS);
dev_dbg(dev, "PCI_ENDPOINT_TEST_CAPS: %#x\n", caps);

Kind regards,
Niklas