[PATCH v2 11/11] pci: dwc: pcie-kirin: cleanup kirin970_pcie_get_eyeparam()

Mauro Carvalho Chehab
2021-02-03T07:04:51Z

Cleanup the routine, to let it clearer that eye_param is optional and
that, if not specified, the driver will assume the default.

While here, also drop the useless debug prints.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
---
drivers/pci/controller/dwc/pcie-kirin.c | 17 +++++++----------
1 file changed, 7 insertions(+), 10 deletions(-)

diff --git a/drivers/pci/controller/dwc/pcie-kirin.c b/drivers/pci/controller/dwc/pcie-kirin.c
index c5404f1eca28..88f10aff8b09 100644
--- a/drivers/pci/controller/dwc/pcie-kirin.c
+++ b/drivers/pci/controller/dwc/pcie-kirin.c
@@ -246,21 +246,18 @@ static long kirin_pcie_get_clk(struct kirin_pcie *kirin_pcie,
void kirin970_pcie_get_eyeparam(struct kirin_pcie *pcie)
{
struct device *dev = pcie->pci->dev;
- int i;
struct device_node *np;
+ int ret, i;

np = dev->of_node;

- if (of_property_read_u32_array(np, "eye_param", pcie->eye_param, 5)) {
- for (i = 0; i < 5; i++)
+ ret = of_property_read_u32_array(np, "eye_param", pcie->eye_param, 5);
+ if (!ret)
+ return;
+
+ /* There's no optional eye_param property. Set array to default */
+ for (i = 0; i < 5; i++)
pcie->eye_param[i] = EYEPARAM_NOCFG;
- }
-
- dev_dbg(dev, "eye_param_vboost = [0x%x]\n", pcie->eye_param[0]);
- dev_dbg(dev, "eye_param_iboost = [0x%x]\n", pcie->eye_param[1]);
- dev_dbg(dev, "eye_param_pre = [0x%x]\n", pcie->eye_param[2]);
- dev_dbg(dev, "eye_param_post = [0x%x]\n", pcie->eye_param[3]);
- dev_dbg(dev, "eye_param_main = [0x%x]\n", pcie->eye_param[4]);
}

static void kirin970_pcie_set_eyeparam(struct kirin_pcie *kirin_pcie)
--
2.29.2