From patchwork Tue May 18 13:31:45 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hiroshi DOYU X-Patchwork-Id: 100484 X-Patchwork-Delegate: hiroshi.doyu@nokia.com Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o4IDW8MD020539 for ; Tue, 18 May 2010 13:32:08 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757375Ab0ERNcH (ORCPT ); Tue, 18 May 2010 09:32:07 -0400 Received: from smtp.nokia.com ([192.100.105.134]:18676 "EHLO mgw-mx09.nokia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757243Ab0ERNcD (ORCPT ); Tue, 18 May 2010 09:32:03 -0400 Received: from vaebh105.NOE.Nokia.com (vaebh105.europe.nokia.com [10.160.244.31]) by mgw-mx09.nokia.com (Switch-3.3.3/Switch-3.3.3) with ESMTP id o4IDVaxk003912; Tue, 18 May 2010 08:31:50 -0500 Received: from vaebh104.NOE.Nokia.com ([10.160.244.30]) by vaebh105.NOE.Nokia.com with Microsoft SMTPSVC(6.0.3790.3959); Tue, 18 May 2010 16:31:48 +0300 Received: from mgw-sa02.ext.nokia.com ([147.243.1.48]) by vaebh104.NOE.Nokia.com over TLS secured channel with Microsoft SMTPSVC(6.0.3790.3959); Tue, 18 May 2010 16:31:47 +0300 Received: from localhost (esdhcp041238.research.nokia.com [172.21.41.238]) by mgw-sa02.ext.nokia.com (Switch-3.3.3/Switch-3.3.3) with ESMTP id o4IDVjQb029390; Tue, 18 May 2010 16:31:45 +0300 Date: Tue, 18 May 2010 16:31:45 +0300 (EEST) Message-Id: <20100518.163145.232774311.Hiroshi.DOYU@nokia.com> To: felipe.contreras@gmail.com Cc: linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org, tony@atomide.com, linux@arm.linux.org.uk Subject: Re: [PATCH v2 00/17] omap: mailbox: reorganize init From: Hiroshi DOYU In-Reply-To: References: <1273849310-32169-1-git-send-email-felipe.contreras@gmail.com> <20100518.114642.35020415.Hiroshi.DOYU@nokia.com> X-Mailer: Mew version 6.2 on Emacs 22.2 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 X-OriginalArrivalTime: 18 May 2010 13:31:47.0816 (UTC) FILETIME=[7724A680:01CAF68E] X-Nokia-AV: Clean Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Tue, 18 May 2010 13:32:08 +0000 (UTC) From c7e5d7342c3d0b975601ae4a6b8bdbe77b4d6a5d Mon Sep 17 00:00:00 2001 From: Hiroshi DOYU Date: Tue, 18 May 2010 15:45:23 +0300 Subject: [PATCH 1/1] omap mailbox: Set a device in logical mbox instances 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 --- arch/arm/plat-omap/mailbox.c | 17 ++++++++++++++++- 1 files changed, 16 insertions(+), 1 deletions(-) diff --git a/arch/arm/plat-omap/mailbox.c b/arch/arm/plat-omap/mailbox.c index c549af3..36b3aa2 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) } EXPORT_SYMBOL(omap_mbox_put); +static struct class omap_mbox_class = { .name = "mbox", }; + int omap_mbox_register(struct device *parent, struct omap_mbox *mbox) { int ret = 0; @@ -357,6 +359,11 @@ int omap_mbox_register(struct device *parent, struct omap_mbox *mbox) if (mbox->next) return -EBUSY; + mbox->dev = device_create(&omap_mbox_class, + parent, 0, mbox, "%s", mbox->name); + if (IS_ERR(mbox->dev)) + return PTR_ERR(mbox->dev); + spin_lock(&mboxes_lock); tmp = find_mboxes(mbox->name); if (*tmp) { @@ -385,6 +392,7 @@ int omap_mbox_unregister(struct omap_mbox *mbox) *tmp = mbox->next; mbox->next = NULL; spin_unlock(&mboxes_lock); + device_unregister(mbox->dev); return 0; } tmp = &(*tmp)->next; @@ -397,6 +405,12 @@ EXPORT_SYMBOL(omap_mbox_unregister); static int __init omap_mbox_init(void) { + int err; + + err = class_register(&omap_mbox_class); + if (err) + return err; + mboxd = create_workqueue("mboxd"); if (!mboxd) return -ENOMEM; @@ -407,11 +421,12 @@ static int __init omap_mbox_init(void) return 0; } -module_init(omap_mbox_init); +subsys_initcall(omap_mbox_init); static void __exit omap_mbox_exit(void) { destroy_workqueue(mboxd); + class_unregister(&omap_mbox_class); } module_exit(omap_mbox_exit); -- 1.7.1.rc1