lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <5151B91B.7060404@metafoo.de>
Date:	Tue, 26 Mar 2013 16:04:59 +0100
From:	Lars-Peter Clausen <lars@...afoo.de>
To:	Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
CC:	Vinod Koul <vinod.koul@...el.com>, Arnd Bergmann <arnd@...db.de>,
	Viresh Kumar <viresh.kumar@...aro.org>,
	linux-kernel@...r.kernel.org, spear-devel <spear-devel@...t.st.com>
Subject: Re: [PATCH v2 3/4] dw_dmac: make wrapper on of_dma_controller_register()

On 03/26/2013 03:53 PM, Andy Shevchenko wrote:
> This patch introduces new method dw_dma_of_controller_register() and adds
> checks of the of_node presence together with CONFIG_OF before calling the
> wrapper. It helps to distinguish the real -ENODEV return code of fake one when
> of_dma_controller_register is not implemented.

If CONFIG_OF is not set the of_node of the device will always be NULL. Which
means of_dma_controller_register() will only be called if it is implemented.
So you'll never get the -ENODEV from the of_dma_controller_register() stub.

- Lars

> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
> ---
>  drivers/dma/dw_dmac.c | 19 ++++++++++++-------
>  1 file changed, 12 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/dma/dw_dmac.c b/drivers/dma/dw_dmac.c
> index 274fd7d..c1f017b 100644
> --- a/drivers/dma/dw_dmac.c
> +++ b/drivers/dma/dw_dmac.c
> @@ -1303,6 +1303,16 @@ static struct dma_chan *dw_dma_of_xlate(struct of_phandle_args *dma_spec,
>  	return dma_request_channel(cap, dw_dma_of_filter, &fargs);
>  }
>  
> +static void dw_dma_of_controller_register(struct dw_dma *dw)
> +{
> +	struct device *dev = dw->dma.dev;
> +	int err;
> +
> +	err = of_dma_controller_register(dev->of_node, dw_dma_of_xlate, dw);
> +	if (err)
> +		dev_err(dev, "could not register of_dma_controller\n");
> +}
> +
>  /* --------------------- Cyclic DMA API extensions -------------------- */
>  
>  /**
> @@ -1843,13 +1853,8 @@ static int dw_probe(struct platform_device *pdev)
>  
>  	dma_async_device_register(&dw->dma);
>  
> -	if (pdev->dev.of_node) {
> -		err = of_dma_controller_register(pdev->dev.of_node,
> -						 dw_dma_of_xlate, dw);
> -		if (err && err != -ENODEV)
> -			dev_err(&pdev->dev,
> -				"could not register of_dma_controller\n");
> -	}
> +	if (IS_ENABLED(CONFIG_OF) && pdev->dev.of_node)
> +		dw_dma_of_controller_register(dw);
>  
>  	return 0;
>  }

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ