All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH][DSPBRIDGE] Add the device after driver initialization
@ 2009-04-28 11:31 Ameya Palande
  2009-04-28 13:15 ` [PATCH][DSPBRIDGE][v2] " Ameya Palande
  0 siblings, 1 reply; 3+ messages in thread
From: Ameya Palande @ 2009-04-28 11:31 UTC (permalink / raw)
  To: linux-omap; +Cc: h-kanigeri2, x00omar

From: Ameya Palande <ameya.palande@nokia.com>

This prevents a panic caused by an IOCTL call before driver
completes its initialization.

Signed-off-by: Ameya Palande <ameya.palande@nokia.com>
---
 drivers/dsp/bridge/rmgr/drv_interface.c |   14 ++++++--------
 1 files changed, 6 insertions(+), 8 deletions(-)

diff --git a/drivers/dsp/bridge/rmgr/drv_interface.c b/drivers/dsp/bridge/rmgr/drv_interface.c
index 9466409..b562513 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");
 
@@ -429,6 +421,12 @@ 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");
+			}
 		}
 	}
 
-- 
1.6.2.4


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH][DSPBRIDGE][v2] Add the device after driver initialization
  2009-04-28 11:31 [PATCH][DSPBRIDGE] Add the device after driver initialization Ameya Palande
@ 2009-04-28 13:15 ` Ameya Palande
  0 siblings, 0 replies; 3+ messages in thread
From: Ameya Palande @ 2009-04-28 13:15 UTC (permalink / raw)
  To: linux-omap; +Cc: h-kanigeri2

From: Ameya Palande <ameya.palande@nokia.com>

This prevents a panic caused by an IOCTL call before driver completes its
initialization.

Signed-off-by: Ameya Palande <ameya.palande@nokia.com>
---
 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
+			}
 		}
 	}
 
-- 
1.6.2.4


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* RE: [PATCH][DSPBRIDGE] Add the device after driver initialization
@ 2009-04-28 15:38 Ramirez Luna, Omar
  0 siblings, 0 replies; 3+ messages in thread
From: Ramirez Luna, Omar @ 2009-04-28 15:38 UTC (permalink / raw)
  To: Ameya Palande; +Cc: Kanigeri, Hari, linux-omap

Hi, 

Ameya Palande wrote:
> From: Ameya Palande <ameya.palande@nokia.com>
>
> This prevents a panic caused by an IOCTL call before driver completes its
> initialization.
>
> Signed-off-by: Ameya Palande <ameya.palande@nokia.com>
> ---
>  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 {

Checkpatch: else should follow close brace '}'

> +                               #ifdef CONFIG_PM

Moving this #ifdef & #endif to the start of the line will make it a bit easier to read.

> +                               /* Initialize the wait queue */
> +                               bridge_suspend_data.suspended = 0;
> +                               init_waitqueue_head(&bridge_suspend_data.suspend_wq);
> +                               #endif
> +                       }

Line over 80 characters.

What if you replace "if (DSP_SUCCEEDED(initStatus)) {" on line 403 for a goto and a failure comment, then you can remove one level of indentation.

>                }
>        }
>
> --
> 1.6.2.4

- omar

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2009-04-28 15:39 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-04-28 11:31 [PATCH][DSPBRIDGE] Add the device after driver initialization Ameya Palande
2009-04-28 13:15 ` [PATCH][DSPBRIDGE][v2] " Ameya Palande
2009-04-28 15:38 [PATCH][DSPBRIDGE] " Ramirez Luna, Omar

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.