From 3d77a4f0c1763ecbe41b63e238a9fb82b262bcf5 Mon Sep 17 00:00:00 2001 From: Rakesh Goyal Date: Sat, 10 Mar 2012 07:03:17 +0530 Subject: misc: bluetooth: clean ti_bluesleep patch Remove dead code Remove whitespace Remove platform callback function and add wake_lock/wake_unlock Fix compilation warnings Bug 933054 Bug 931931 Change-Id: I5b0947ad2053f9e0437ffe89879df2c84786ec9c Signed-off-by: Rakesh Goyal Reviewed-on: http://git-master/r/89274 Reviewed-by: Nagarjuna Kristam Tested-by: Nagarjuna Kristam Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: Sachin Nikam --- drivers/misc/ti-st/st_core.c | 1 - drivers/misc/ti-st/st_kim.c | 54 +++++++++++++------------------------------- drivers/misc/ti-st/st_ll.c | 42 ++++++++++++---------------------- 3 files changed, 31 insertions(+), 66 deletions(-) (limited to 'drivers/misc') diff --git a/drivers/misc/ti-st/st_core.c b/drivers/misc/ti-st/st_core.c index 67026f87dcd9..dde6d57dea55 100644 --- a/drivers/misc/ti-st/st_core.c +++ b/drivers/misc/ti-st/st_core.c @@ -50,7 +50,6 @@ static void remove_channel_from_table(struct st_data_s *st_gdata, struct st_proto_s *proto) { pr_info("%s: id %d\n", __func__, proto->chnl_id); -/* st_gdata->list[proto->chnl_id] = NULL; */ st_gdata->is_registered[proto->chnl_id] = false; } diff --git a/drivers/misc/ti-st/st_kim.c b/drivers/misc/ti-st/st_kim.c index 5996b934abf0..addb6c5a3a3b 100644 --- a/drivers/misc/ti-st/st_kim.c +++ b/drivers/misc/ti-st/st_kim.c @@ -451,9 +451,7 @@ long st_kim_start(void *kim_data) do { /* platform specific enabling code here */ - if (pdata->chip_enable) - pdata->chip_enable(); - + wake_lock(&kim_gdata->core_data->st_wk_lock); /* Configure BT nShutdown to HIGH state */ gpio_set_value(kim_gdata->nshutdown, GPIO_LOW); mdelay(5); /* FIXME: a proper toggle */ @@ -517,8 +515,6 @@ long st_kim_stop(void *kim_data) { long err = 0; struct kim_data_s *kim_gdata = (struct kim_data_s *)kim_data; - struct ti_st_plat_data *pdata = - kim_gdata->kim_pdev->dev.platform_data; INIT_COMPLETION(kim_gdata->ldisc_installed); @@ -547,8 +543,7 @@ long st_kim_stop(void *kim_data) gpio_set_value(kim_gdata->nshutdown, GPIO_LOW); /* platform specific disable */ - if (pdata->chip_disable) - pdata->chip_disable(); + wake_unlock(&kim_gdata->core_data->st_wk_lock); return err; } @@ -707,6 +702,8 @@ static int kim_probe(struct platform_device *pdev) /* refer to itself */ kim_gdata->core_data->kim_data = kim_gdata; + wake_lock_init(&kim_gdata->core_data->st_wk_lock, WAKE_LOCK_SUSPEND, + "st_wake_lock"); /* Claim the chip enable nShutdown gpio from the system */ kim_gdata->nshutdown = pdata->nshutdown_gpio; status = gpio_request(kim_gdata->nshutdown, "kim"); @@ -715,8 +712,6 @@ static int kim_probe(struct platform_device *pdev) return status; } - tegra_gpio_enable(kim_gdata->nshutdown); - /* Configure nShutdown GPIO as output=0 */ status = gpio_direction_output(kim_gdata->nshutdown, 0); if (unlikely(status)) { @@ -774,6 +769,7 @@ static int kim_remove(struct platform_device *pdev) sysfs_remove_group(&pdev->dev.kobj, &uim_attr_grp); pr_info("sysfs entries removed"); + wake_lock_destroy(&kim_gdata->core_data->st_wk_lock); kim_gdata->kim_pdev = NULL; st_core_exit(kim_gdata->core_data); @@ -783,49 +779,31 @@ static int kim_remove(struct platform_device *pdev) return 0; } -static unsigned long retry_suspend; - int kim_suspend(struct platform_device *pdev, pm_message_t state) { - struct ti_st_plat_data *pdata = pdev->dev.platform_data; - int ret; struct kim_data_s *kim_gdata; - struct st_data_s *core_data; - kim_gdata = dev_get_drvdata(&pdev->dev); - core_data = kim_gdata->core_data; - struct uart_state *uart_state; - struct uart_port *uport; - + struct st_data_s *core_data; + struct uart_state *uart_state; + struct uart_port *uport; + kim_gdata = dev_get_drvdata(&pdev->dev); + core_data = kim_gdata->core_data; if (st_ll_getstate(core_data) != ST_LL_INVALID) { - uart_state = core_data->tty->driver_data; - uport = uart_state->uart_port; + uart_state = core_data->tty->driver_data; + uport = uart_state->uart_port; #ifdef CONFIG_BT_TIBLUESLEEP - pr_info(" Bluesleep Start"); - bluesleep_start(uport); + pr_info(" Bluesleep Start"); + bluesleep_start(uport); #endif - - - } - - if (pdata->suspend) { - ret = pdata->suspend(pdev, state); - return ret; } - return -EOPNOTSUPP; + return 0; } int kim_resume(struct platform_device *pdev) { - struct ti_st_plat_data *pdata = pdev->dev.platform_data; - - if (pdata->resume) { - return pdata->resume(pdev); - } - - return -EOPNOTSUPP; + return 0; } /**********************************************************************/ diff --git a/drivers/misc/ti-st/st_ll.c b/drivers/misc/ti-st/st_ll.c index 0025dde6a6d9..82558a36ceb2 100644 --- a/drivers/misc/ti-st/st_ll.c +++ b/drivers/misc/ti-st/st_ll.c @@ -38,9 +38,6 @@ static void send_ll_cmd(struct st_data_s *st_data, static void ll_device_want_to_sleep(struct st_data_s *st_data) { - struct kim_data_s *kim_data; - struct ti_st_plat_data *pdata; - pr_debug("%s", __func__); /* sanity check */ if (st_data->ll_state != ST_LL_AWAKE) @@ -52,24 +49,20 @@ static void ll_device_want_to_sleep(struct st_data_s *st_data) st_data->ll_state = ST_LL_ASLEEP; /* communicate to platform about chip asleep */ - kim_data = st_data->kim_data; - pdata = kim_data->kim_pdev->dev.platform_data; - if (pdata->chip_asleep) - pdata->chip_asleep(); +#ifdef CONFIG_WAKELOCK + wake_unlock(&st_data->st_wk_lock); +#endif } static void ll_device_want_to_wakeup(struct st_data_s *st_data) { - struct kim_data_s *kim_data = st_data->kim_data; - struct ti_st_plat_data *pdata = kim_data->kim_pdev->dev.platform_data; - /* diff actions in diff states */ switch (st_data->ll_state) { case ST_LL_ASLEEP: /* communicate to platform about chip wakeup */ - if (pdata->chip_awake) - pdata->chip_awake(); - +#ifdef CONFIG_WAKELOCK + wake_lock(&st_data->st_wk_lock); +#endif send_ll_cmd(st_data, LL_WAKE_UP_ACK); /* send wake_ack */ break; case ST_LL_ASLEEP_TO_AWAKE: @@ -97,12 +90,10 @@ static void ll_device_want_to_wakeup(struct st_data_s *st_data) * enable ST LL */ void st_ll_enable(struct st_data_s *ll) { - struct kim_data_s *kim_data = ll->kim_data; - struct ti_st_plat_data *pdata = kim_data->kim_pdev->dev.platform_data; /* communicate to platform about chip enable */ - if (pdata->chip_enable) - pdata->chip_enable(); - +#ifdef CONFIG_WAKELOCK + wake_lock(&ll->st_wk_lock); +#endif ll->ll_state = ST_LL_AWAKE; } @@ -110,25 +101,22 @@ void st_ll_enable(struct st_data_s *ll) * disable ST LL */ void st_ll_disable(struct st_data_s *ll) { - struct kim_data_s *kim_data = ll->kim_data; - struct ti_st_plat_data *pdata = kim_data->kim_pdev->dev.platform_data; /* communicate to platform about chip disable */ - if (pdata->chip_disable) - pdata->chip_disable(); - +#ifdef CONFIG_WAKELOCK + wake_unlock(&ll->st_wk_lock); +#endif ll->ll_state = ST_LL_INVALID; } /* called when ST Core wants to update the state */ void st_ll_wakeup(struct st_data_s *ll) { - struct kim_data_s *kim_data = ll->kim_data; - struct ti_st_plat_data *pdata = kim_data->kim_pdev->dev.platform_data; if (likely(ll->ll_state != ST_LL_AWAKE)) { /* communicate to platform about chip wakeup */ - if (pdata->chip_awake) - pdata->chip_awake(); +#ifdef CONFIG_WAKELOCK + wake_lock(&ll->st_wk_lock); +#endif send_ll_cmd(ll, LL_WAKE_UP_IND); /* WAKE_IND */ ll->ll_state = ST_LL_ASLEEP_TO_AWAKE; } else { -- cgit v1.2.3