]> git.itanic.dy.fi Git - linux-stable/commitdiff
PCI: mvebu: Use FIELD_PREP() with Link Width
authorIlpo Järvinen <ilpo.jarvinen@linux.intel.com>
Tue, 19 Sep 2023 12:56:45 +0000 (15:56 +0300)
committerBjorn Helgaas <bhelgaas@google.com>
Tue, 10 Oct 2023 20:00:52 +0000 (15:00 -0500)
mvebu_pcie_setup_hw() setups the Maximum Link Width field in the Link
Capabilities registers using an open-coded variant of FIELD_PREP() with
a literal in shift. Improve readability by using
FIELD_PREP(PCI_EXP_LNKCAP_MLW, ...).

Link: https://lore.kernel.org/r/20230919125648.1920-6-ilpo.jarvinen@linux.intel.com
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
drivers/pci/controller/pci-mvebu.c

index 60810a1fbfb75ecf82a3302d88c167d0d83f8d9f..29fe09c99e7d9c99a70b6cc120ad36cf47c9ad4b 100644 (file)
@@ -264,7 +264,7 @@ static void mvebu_pcie_setup_hw(struct mvebu_pcie_port *port)
         */
        lnkcap = mvebu_readl(port, PCIE_CAP_PCIEXP + PCI_EXP_LNKCAP);
        lnkcap &= ~PCI_EXP_LNKCAP_MLW;
-       lnkcap |= (port->is_x4 ? 4 : 1) << 4;
+       lnkcap |= FIELD_PREP(PCI_EXP_LNKCAP_MLW, port->is_x4 ? 4 : 1);
        mvebu_writel(port, lnkcap, PCIE_CAP_PCIEXP + PCI_EXP_LNKCAP);
 
        /* Disable Root Bridge I/O space, memory space and bus mastering. */