[PATCH v3 10/14] omap: mailbox: reorganize registering

Hiroshi DOYU Hiroshi.DOYU at nokia.com
Mon May 24 11:24:07 EDT 2010


From: ext Felipe Contreras <felipe.contreras at gmail.com>
Subject: [PATCH v3 10/14] omap: mailbox: reorganize registering
Date: Sat, 22 May 2010 19:14:21 +0200

> platform_get_resource(pdev, IORESOURCE_MEM, 0);
> -	if (unlikely(!res)) {
> -		dev_err(&pdev->dev, "invalid mem resource\n");
> -		return -ENODEV;
> -	}
> +	res = pdev->resource;

why not?

	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);

> +
> +	list = omap1_mboxes;
>  
> -	mbox_base = ioremap(res->start, resource_size(res));
> +	list[0]->irq = platform_get_irq_byname(pdev, "dsp");
> +
> +	mbox_base = ioremap(res[0].start, resource_size(&res[0]));
>  	if (!mbox_base)
>  		return -ENOMEM;
>  
> -	/* DSP IRQ */
> -	res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
> -	if (unlikely(!res)) {
> -		dev_err(&pdev->dev, "invalid irq resource\n");
> -		ret = -ENODEV;
> -		goto err_out;
> +	for (i = 0; list[i]; i++) {
> +		ret = omap_mbox_register(&pdev->dev, list[i]);
> +		if (ret)
> +			goto err_out;
>  	}
> -	mbox_dsp_info.irq = res->start;
> -
> -	ret = omap_mbox_register(&pdev->dev, &mbox_dsp_info);
> -	if (ret)
> -		goto err_out;
>  	return 0;
>  
>  err_out:
> +	while (i--)
> +		omap_mbox_unregister(list[i]);
>  	iounmap(mbox_base);
>  	return ret;



More information about the linux-arm-kernel mailing list