Message ID | 20221020012911.305139-4-mranostay@ti.com (mailing list archive) |
---|---|
State | Superseded |
Delegated to: | Lorenzo Pieralisi |
Headers | show |
Series | PCI: add 4x lane support for pci-j721e controllers | expand |
On Wed, Oct 19, 2022 at 06:29:11PM -0700, Matt Ranostay wrote: > Added dev_warn messages to alert of devicetree misconfigurations > for incorrect num-lanes setting, or the lack of one being defined. s/Added/Add/ if you repost for anything else: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?id=v5.16#n95 > + dev_warn(dev, "defined num-lanes %u is greater than the " > + "allowed maximum of %u, defaulting to 1\n", > + num_lanes, data->max_lanes); Don't repost just for this, but I generally prefer to keep printf strings intact even if they exceed 80 columns, because it makes it easier for someone to grep for something like "greater than the allowed". > + num_lanes = 1; > + } > pcie->num_lanes = num_lanes; > > if (dma_set_mask_and_coherent(dev, DMA_BIT_MASK(48))) > -- > 2.38.GIT >
diff --git a/drivers/pci/controller/cadence/pci-j721e.c b/drivers/pci/controller/cadence/pci-j721e.c index 0a537f2d5078..2922be2ac4e1 100644 --- a/drivers/pci/controller/cadence/pci-j721e.c +++ b/drivers/pci/controller/cadence/pci-j721e.c @@ -441,8 +441,17 @@ static int j721e_pcie_probe(struct platform_device *pdev) pcie->user_cfg_base = base; ret = of_property_read_u32(node, "num-lanes", &num_lanes); - if (ret || num_lanes > data->max_lanes) + if (ret) { + dev_warn(dev, "no num-lanes defined, defaulting to 1\n"); num_lanes = 1; + } + + if (num_lanes > data->max_lanes) { + dev_warn(dev, "defined num-lanes %u is greater than the " + "allowed maximum of %u, defaulting to 1\n", + num_lanes, data->max_lanes); + num_lanes = 1; + } pcie->num_lanes = num_lanes; if (dma_set_mask_and_coherent(dev, DMA_BIT_MASK(48)))