aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/plat-omap
diff options
context:
space:
mode:
authorHiroshi DOYU <Hiroshi.DOYU@nokia.com>2010-05-18 09:15:32 -0400
committerHiroshi DOYU <Hiroshi.DOYU@nokia.com>2010-08-04 08:50:17 -0400
commit6b23398591a51943dbf08f30cfc2475a895cb1b4 (patch)
treeff2c318b9fa3ef8a90d0413a85976614fd822cd7 /arch/arm/plat-omap
parentb5bebe410204cf84337b54c372cceda2d6b27de6 (diff)
omap mailbox: Set a device in logical mbox instance for traceability
With this patch, you'll get the following sysfs directories. This structure implies that a single platform device, "omap2-mailbox" holds multiple logical mbox instances. This could be the base to add sysfs files for each logical mboxes. Then userland application can access a mbox through sysfs entries if necessary(ex: setting kfifo size dynamically) ~# tree -d -L 2 /sys/devices/platform/omap2-mailbox/ /sys/devices/platform/omap2-mailbox/ |-- driver -> ../../../bus/platform/drivers/omap2-mailbox |-- mbox | |-- dsp <- they are each instances of logical mailbox. | |-- ducati | |-- iva2 | |-- mbox01 | |-- mbox02 | |-- mbox03 | |-- ..... | `-- tesla |-- power `-- subsystem -> ../../../bus/platform This was wrongly dropped by: commit c7c158e57bce6220644f2bcd65d82e1468aa40ec Signed-off-by: Hiroshi DOYU <Hiroshi.DOYU@nokia.com>
Diffstat (limited to 'arch/arm/plat-omap')
-rw-r--r--arch/arm/plat-omap/mailbox.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/arch/arm/plat-omap/mailbox.c b/arch/arm/plat-omap/mailbox.c
index ec0e1596b4f3..87e0cde8d0db 100644
--- a/arch/arm/plat-omap/mailbox.c
+++ b/arch/arm/plat-omap/mailbox.c
@@ -347,6 +347,8 @@ void omap_mbox_put(struct omap_mbox *mbox)
347} 347}
348EXPORT_SYMBOL(omap_mbox_put); 348EXPORT_SYMBOL(omap_mbox_put);
349 349
350static struct class omap_mbox_class = { .name = "mbox", };
351
350int omap_mbox_register(struct device *parent, struct omap_mbox *mbox) 352int omap_mbox_register(struct device *parent, struct omap_mbox *mbox)
351{ 353{
352 int ret = 0; 354 int ret = 0;
@@ -357,6 +359,11 @@ int omap_mbox_register(struct device *parent, struct omap_mbox *mbox)
357 if (mbox->next) 359 if (mbox->next)
358 return -EBUSY; 360 return -EBUSY;
359 361
362 mbox->dev = device_create(&omap_mbox_class,
363 parent, 0, mbox, "%s", mbox->name);
364 if (IS_ERR(mbox->dev))
365 return PTR_ERR(mbox->dev);
366
360 spin_lock(&mboxes_lock); 367 spin_lock(&mboxes_lock);
361 tmp = find_mboxes(mbox->name); 368 tmp = find_mboxes(mbox->name);
362 if (*tmp) { 369 if (*tmp) {
@@ -385,6 +392,7 @@ int omap_mbox_unregister(struct omap_mbox *mbox)
385 *tmp = mbox->next; 392 *tmp = mbox->next;
386 mbox->next = NULL; 393 mbox->next = NULL;
387 spin_unlock(&mboxes_lock); 394 spin_unlock(&mboxes_lock);
395 device_unregister(mbox->dev);
388 return 0; 396 return 0;
389 } 397 }
390 tmp = &(*tmp)->next; 398 tmp = &(*tmp)->next;
@@ -397,6 +405,12 @@ EXPORT_SYMBOL(omap_mbox_unregister);
397 405
398static int __init omap_mbox_init(void) 406static int __init omap_mbox_init(void)
399{ 407{
408 int err;
409
410 err = class_register(&omap_mbox_class);
411 if (err)
412 return err;
413
400 mboxd = create_workqueue("mboxd"); 414 mboxd = create_workqueue("mboxd");
401 if (!mboxd) 415 if (!mboxd)
402 return -ENOMEM; 416 return -ENOMEM;
@@ -407,11 +421,12 @@ static int __init omap_mbox_init(void)
407 421
408 return 0; 422 return 0;
409} 423}
410module_init(omap_mbox_init); 424subsys_initcall(omap_mbox_init);
411 425
412static void __exit omap_mbox_exit(void) 426static void __exit omap_mbox_exit(void)
413{ 427{
414 destroy_workqueue(mboxd); 428 destroy_workqueue(mboxd);
429 class_unregister(&omap_mbox_class);
415} 430}
416module_exit(omap_mbox_exit); 431module_exit(omap_mbox_exit);
417 432