Re: [PATCH 2/5] drivers: bus: omap_l3: Convert to use devm_request_and_ioremap()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Вторник,  4 марта 2014, 11:01 +02:00 от Peter Ujfalusi <peter.ujfalusi@xxxxxx>:
> We can then remove the iounmap() calls from probe and remove.
> Since the driver requests the resources via index we can do the mem resource
> request within a for loop.
> 
> Signed-off-by: Peter Ujfalusi <peter.ujfalusi@xxxxxx>
> Reviewed-by: Santosh Shilimkar <santosh.shilimkar@ti>
> ---

> +	/* Get mem resources */
> +	for (i = 0; i < 3; i++) {
> +		struct resource	*res = platform_get_resource(pdev,
> +							     IORESOURCE_MEM, i);
> +		if (!res) {
> +			dev_err(&pdev->dev, "couldn't find resource %d\n", i);
> +			return -ENODEV;
> +		}

No need to check "res". devm_request_and_ioremap() do all for us.

> -	l3->l3_base[2] = ioremap(res->start, resource_size(res));
> -	if (!l3->l3_base[2]) {
> -		dev_err(&pdev->dev, "ioremap failed\n");
> -		ret = -ENOMEM;
> -		goto err2;
> +		l3->l3_base[i] = devm_request_and_ioremap(&pdev->dev, res);
> +		if (!l3->l3_base[i]) {

if (IS_ERR(l3->l3_base[i]))

> +			dev_err(&pdev->dev, "ioremap %d failed\n", i);

Unnecessary.

> +			return -ENOMEM;

return PTR_ERR(l3->l3_base[i]);

---
��.n��������+%������w��{.n�����{�������ܨ}���Ơz�j:+v�����w����ޙ��&�)ߡ�a����z�ޗ���ݢj��w�f





[Index of Archives]     [Linux Arm (vger)]     [ARM Kernel]     [ARM MSM]     [Linux Tegra]     [Linux WPAN Networking]     [Linux Wireless Networking]     [Maemo Users]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux