aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-omap1
diff options
context:
space:
mode:
authorFelipe Contreras <felipe.contreras@gmail.com>2010-06-11 15:51:45 +0000
committerHiroshi DOYU <Hiroshi.DOYU@nokia.com>2010-08-04 15:50:19 +0300
commit898ee75623d5a151157e3f0dca12b0148051e2d6 (patch)
tree4c71a2b21491b4a97a18d7a6dfd1f85f1bf8281a /arch/arm/mach-omap1
parent1f2c4dfd30edfe9125a00d76596ebb3adabd8a5a (diff)
downloadkernel_samsung_smdk4412-898ee75623d5a151157e3f0dca12b0148051e2d6.zip
kernel_samsung_smdk4412-898ee75623d5a151157e3f0dca12b0148051e2d6.tar.gz
kernel_samsung_smdk4412-898ee75623d5a151157e3f0dca12b0148051e2d6.tar.bz2
omap: mailbox: reorganize registering
It's more extensible this way. Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com> Signed-off-by: Hiroshi DOYU <Hiroshi.DOYU@nokia.com>
Diffstat (limited to 'arch/arm/mach-omap1')
-rw-r--r--arch/arm/mach-omap1/mailbox.c42
1 files changed, 22 insertions, 20 deletions
diff --git a/arch/arm/mach-omap1/mailbox.c b/arch/arm/mach-omap1/mailbox.c
index 590ac66..0318754 100644
--- a/arch/arm/mach-omap1/mailbox.c
+++ b/arch/arm/mach-omap1/mailbox.c
@@ -29,6 +29,8 @@
static void __iomem *mbox_base;
+static struct omap_mbox **list;
+
struct omap_mbox1_fifo {
unsigned long cmd;
unsigned long data;
@@ -142,44 +144,44 @@ struct omap_mbox mbox_dsp_info = {
.priv = &omap1_mbox_dsp_priv,
};
+struct omap_mbox *omap1_mboxes[] = { &mbox_dsp_info, NULL };
+
static int __devinit omap1_mbox_probe(struct platform_device *pdev)
{
- struct resource *res;
+ struct resource *mem;
int ret;
+ int i;
- /* MBOX base */
- res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- if (unlikely(!res)) {
- dev_err(&pdev->dev, "invalid mem resource\n");
- return -ENODEV;
- }
+ list = omap1_mboxes;
+
+ list[0]->irq = platform_get_irq_byname(pdev, "dsp");
- mbox_base = ioremap(res->start, resource_size(res));
+ mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+ mbox_base = ioremap(mem->start, resource_size(mem));
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;
}
static int __devexit omap1_mbox_remove(struct platform_device *pdev)
{
- omap_mbox_unregister(&mbox_dsp_info);
+ int i;
+
+ for (i = 0; list[i]; i++)
+ omap_mbox_unregister(list[i]);
+
iounmap(mbox_base);
return 0;
}