2023-03-23 08:17:57

by ye.xingchen

[permalink] [raw]
Subject: [PATCH] remoteproc/davinci: Use dev_err_probe()

From: Ye Xingchen <[email protected]>

Replace the open-code with dev_err_probe() to simplify the code.

Signed-off-by: Ye Xingchen <[email protected]>
---
drivers/remoteproc/da8xx_remoteproc.c | 10 +++-------
1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/drivers/remoteproc/da8xx_remoteproc.c b/drivers/remoteproc/da8xx_remoteproc.c
index 98e0be9476a4..b2b7d3347949 100644
--- a/drivers/remoteproc/da8xx_remoteproc.c
+++ b/drivers/remoteproc/da8xx_remoteproc.c
@@ -278,13 +278,9 @@ static int da8xx_rproc_probe(struct platform_device *pdev)
}

dsp_reset = devm_reset_control_get_exclusive(dev, NULL);
- if (IS_ERR(dsp_reset)) {
- if (PTR_ERR(dsp_reset) != -EPROBE_DEFER)
- dev_err(dev, "unable to get reset control: %ld\n",
- PTR_ERR(dsp_reset));
-
- return PTR_ERR(dsp_reset);
- }
+ if (IS_ERR(dsp_reset))
+ return dev_err_probe(dev, PTR_ERR(dsp_reset),
+ "unable to get reset control: %ld\n");

if (dev->of_node) {
ret = of_reserved_mem_device_init(dev);
--
2.25.1


2023-03-23 22:46:39

by Mathieu Poirier

[permalink] [raw]
Subject: Re: [PATCH] remoteproc/davinci: Use dev_err_probe()

On Thu, Mar 23, 2023 at 04:00:49PM +0800, [email protected] wrote:
> From: Ye Xingchen <[email protected]>
>
> Replace the open-code with dev_err_probe() to simplify the code.
>
> Signed-off-by: Ye Xingchen <[email protected]>
> ---
> drivers/remoteproc/da8xx_remoteproc.c | 10 +++-------
> 1 file changed, 3 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/remoteproc/da8xx_remoteproc.c b/drivers/remoteproc/da8xx_remoteproc.c
> index 98e0be9476a4..b2b7d3347949 100644
> --- a/drivers/remoteproc/da8xx_remoteproc.c
> +++ b/drivers/remoteproc/da8xx_remoteproc.c
> @@ -278,13 +278,9 @@ static int da8xx_rproc_probe(struct platform_device *pdev)
> }
>
> dsp_reset = devm_reset_control_get_exclusive(dev, NULL);
> - if (IS_ERR(dsp_reset)) {
> - if (PTR_ERR(dsp_reset) != -EPROBE_DEFER)
> - dev_err(dev, "unable to get reset control: %ld\n",
> - PTR_ERR(dsp_reset));
> -
> - return PTR_ERR(dsp_reset);
> - }
> + if (IS_ERR(dsp_reset))
> + return dev_err_probe(dev, PTR_ERR(dsp_reset),
> + "unable to get reset control: %ld\n");

This patch is obviously wrong and doesn't even compile.

>
> if (dev->of_node) {
> ret = of_reserved_mem_device_init(dev);
> --
> 2.25.1

2023-03-25 20:03:09

by kernel test robot

[permalink] [raw]
Subject: Re: [PATCH] remoteproc/davinci: Use dev_err_probe()

Hi,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on remoteproc/rproc-next]
[also build test WARNING on linus/master v6.3-rc3 next-20230324]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url: https://github.com/intel-lab-lkp/linux/commits/ye-xingchen-zte-com-cn/remoteproc-davinci-Use-dev_err_probe/20230323-160242
base: git://git.kernel.org/pub/scm/linux/kernel/git/remoteproc/linux.git rproc-next
patch link: https://lore.kernel.org/r/202303231600496082749%40zte.com.cn
patch subject: [PATCH] remoteproc/davinci: Use dev_err_probe()
config: arm-davinci_all_defconfig (https://download.01.org/0day-ci/archive/20230326/[email protected]/config)
compiler: clang version 17.0.0 (https://github.com/llvm/llvm-project 67409911353323ca5edf2049ef0df54132fa1ca7)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# install arm cross compiling tool for clang build
# apt-get install binutils-arm-linux-gnueabi
# https://github.com/intel-lab-lkp/linux/commit/a0080d71b9ef7a6f3996093945ea5578f8e43ce1
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review ye-xingchen-zte-com-cn/remoteproc-davinci-Use-dev_err_probe/20230323-160242
git checkout a0080d71b9ef7a6f3996093945ea5578f8e43ce1
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=arm olddefconfig
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=arm SHELL=/bin/bash drivers/remoteproc/

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <[email protected]>
| Link: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All warnings (new ones prefixed by >>):

>> drivers/remoteproc/da8xx_remoteproc.c:283:42: warning: more '%' conversions than data arguments [-Wformat-insufficient-args]
"unable to get reset control: %ld\n");
~~^
1 warning generated.

Kconfig warnings: (for reference only)
WARNING: unmet direct dependencies detected for PINCTRL_SINGLE
Depends on [n]: PINCTRL [=n] && OF [=y] && HAS_IOMEM [=y]
Selected by [y]:
- ARCH_DAVINCI [=y] && ARCH_MULTI_V5 [=y] && CPU_LITTLE_ENDIAN [=y]


vim +283 drivers/remoteproc/da8xx_remoteproc.c

235
236 static int da8xx_rproc_probe(struct platform_device *pdev)
237 {
238 struct device *dev = &pdev->dev;
239 struct da8xx_rproc *drproc;
240 struct rproc *rproc;
241 struct irq_data *irq_data;
242 struct resource *bootreg_res;
243 struct resource *chipsig_res;
244 struct clk *dsp_clk;
245 struct reset_control *dsp_reset;
246 void __iomem *chipsig;
247 void __iomem *bootreg;
248 int irq;
249 int ret;
250
251 irq = platform_get_irq(pdev, 0);
252 if (irq < 0)
253 return irq;
254
255 irq_data = irq_get_irq_data(irq);
256 if (!irq_data) {
257 dev_err(dev, "irq_get_irq_data(%d): NULL\n", irq);
258 return -EINVAL;
259 }
260
261 bootreg_res = platform_get_resource_byname(pdev, IORESOURCE_MEM,
262 "host1cfg");
263 bootreg = devm_ioremap_resource(dev, bootreg_res);
264 if (IS_ERR(bootreg))
265 return PTR_ERR(bootreg);
266
267 chipsig_res = platform_get_resource_byname(pdev, IORESOURCE_MEM,
268 "chipsig");
269 chipsig = devm_ioremap_resource(dev, chipsig_res);
270 if (IS_ERR(chipsig))
271 return PTR_ERR(chipsig);
272
273 dsp_clk = devm_clk_get(dev, NULL);
274 if (IS_ERR(dsp_clk)) {
275 dev_err(dev, "clk_get error: %ld\n", PTR_ERR(dsp_clk));
276
277 return PTR_ERR(dsp_clk);
278 }
279
280 dsp_reset = devm_reset_control_get_exclusive(dev, NULL);
281 if (IS_ERR(dsp_reset))
282 return dev_err_probe(dev, PTR_ERR(dsp_reset),
> 283 "unable to get reset control: %ld\n");
284
285 if (dev->of_node) {
286 ret = of_reserved_mem_device_init(dev);
287 if (ret) {
288 dev_err(dev, "device does not have specific CMA pool: %d\n",
289 ret);
290 return ret;
291 }
292 }
293
294 rproc = rproc_alloc(dev, "dsp", &da8xx_rproc_ops, da8xx_fw_name,
295 sizeof(*drproc));
296 if (!rproc) {
297 ret = -ENOMEM;
298 goto free_mem;
299 }
300
301 /* error recovery is not supported at present */
302 rproc->recovery_disabled = true;
303
304 drproc = rproc->priv;
305 drproc->rproc = rproc;
306 drproc->dsp_clk = dsp_clk;
307 drproc->dsp_reset = dsp_reset;
308 rproc->has_iommu = false;
309
310 ret = da8xx_rproc_get_internal_memories(pdev, drproc);
311 if (ret)
312 goto free_rproc;
313
314 platform_set_drvdata(pdev, rproc);
315
316 /* everything the ISR needs is now setup, so hook it up */
317 ret = devm_request_threaded_irq(dev, irq, da8xx_rproc_callback,
318 handle_event, 0, "da8xx-remoteproc",
319 rproc);
320 if (ret) {
321 dev_err(dev, "devm_request_threaded_irq error: %d\n", ret);
322 goto free_rproc;
323 }
324
325 /*
326 * rproc_add() can end up enabling the DSP's clk with the DSP
327 * *not* in reset, but da8xx_rproc_start() needs the DSP to be
328 * held in reset at the time it is called.
329 */
330 ret = reset_control_assert(dsp_reset);
331 if (ret)
332 goto free_rproc;
333
334 drproc->chipsig = chipsig;
335 drproc->bootreg = bootreg;
336 drproc->ack_fxn = irq_data->chip->irq_ack;
337 drproc->irq_data = irq_data;
338 drproc->irq = irq;
339
340 ret = rproc_add(rproc);
341 if (ret) {
342 dev_err(dev, "rproc_add failed: %d\n", ret);
343 goto free_rproc;
344 }
345
346 return 0;
347
348 free_rproc:
349 rproc_free(rproc);
350 free_mem:
351 if (dev->of_node)
352 of_reserved_mem_device_release(dev);
353 return ret;
354 }
355

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests