On Sat, Apr 10, 2021 at 10:21:03AM -0500, Bjorn Helgaas wrote:
Anybody want to chime in and review this? Sometimes I feel like a one-man band :)
Can't say anything about the object of the patch, but style-wise this looks cryptic:
--- a/drivers/pci/pcie/dpc.c +++ b/drivers/pci/pcie/dpc.c @@ -302,7 +302,7 @@ static int dpc_probe(struct pcie_device *dev) pci_read_config_word(pdev, pdev->dpc_cap + PCI_EXP_DPC_CTL, &ctl);
- ctl = (ctl & 0xfff4) | PCI_EXP_DPC_CTL_EN_FATAL | PCI_EXP_DPC_CTL_INT_EN;
- ctl = (ctl & 0xffe4) | PCI_EXP_DPC_CTL_EN_FATAL | PCI_EXP_DPC_CTL_INT_EN; pci_write_config_word(pdev, pdev->dpc_cap + PCI_EXP_DPC_CTL, ctl);
Instead of writing "ctl & 0xfff4", I'd prefer defining macros for the register bits of interest, then use "ctl &= ~(u16)(bits to clear)" and in a separate line use "ctl |= (bits to set)".
Obviously, clearing bits that are unconditionally set afterwards is unnecessary (as is done here).
pci_info(pdev, "enabled with IRQ %d\n", dev->irq);
This looks superfluous since the IRQ can be found out in /proc/interrupts.
Thanks,
Lukas