Linux PCI subsystem development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Inochi Amaoto" <inochiama@gmail.com>
Cc: robh@kernel.org, devicetree@vger.kernel.org,
	linux-pci@vger.kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH v4 2/6] PCI: spacemit-k1: Add multiple PHY handles support
Date: Thu, 09 Jul 2026 04:09:20 +0000	[thread overview]
Message-ID: <20260709040920.9835D1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260709040027.958400-3-inochiama@gmail.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] `k1_pcie_deinit()` tears down the PHY array in forward order instead of the standard reverse order used in the initialization error path.
--

--- Patch [2]: [PATCH v4 2/6] PCI: spacemit-k1: Add multiple PHY handles support ---
commit afd1a474faf7e619be1db1da6684dbf945adb2fa
Author: Inochi Amaoto <inochiama@gmail.com>

PCI: spacemit-k1: Add multiple PHY handles support

This commit extends the Spacemit K3 PCIe controller driver to support
multiple PHY handles, as the hardware may use multiple PHYs simultaneously.
It replaces the single PHY reference with an array of PHYs and updates the
initialization and teardown paths to iterate over them.

> diff --git a/drivers/pci/controller/dwc/pcie-spacemit-k1.c b/drivers/pci/controller/dwc/pcie-spacemit-k1.c
> index f6ae8ff3589a9..e22ecbd095798 100644
> --- a/drivers/pci/controller/dwc/pcie-spacemit-k1.c
> +++ b/drivers/pci/controller/dwc/pcie-spacemit-k1.c

[ ... ]

> @@ -194,12 +244,14 @@ static void k1_pcie_deinit(struct dw_pcie_rp *pp)
>  {
>  	struct dw_pcie *pci = to_dw_pcie_from_pp(pp);
>  	struct k1_pcie *k1 = to_k1_pcie(pci);
> +	int i;
>  
>  	/* Assert fundamental reset (drive PERST# low) */
>  	regmap_set_bits(k1->pmu, k1->pmu_off + PCIE_CLK_RESET_CONTROL,
>  			PCIE_RC_PERST);
>  
> -	phy_exit(k1->phy);
> +	for (i = 0; i < k1->phy_count; i++)
> +		phy_exit(k1->phy[i]);

[Severity: Low]
Does this code need to exit the PHYs in reverse order?

The k1_pcie_enable_phy() function cleans up in reverse order during an
initialization error:

err_phy:
	while (i--)
		phy_exit(k1->phy[i]);

Would it be safer to use reverse-order teardown here in k1_pcie_deinit()
as well to ensure consistency and avoid potential issues if the PHYs
have interdependencies?

>  
>  	k1_pcie_disable_resources(k1);
>  }

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260709040027.958400-1-inochiama@gmail.com?part=2

  reply	other threads:[~2026-07-09  4:09 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-09  4:00 [PATCH v4 0/6] riscv: spacemit: Add PCIe RC controller support for K3 Inochi Amaoto
2026-07-09  4:00 ` [PATCH v4 1/6] PCI: spacemit-k1: Add device data support Inochi Amaoto
2026-07-09  4:05   ` sashiko-bot
2026-07-09  7:09   ` Andy Shevchenko
2026-07-10 16:01   ` Alex Elder
2026-07-09  4:00 ` [PATCH v4 2/6] PCI: spacemit-k1: Add multiple PHY handles support Inochi Amaoto
2026-07-09  4:09   ` sashiko-bot [this message]
2026-07-09  7:16   ` Andy Shevchenko
2026-07-10  1:57     ` Inochi Amaoto
2026-07-10  8:07       ` Andy Shevchenko
2026-07-10 10:55         ` Inochi Amaoto
2026-07-10 12:42           ` Alex Elder
2026-07-11 13:01             ` Andy Shevchenko
2026-07-11 12:44           ` Andy Shevchenko
2026-07-10 12:51     ` Alex Elder
2026-07-11 13:04       ` Andy Shevchenko
2026-07-10 16:01   ` Alex Elder
2026-07-09  4:00 ` [PATCH v4 3/6] PCI: spacemit-k1: Add device id update helper Inochi Amaoto
2026-07-09  4:06   ` sashiko-bot
2026-07-10 16:01   ` Alex Elder
2026-07-09  4:00 ` [PATCH v4 4/6] dt-bindings: PCI: snps,dw-pcie: Add msi-parent for MSI handle check Inochi Amaoto
2026-07-09  4:06   ` sashiko-bot
2026-07-10 16:01   ` Alex Elder
2026-07-09  4:00 ` [PATCH v4 5/6] dt-bindings: PCI: spacemit: Introduce Spacemit K3 PCIe host controller Inochi Amaoto
2026-07-09  4:09   ` sashiko-bot
2026-07-10 16:01   ` Alex Elder
2026-07-09  4:00 ` [PATCH v4 6/6] PCI: spacemit-k1: Add Spacemit K3 PCIe host controller support Inochi Amaoto
2026-07-09  4:12   ` sashiko-bot
2026-07-09  7:21   ` Andy Shevchenko
2026-07-10 16:01   ` Alex Elder

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260709040920.9835D1F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=inochiama@gmail.com \
    --cc=linux-pci@vger.kernel.org \
    --cc=robh@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox