From patchwork Tue Apr 28 13:15:54 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ameya Palande X-Patchwork-Id: 20435 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n3SDG0ZP010816 for ; Tue, 28 Apr 2009 13:16:01 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758000AbZD1NP6 (ORCPT ); Tue, 28 Apr 2009 09:15:58 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1756406AbZD1NP6 (ORCPT ); Tue, 28 Apr 2009 09:15:58 -0400 Received: from smtp.nokia.com ([192.100.122.233]:26786 "EHLO mgw-mx06.nokia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758785AbZD1NP5 (ORCPT ); Tue, 28 Apr 2009 09:15:57 -0400 Received: from vaebh105.NOE.Nokia.com (vaebh105.europe.nokia.com [10.160.244.31]) by mgw-mx06.nokia.com (Switch-3.2.6/Switch-3.2.6) with ESMTP id n3SDFY1w009235; Tue, 28 Apr 2009 16:15:48 +0300 Received: from esebh102.NOE.Nokia.com ([172.21.138.183]) by vaebh105.NOE.Nokia.com with Microsoft SMTPSVC(6.0.3790.3959); Tue, 28 Apr 2009 16:15:46 +0300 Received: from mgw-int01.ntc.nokia.com ([172.21.143.96]) by esebh102.NOE.Nokia.com over TLS secured channel with Microsoft SMTPSVC(6.0.3790.3959); Tue, 28 Apr 2009 16:15:45 +0300 Received: from localhost.localdomain (esdhcp04060.research.nokia.com [172.21.40.60]) by mgw-int01.ntc.nokia.com (Switch-3.2.5/Switch-3.2.5) with ESMTP id n3SDFiD6020698; Tue, 28 Apr 2009 16:15:44 +0300 From: Ameya Palande To: linux-omap@vger.kernel.org Cc: h-kanigeri2@ti.com Subject: [PATCH][DSPBRIDGE][v2] Add the device after driver initialization Date: Tue, 28 Apr 2009 16:15:54 +0300 Message-Id: <1240924554-26025-1-git-send-email-ameya.palande@nokia.com> X-Mailer: git-send-email 1.6.2.4 In-Reply-To: <1240918303-16888-1-git-send-email-ameya.palande@nokia.com> References: <1240918303-16888-1-git-send-email-ameya.palande@nokia.com> X-OriginalArrivalTime: 28 Apr 2009 13:15:45.0657 (UTC) FILETIME=[709D1690:01C9C803] X-Nokia-AV: Clean Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org From: Ameya Palande This prevents a panic caused by an IOCTL call before driver completes its initialization. Signed-off-by: Ameya Palande --- drivers/dsp/bridge/rmgr/drv_interface.c | 29 +++++++++++++---------------- 1 files changed, 13 insertions(+), 16 deletions(-) diff --git a/drivers/dsp/bridge/rmgr/drv_interface.c b/drivers/dsp/bridge/rmgr/drv_interface.c index 9466409..79f75c9 100755 --- a/drivers/dsp/bridge/rmgr/drv_interface.c +++ b/drivers/dsp/bridge/rmgr/drv_interface.c @@ -298,14 +298,6 @@ static int __devinit omap34xx_bridge_probe(struct platform_device *pdev) bridge_device->cdev.owner = THIS_MODULE; bridge_device->cdev.ops = &bridge_fops; - status = cdev_add(&bridge_device->cdev, dev, 1); - - if (status) { - GT_0trace(driverTrace, GT_7CLASS, - "Failed to add the bridge device \n"); - return status; - } - /* udev support */ bridge_class = class_create(THIS_MODULE, "ti_bridge"); @@ -328,14 +320,6 @@ static int __devinit omap34xx_bridge_probe(struct platform_device *pdev) GT_0trace(driverTrace, GT_ENTER, "-> driver_init\n"); -#ifdef CONFIG_PM - /* Initialize the wait queue */ - if (!status) { - bridge_suspend_data.suspended = 0; - init_waitqueue_head(&bridge_suspend_data.suspend_wq); - } -#endif - SERVICES_Init(); /* Autostart flag. This should be set to true if the DSP image should @@ -429,6 +413,19 @@ static int __devinit omap34xx_bridge_probe(struct platform_device *pdev) } else { GT_0trace(driverTrace, GT_5CLASS, "DSP/BIOS Bridge driver loaded\n"); + /* Announce to kernel that we are ready */ + status = cdev_add(&bridge_device->cdev, dev, 1); + if (status) { + GT_0trace(driverTrace, GT_7CLASS, + "Failed to add the bridge device \n"); + } + else { + #ifdef CONFIG_PM + /* Initialize the wait queue */ + bridge_suspend_data.suspended = 0; + init_waitqueue_head(&bridge_suspend_data.suspend_wq); + #endif + } } }