misc: tegra-baseband: Add shutdown handler.
Raj Jayaraman [Sat, 5 Jan 2013 07:54:43 +0000 (23:54 -0800)]
Bug 1195969

Change-Id: I11748880b7f70ec98be63af27201c2b9bd2465a4
Signed-off-by: Raj Jayaraman <rjayaraman@nvidia.com>
Reviewed-on: http://git-master/r/188927
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Yu-Huan Hsu <yhsu@nvidia.com>

drivers/misc/tegra-baseband/bb-oem1.c
drivers/misc/tegra-baseband/bb-power.c

index d782f41..78b65e9 100644 (file)
@@ -331,8 +331,6 @@ static irqreturn_t bb_wake_irq(int irq, void *dev_id)
        int cwrlevel = bb_get_cwr();
        bool pwrstate_l2 = false;
 
-       pr_info("%s. CWR = %d.\n", __func__, cwrlevel); /* for now */
-
        bb_getdata(&data);
        pwrstate_l2 = ((data.powerstate == BBSTATE_L02L2) ||
                                (data.powerstate == BBSTATE_L2));
@@ -609,7 +607,7 @@ static void *bb_deinit(void)
        /* destroy wake lock */
        wake_lock_destroy(&bb_locks.wlock);
 
-       return (void *) &bb_gdata;
+       return (void *) &bb_data;
 }
 
 static struct tegra_bb_callback bb_callbacks = {
index a06efa5..a02bfa3 100644 (file)
@@ -121,9 +121,11 @@ static int tegra_bb_power_gpio_deinit(struct tegra_bb_power_gdata *gdata)
        gpioirq = gdata->gpioirq;
        for (; gpioirq->id != GPIO_INVALID; ++gpioirq) {
 
-               /* Free the irq */
-               free_irq(gpio_to_irq(gpioirq->id), gpioirq->cookie);
+               if (gpioirq->handler != NULL)
+                       /* Free the irq */
+                       free_irq(gpio_to_irq(gpioirq->id), gpioirq->cookie);
        }
+
        return 0;
 }
 
@@ -346,6 +348,11 @@ static int tegra_bb_power_remove(struct platform_device *device)
        return 0;
 }
 
+static void tegra_bb_power_shutdown(struct platform_device *device)
+{
+       tegra_bb_power_remove(device);
+}
+
 #ifdef CONFIG_PM
 static int tegra_bb_driver_suspend(struct device *dev)
 {
@@ -390,6 +397,7 @@ static const struct dev_pm_ops tegra_bb_pm_ops = {
 static struct platform_driver tegra_bb_power_driver = {
        .probe = tegra_bb_power_probe,
        .remove = tegra_bb_power_remove,
+       .shutdown = tegra_bb_power_shutdown,
        .driver = {
                .name = "tegra_baseband_power",
 #ifdef CONFIG_PM