RE: [RFC/PATCH 6/8] omap: mailbox: more more stuff to omap2_mbox_init

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

 



Felipe,

Small suggestion...if we are re-organizing can we make it look similar to how iommu is structured? This way we can maintain consistency. 


Thank you,
Best regards,
Hari

> -----Original Message-----
> From: linux-omap-owner@xxxxxxxxxxxxxxx [mailto:linux-omap-
> owner@xxxxxxxxxxxxxxx] On Behalf Of Felipe Contreras
> Sent: Sunday, May 02, 2010 7:03 PM
> To: linux-omap
> Cc: Tony Lindgren; Hiroshi Doyu; Ohad Ben-Cohen; Felipe Contreras
> Subject: [RFC/PATCH 6/8] omap: mailbox: more more stuff to omap2_mbox_init
> 
> Will be needed to split the platform_driver.
> 
> Signed-off-by: Felipe Contreras <felipe.contreras@xxxxxxxxx>
> ---
>  arch/arm/mach-omap2/mailbox.c |   49 ++++++++++++++++++------------------
> ----
>  1 files changed, 22 insertions(+), 27 deletions(-)
> 
> diff --git a/arch/arm/mach-omap2/mailbox.c b/arch/arm/mach-omap2/mailbox.c
> index e9a803c..474c1e7 100644
> --- a/arch/arm/mach-omap2/mailbox.c
> +++ b/arch/arm/mach-omap2/mailbox.c
> @@ -418,31 +418,6 @@ static int __devinit omap2_mbox_probe(struct
> platform_device *pdev)
> 
>  	res = pdev->resource;
> 
> -	mbox_base = ioremap(res->start, resource_size(res));
> -	if (!mbox_base)
> -		return -ENOMEM;
> -
> -	if (cpu_is_omap3430()) {
> -		list.num = ARRAY_SIZE(omap3_mboxes);
> -		list.mbox = omap3_mboxes;
> -
> -		list.mbox[0]->irq = res[1].start;
> -	}
> -	else if (cpu_is_omap2420()) {
> -		list.num = ARRAY_SIZE(omap2_mboxes);
> -		list.mbox = omap2_mboxes;
> -
> -		list.mbox[0]->irq = res[1].start;
> -		list.mbox[1]->irq = res[2].start;
> -	}
> -	else if (cpu_is_omap44xx()) {
> -		list.num = ARRAY_SIZE(omap4_mboxes);
> -		list.mbox = omap4_mboxes;
> -
> -		list.mbox[0]->irq = res[1].start;
> -		list.mbox[1]->irq = res[1].start;
> -	}
> -
>  	for (i = 0; i < list.num; i++) {
>  		struct omap_mbox *mbox = list.mbox[i];
>  		ret = omap_mbox_register(&pdev->dev, mbox);
> @@ -454,7 +429,6 @@ static int __devinit omap2_mbox_probe(struct
> platform_device *pdev)
>  err_out:
>  	while (i--)
>  		omap_mbox_unregister(list.mbox[i]);
> -	iounmap(mbox_base);
>  	return ret;
>  }
> 
> @@ -465,7 +439,6 @@ static int __devexit omap2_mbox_remove(struct
> platform_device *pdev)
>  	for (i = 0; i < list.num; i++)
>  		omap_mbox_unregister(list.mbox[i]);
> 
> -	iounmap(mbox_base);
>  	return 0;
>  }
> 
> @@ -483,18 +456,33 @@ static int __init omap2_mbox_init(void)
>  	struct platform_device *pdev;
>  	struct resource *res;
>  	unsigned num;
> +	struct omap_mbox_list list;
> 
>  	if (cpu_is_omap3430()) {
>  		res = omap3_mbox_resources;
>  		num = ARRAY_SIZE(omap3_mbox_resources);
> +		list.num = ARRAY_SIZE(omap3_mboxes);
> +		list.mbox = omap3_mboxes;
> +
> +		list.mbox[0]->irq = res[1].start;
>  	}
>  	else if (cpu_is_omap2420()) {
>  		res = omap2_mbox_resources;
>  		num = ARRAY_SIZE(omap2_mbox_resources);
> +		list.num = ARRAY_SIZE(omap2_mboxes);
> +		list.mbox = omap2_mboxes;
> +
> +		list.mbox[0]->irq = res[1].start;
> +		list.mbox[1]->irq = res[2].start;
>  	}
>  	else if (cpu_is_omap44xx()) {
>  		res = omap4_mbox_resources;
>  		num = ARRAY_SIZE(omap4_mbox_resources);
> +		list.num = ARRAY_SIZE(omap4_mboxes);
> +		list.mbox = omap4_mboxes;
> +
> +		list.mbox[0]->irq = res[1].start;
> +		list.mbox[1]->irq = res[1].start;
>  	}
>  	else {
>  		pr_err("%s: platform not supported\n", __func__);
> @@ -515,6 +503,12 @@ static int __init omap2_mbox_init(void)
>  	if (err)
>  		goto err_out;
> 
> +	mbox_base = ioremap(res[0].start, resource_size(&res[0]));
> +	if (!mbox_base) {
> +		platform_device_put(pdev);
> +		return -ENOMEM;
> +	}
> +
>  	return platform_driver_register(&omap2_mbox_driver);
> 
>  err_out:
> @@ -524,6 +518,7 @@ err_out:
>  static void __exit omap2_mbox_exit(void)
>  {
>  	platform_driver_unregister(&omap2_mbox_driver);
> +	iounmap(mbox_base);
>  }
> 
>  module_init(omap2_mbox_init);
> --
> 1.7.1
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-omap" in
> the body of a message to majordomo@xxxxxxxxxxxxxxx
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[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