[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <0702df59-bad8-4bc1-84d6-11dbe9872af2@163.com>
Date: Thu, 18 Dec 2025 21:19:24 +0800
From: Hans Zhang <18255117159@....com>
To: Manivannan Sadhasivam <mani@...nel.org>
Cc: bhelgaas@...gle.com, helgaas@...nel.org, ilpo.jarvinen@...ux.intel.com,
linux-pci@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v5 1/1] PCI: of: Remove max-link-speed generation
validation
On 2025/12/18 21:06, Manivannan Sadhasivam wrote:
> On Thu, Dec 18, 2025 at 08:59:09PM +0800, Hans Zhang wrote:
>> The current implementation of of_pci_get_max_link_speed() validates
>> max-link-speed property values to be in the range 1~4 (Gen1~Gen4).
>> However, this creates maintenance overhead as each new PCIe generation
>> requires updating this validation logic.
>>
>> Since device tree binding validation already enforces the allowed
>> values through the schema, and the callers of this function perform
>> their own validation checks, this intermediate validation becomes
>> redundant.
>>
>> Furthermore, with upcoming SOCs using Synopsys/Cadence IP requiring
>> Gen5/Gen6 support, removing this hardcoded check enables seamless
>> support for future PCIe generations without requiring kernel updates
>> for each new speed grade.
>>
>> Remove the max-link-speed > 4 validation check while retaining the
>> property existence and non-zero check. This simplifies maintenance
>> and aligns with the existing validation architecture where DT binding
>> and driver-level checks provide sufficient validation.
>>
>> Signed-off-by: Hans Zhang <18255117159@....com>
>> ---
>> Changes for v5:
>> - Delete the check for speed. (Mani)
>>
>> Changes for v4:
>> https://patchwork.kernel.org/project/linux-pci/patch/20251105134701.182795-1-18255117159@163.com/
>>
>> - Add pcie_max_supported_link_speed.(Ilpo)
>>
>> Changes for v3:
>> https://patchwork.kernel.org/project/linux-pci/patch/20251101164132.14145-1-18255117159@163.com/
>>
>> - Modify the commit message.
>> - Add Reviewed-by tag.
>>
>> Changes for v2:
>> https://patchwork.kernel.org/project/linux-pci/cover/20250529021026.475861-1-18255117159@163.com/
>> - The following files have been deleted:
>> Documentation/devicetree/bindings/pci/pci.txt
>>
>> Update to this file again:
>> dtschema/schemas/pci/pci-bus-common.yaml
>> ---
>> drivers/pci/of.c | 3 +--
>> 1 file changed, 1 insertion(+), 2 deletions(-)
>>
>> diff --git a/drivers/pci/of.c b/drivers/pci/of.c
>> index 3579265f1198..1f8435780247 100644
>> --- a/drivers/pci/of.c
>> +++ b/drivers/pci/of.c
>> @@ -889,8 +889,7 @@ int of_pci_get_max_link_speed(struct device_node *node)
>> {
>> u32 max_link_speed;
>>
>> - if (of_property_read_u32(node, "max-link-speed", &max_link_speed) ||
>> - max_link_speed == 0 || max_link_speed > 4)
>> + if (of_property_read_u32(node, "max-link-speed", &max_link_speed))
>> return -EINVAL;
>
> It'd be good to return the actual errno as of_property_read_u32() can return
> -EINVAL, -ENODATA and -EOVERFLOW.
Hi Mani
Will change.
Best regards,
Hans
>
> With that change,
>
> Acked-by: Manivannan Sadhasivam <mani@...nel.org>
>
> - Mani
>
Powered by blists - more mailing lists