Re: [PATCH v15 01/13] PCI: kirin: Reorganize the PHY logic inside the driver

From: Bjorn Helgaas
Date: Thu Nov 04 2021 - 17:48:04 EST


On Thu, Oct 21, 2021 at 11:45:08AM +0100, Mauro Carvalho Chehab wrote:
> The pcie-kirin PCIe driver contains internally a PHY interface for
> Kirin 960.
>
> As the next patches will add support for using an external PHY
> driver, reorganize the driver in a way that the PHY part
> will be self-contained.
>
> This could be moved to a separate PHY driver, but a change
> like that would mean a non-backward-compatible DT schema
> change.
>
> Cc: Kishon Vijay Abraham I <kishon@xxxxxx>
> Acked-by: Xiaowei Song <songxiaowei@xxxxxxxxxxxxx>
> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@xxxxxxxxxx>

> +static int hi3660_pcie_phy_init(struct platform_device *pdev,
> + struct kirin_pcie *pcie)
> +{
> + struct device *dev = &pdev->dev;
> + struct hi3660_pcie_phy *phy;
> + int ret;
> +
> + phy = devm_kzalloc(dev, sizeof(*phy), GFP_KERNEL);
> + if (!phy)
> + return -ENOMEM;
> +
> + pcie->phy_priv = phy;
> + phy->dev = dev;
> +
> + /* registers */
> + pdev = container_of(dev, struct platform_device, dev);

Is there something missing here? "pdev" isn't referenced below.
Noticed by Krzysztof.

> + ret = hi3660_pcie_phy_get_clk(phy);
> + if (ret)
> + return ret;
> +
> + return hi3660_pcie_phy_get_resource(phy);
> +}