Message ID | 20181221083238.10020-1-a.hajda@samsung.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | PCI: pcie-rockchip: use probe_err helpers instead of open coding | expand |
Hi Andrzej, I love your patch! Yet something to improve: [auto build test ERROR on rockchip/for-next] [also build test ERROR on v4.20-rc7] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system] url: https://github.com/0day-ci/linux/commits/Andrzej-Hajda/PCI-pcie-rockchip-use-probe_err-helpers-instead-of-open-coding/20181222-044838 base: https://git.kernel.org/pub/scm/linux/kernel/git/mmind/linux-rockchip.git for-next config: ia64-allmodconfig (attached as .config) compiler: ia64-linux-gcc (GCC) 8.1.0 reproduce: wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # save the attached .config to linux build tree GCC_VERSION=8.1.0 make.cross ARCH=ia64 All errors (new ones prefixed by >>): drivers/pci/controller/pcie-rockchip.c: In function 'rockchip_pcie_parse_dt': >> drivers/pci/controller/pcie-rockchip.c:73:10: error: implicit declaration of function 'probe_err_ptr'; did you mean 'probe_irq_off'? [-Werror=implicit-function-declaration] return probe_err_ptr(dev, rockchip->core_rst, ^~~~~~~~~~~~~ probe_irq_off cc1: some warnings being treated as errors vim +73 drivers/pci/controller/pcie-rockchip.c 24 25 int rockchip_pcie_parse_dt(struct rockchip_pcie *rockchip) 26 { 27 struct device *dev = rockchip->dev; 28 struct platform_device *pdev = to_platform_device(dev); 29 struct device_node *node = dev->of_node; 30 struct resource *regs; 31 int err; 32 33 if (rockchip->is_rc) { 34 regs = platform_get_resource_byname(pdev, 35 IORESOURCE_MEM, 36 "axi-base"); 37 rockchip->reg_base = devm_pci_remap_cfg_resource(dev, regs); 38 if (IS_ERR(rockchip->reg_base)) 39 return PTR_ERR(rockchip->reg_base); 40 } else { 41 rockchip->mem_res = 42 platform_get_resource_byname(pdev, IORESOURCE_MEM, 43 "mem-base"); 44 if (!rockchip->mem_res) 45 return -EINVAL; 46 } 47 48 regs = platform_get_resource_byname(pdev, IORESOURCE_MEM, 49 "apb-base"); 50 rockchip->apb_base = devm_ioremap_resource(dev, regs); 51 if (IS_ERR(rockchip->apb_base)) 52 return PTR_ERR(rockchip->apb_base); 53 54 err = rockchip_pcie_get_phys(rockchip); 55 if (err) 56 return err; 57 58 rockchip->lanes = 1; 59 err = of_property_read_u32(node, "num-lanes", &rockchip->lanes); 60 if (!err && (rockchip->lanes == 0 || 61 rockchip->lanes == 3 || 62 rockchip->lanes > 4)) { 63 dev_warn(dev, "invalid num-lanes, default to use one lane\n"); 64 rockchip->lanes = 1; 65 } 66 67 rockchip->link_gen = of_pci_get_max_link_speed(node); 68 if (rockchip->link_gen < 0 || rockchip->link_gen > 2) 69 rockchip->link_gen = 2; 70 71 rockchip->core_rst = devm_reset_control_get_exclusive(dev, "core"); 72 if (IS_ERR(rockchip->core_rst)) > 73 return probe_err_ptr(dev, rockchip->core_rst, 74 "missing core reset property in node\n"); 75 76 rockchip->mgmt_rst = devm_reset_control_get_exclusive(dev, "mgmt"); 77 if (IS_ERR(rockchip->mgmt_rst)) 78 return probe_err_ptr(dev, rockchip->mgmt_rst, 79 "missing mgmt reset property in node\n"); 80 81 rockchip->mgmt_sticky_rst = devm_reset_control_get_exclusive(dev, 82 "mgmt-sticky"); 83 if (IS_ERR(rockchip->mgmt_sticky_rst)) 84 return probe_err_ptr(dev, rockchip->mgmt_sticky_rst, 85 "missing mgmt-sticky reset property in node\n"); 86 87 rockchip->pipe_rst = devm_reset_control_get_exclusive(dev, "pipe"); 88 if (IS_ERR(rockchip->pipe_rst)) 89 return probe_err_ptr(dev, rockchip->pipe_rst, 90 "missing pipe reset property in node\n"); 91 92 rockchip->pm_rst = devm_reset_control_get_exclusive(dev, "pm"); 93 if (IS_ERR(rockchip->pm_rst)) 94 return probe_err_ptr(dev, rockchip->pm_rst, 95 "missing pm reset property in node\n"); 96 97 rockchip->pclk_rst = devm_reset_control_get_exclusive(dev, "pclk"); 98 if (IS_ERR(rockchip->pclk_rst)) 99 return probe_err_ptr(dev, rockchip->pclk_rst, 100 "missing pclk reset property in node\n"); 101 102 rockchip->aclk_rst = devm_reset_control_get_exclusive(dev, "aclk"); 103 if (IS_ERR(rockchip->aclk_rst)) 104 return probe_err_ptr(dev, rockchip->aclk_rst, 105 "missing aclk reset property in node\n"); 106 107 if (rockchip->is_rc) { 108 rockchip->ep_gpio = devm_gpiod_get(dev, "ep", GPIOD_OUT_HIGH); 109 if (IS_ERR(rockchip->ep_gpio)) 110 return probe_err_ptr(dev, rockchip->ep_gpio, 111 "missing ep-gpios property in node\n"); 112 } 113 114 rockchip->aclk_pcie = devm_clk_get(dev, "aclk"); 115 if (IS_ERR(rockchip->aclk_pcie)) 116 return probe_err_ptr(dev, rockchip->aclk_pcie, 117 "aclk clock not found\n"); 118 119 rockchip->aclk_perf_pcie = devm_clk_get(dev, "aclk-perf"); 120 if (IS_ERR(rockchip->aclk_perf_pcie)) 121 return probe_err_ptr(dev, rockchip->aclk_perf_pcie, 122 "aclk_perf clock not found\n"); 123 124 rockchip->hclk_pcie = devm_clk_get(dev, "hclk"); 125 if (IS_ERR(rockchip->hclk_pcie)) 126 return probe_err_ptr(dev, rockchip->hclk_pcie, 127 "hclk clock not found\n"); 128 129 rockchip->clk_pcie_pm = devm_clk_get(dev, "pm"); 130 if (IS_ERR(rockchip->clk_pcie_pm)) 131 return probe_err_ptr(dev, rockchip->clk_pcie_pm, 132 "pm clock not found\n"); 133 134 return 0; 135 } 136 EXPORT_SYMBOL_GPL(rockchip_pcie_parse_dt); 137 --- 0-DAY kernel test infrastructure Open Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation
diff --git a/drivers/pci/controller/pcie-rockchip.c b/drivers/pci/controller/pcie-rockchip.c index c53d1322a3d6..0d4f012c02ba 100644 --- a/drivers/pci/controller/pcie-rockchip.c +++ b/drivers/pci/controller/pcie-rockchip.c @@ -69,86 +69,67 @@ int rockchip_pcie_parse_dt(struct rockchip_pcie *rockchip) rockchip->link_gen = 2; rockchip->core_rst = devm_reset_control_get_exclusive(dev, "core"); - if (IS_ERR(rockchip->core_rst)) { - if (PTR_ERR(rockchip->core_rst) != -EPROBE_DEFER) - dev_err(dev, "missing core reset property in node\n"); - return PTR_ERR(rockchip->core_rst); - } + if (IS_ERR(rockchip->core_rst)) + return probe_err_ptr(dev, rockchip->core_rst, + "missing core reset property in node\n"); rockchip->mgmt_rst = devm_reset_control_get_exclusive(dev, "mgmt"); - if (IS_ERR(rockchip->mgmt_rst)) { - if (PTR_ERR(rockchip->mgmt_rst) != -EPROBE_DEFER) - dev_err(dev, "missing mgmt reset property in node\n"); - return PTR_ERR(rockchip->mgmt_rst); - } + if (IS_ERR(rockchip->mgmt_rst)) + return probe_err_ptr(dev, rockchip->mgmt_rst, + "missing mgmt reset property in node\n"); rockchip->mgmt_sticky_rst = devm_reset_control_get_exclusive(dev, "mgmt-sticky"); - if (IS_ERR(rockchip->mgmt_sticky_rst)) { - if (PTR_ERR(rockchip->mgmt_sticky_rst) != -EPROBE_DEFER) - dev_err(dev, "missing mgmt-sticky reset property in node\n"); - return PTR_ERR(rockchip->mgmt_sticky_rst); - } + if (IS_ERR(rockchip->mgmt_sticky_rst)) + return probe_err_ptr(dev, rockchip->mgmt_sticky_rst, + "missing mgmt-sticky reset property in node\n"); rockchip->pipe_rst = devm_reset_control_get_exclusive(dev, "pipe"); - if (IS_ERR(rockchip->pipe_rst)) { - if (PTR_ERR(rockchip->pipe_rst) != -EPROBE_DEFER) - dev_err(dev, "missing pipe reset property in node\n"); - return PTR_ERR(rockchip->pipe_rst); - } + if (IS_ERR(rockchip->pipe_rst)) + return probe_err_ptr(dev, rockchip->pipe_rst, + "missing pipe reset property in node\n"); rockchip->pm_rst = devm_reset_control_get_exclusive(dev, "pm"); - if (IS_ERR(rockchip->pm_rst)) { - if (PTR_ERR(rockchip->pm_rst) != -EPROBE_DEFER) - dev_err(dev, "missing pm reset property in node\n"); - return PTR_ERR(rockchip->pm_rst); - } + if (IS_ERR(rockchip->pm_rst)) + return probe_err_ptr(dev, rockchip->pm_rst, + "missing pm reset property in node\n"); rockchip->pclk_rst = devm_reset_control_get_exclusive(dev, "pclk"); - if (IS_ERR(rockchip->pclk_rst)) { - if (PTR_ERR(rockchip->pclk_rst) != -EPROBE_DEFER) - dev_err(dev, "missing pclk reset property in node\n"); - return PTR_ERR(rockchip->pclk_rst); - } + if (IS_ERR(rockchip->pclk_rst)) + return probe_err_ptr(dev, rockchip->pclk_rst, + "missing pclk reset property in node\n"); rockchip->aclk_rst = devm_reset_control_get_exclusive(dev, "aclk"); - if (IS_ERR(rockchip->aclk_rst)) { - if (PTR_ERR(rockchip->aclk_rst) != -EPROBE_DEFER) - dev_err(dev, "missing aclk reset property in node\n"); - return PTR_ERR(rockchip->aclk_rst); - } + if (IS_ERR(rockchip->aclk_rst)) + return probe_err_ptr(dev, rockchip->aclk_rst, + "missing aclk reset property in node\n"); if (rockchip->is_rc) { rockchip->ep_gpio = devm_gpiod_get(dev, "ep", GPIOD_OUT_HIGH); - if (IS_ERR(rockchip->ep_gpio)) { - dev_err(dev, "missing ep-gpios property in node\n"); - return PTR_ERR(rockchip->ep_gpio); - } + if (IS_ERR(rockchip->ep_gpio)) + return probe_err_ptr(dev, rockchip->ep_gpio, + "missing ep-gpios property in node\n"); } rockchip->aclk_pcie = devm_clk_get(dev, "aclk"); - if (IS_ERR(rockchip->aclk_pcie)) { - dev_err(dev, "aclk clock not found\n"); - return PTR_ERR(rockchip->aclk_pcie); - } + if (IS_ERR(rockchip->aclk_pcie)) + return probe_err_ptr(dev, rockchip->aclk_pcie, + "aclk clock not found\n"); rockchip->aclk_perf_pcie = devm_clk_get(dev, "aclk-perf"); - if (IS_ERR(rockchip->aclk_perf_pcie)) { - dev_err(dev, "aclk_perf clock not found\n"); - return PTR_ERR(rockchip->aclk_perf_pcie); - } + if (IS_ERR(rockchip->aclk_perf_pcie)) + return probe_err_ptr(dev, rockchip->aclk_perf_pcie, + "aclk_perf clock not found\n"); rockchip->hclk_pcie = devm_clk_get(dev, "hclk"); - if (IS_ERR(rockchip->hclk_pcie)) { - dev_err(dev, "hclk clock not found\n"); - return PTR_ERR(rockchip->hclk_pcie); - } + if (IS_ERR(rockchip->hclk_pcie)) + return probe_err_ptr(dev, rockchip->hclk_pcie, + "hclk clock not found\n"); rockchip->clk_pcie_pm = devm_clk_get(dev, "pm"); - if (IS_ERR(rockchip->clk_pcie_pm)) { - dev_err(dev, "pm clock not found\n"); - return PTR_ERR(rockchip->clk_pcie_pm); - } + if (IS_ERR(rockchip->clk_pcie_pm)) + return probe_err_ptr(dev, rockchip->clk_pcie_pm, + "pm clock not found\n"); return 0; } @@ -323,12 +304,9 @@ int rockchip_pcie_get_phys(struct rockchip_pcie *rockchip) phy = devm_of_phy_get(dev, dev->of_node, name); kfree(name); - if (IS_ERR(phy)) { - if (PTR_ERR(phy) != -EPROBE_DEFER) - dev_err(dev, "missing phy for lane %d: %ld\n", - i, PTR_ERR(phy)); - return PTR_ERR(phy); - } + if (IS_ERR(phy)) + return probe_err_ptr(dev, phy, + "missing phy for lane %d\n", i); rockchip->phys[i] = phy; }
probe_err helpers makes probe error handling easier and less error prone. Signed-off-by: Andrzej Hajda <a.hajda@samsung.com> --- Hi all, This is sample conversion of one of drivers to proposed probe_err* helpers. It was created to convince Greg that these helpers are useful. With this helper we gain: - corect error handling (deferral does not spam dmesg, other errors are logged), - uniform error logging, - simplified code, - possibilty to check why some devices are deferred, - shorter code. Here are links to patchsets adding helpers v1[1], v4[2], in v1 I have added big patch doing conversion to probe_err to show scale of the 'issue'. If the helpers will be accepted I plan to send patches converting other drivers as well. [1]: https://lkml.org/lkml/2018/10/16/601 [2]: https://lkml.org/lkml/2018/12/20/438 Regards Andrzej --- drivers/pci/controller/pcie-rockchip.c | 100 ++++++++++--------------- 1 file changed, 39 insertions(+), 61 deletions(-)