From 04245e9fde5708ae5d44cece1e3d7b64f3f62513 Mon Sep 17 00:00:00 2001 From: Jingoo Han Date: Mon, 5 Aug 2013 09:04:23 -0700 Subject: Input: cy8ctmg110_ts - add CONFIG_PM_SLEEP to suspend/resume Add CONFIG_PM_SLEEP to suspend/resume functions to fix the build warnings when CONFIG_PM_SLEEP is not selected. This is because sleep PM callbacks defined by SET_SYSTEM_SLEEP_PM_OPS are only used when the CONFIG_PM_SLEEP is enabled. drivers/input/touchscreen/cy8ctmg110_ts.c:295:12: warning: 'cy8ctmg110_suspend' defined but not used [-Wunused-function] drivers/input/touchscreen/cy8ctmg110_ts.c:309:12: warning: 'cy8ctmg110_resume' defined but not used [-Wunused-function] Signed-off-by: Jingoo Han Signed-off-by: Dmitry Torokhov --- drivers/input/touchscreen/cy8ctmg110_ts.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'drivers/input/touchscreen') diff --git a/drivers/input/touchscreen/cy8ctmg110_ts.c b/drivers/input/touchscreen/cy8ctmg110_ts.c index 96e0eedcc7e5..8c651985a5c4 100644 --- a/drivers/input/touchscreen/cy8ctmg110_ts.c +++ b/drivers/input/touchscreen/cy8ctmg110_ts.c @@ -291,7 +291,7 @@ err_free_mem: return err; } -#ifdef CONFIG_PM +#ifdef CONFIG_PM_SLEEP static int cy8ctmg110_suspend(struct device *dev) { struct i2c_client *client = to_i2c_client(dev); @@ -319,9 +319,9 @@ static int cy8ctmg110_resume(struct device *dev) } return 0; } +#endif static SIMPLE_DEV_PM_OPS(cy8ctmg110_pm, cy8ctmg110_suspend, cy8ctmg110_resume); -#endif static int cy8ctmg110_remove(struct i2c_client *client) { @@ -351,9 +351,7 @@ static struct i2c_driver cy8ctmg110_driver = { .driver = { .owner = THIS_MODULE, .name = CY8CTMG110_DRIVER_NAME, -#ifdef CONFIG_PM .pm = &cy8ctmg110_pm, -#endif }, .id_table = cy8ctmg110_idtable, .probe = cy8ctmg110_probe, -- cgit v1.2.3 From 54e9f4501079c837bbcc535c8de5a2e2fcbf6782 Mon Sep 17 00:00:00 2001 From: Jingoo Han Date: Mon, 5 Aug 2013 09:06:00 -0700 Subject: Input: eeti_ts - add CONFIG_PM_SLEEP to suspend/resume Add CONFIG_PM_SLEEP to suspend/resume functions to fix the build warnings when CONFIG_PM_SLEEP is not selected. This is because sleep PM callbacks defined by SET_SYSTEM_SLEEP_PM_OPS are only used when the CONFIG_PM_SLEEP is enabled. drivers/input/touchscreen/eeti_ts.c:268:12: warning: 'eeti_ts_suspend' defined but not used [-Wunused-function] drivers/input/touchscreen/eeti_ts.c:287:12: warning: 'eeti_ts_resume' defined but not used [-Wunused-function] Signed-off-by: Jingoo Han Signed-off-by: Dmitry Torokhov --- drivers/input/touchscreen/eeti_ts.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'drivers/input/touchscreen') diff --git a/drivers/input/touchscreen/eeti_ts.c b/drivers/input/touchscreen/eeti_ts.c index 8fe5086c8d2e..1ce3d29ffca5 100644 --- a/drivers/input/touchscreen/eeti_ts.c +++ b/drivers/input/touchscreen/eeti_ts.c @@ -264,7 +264,7 @@ static int eeti_ts_remove(struct i2c_client *client) return 0; } -#ifdef CONFIG_PM +#ifdef CONFIG_PM_SLEEP static int eeti_ts_suspend(struct device *dev) { struct i2c_client *client = to_i2c_client(dev); @@ -302,9 +302,9 @@ static int eeti_ts_resume(struct device *dev) return 0; } +#endif static SIMPLE_DEV_PM_OPS(eeti_ts_pm, eeti_ts_suspend, eeti_ts_resume); -#endif static const struct i2c_device_id eeti_ts_id[] = { { "eeti_ts", 0 }, @@ -315,9 +315,7 @@ MODULE_DEVICE_TABLE(i2c, eeti_ts_id); static struct i2c_driver eeti_ts_driver = { .driver = { .name = "eeti_ts", -#ifdef CONFIG_PM .pm = &eeti_ts_pm, -#endif }, .probe = eeti_ts_probe, .remove = eeti_ts_remove, -- cgit v1.2.3 From f01868dcb13e7eb064910e8afe391c1846b9e73b Mon Sep 17 00:00:00 2001 From: Sachin Kamat Date: Wed, 14 Aug 2013 23:50:48 -0700 Subject: Input: htcpen - fix incorrect placement of __initdata __initdata should be placed between the variable name and equal sign for the variable to be placed in the intended section. Signed-off-by: Sachin Kamat Cc: Pau Oliva Fora Signed-off-by: Dmitry Torokhov --- drivers/input/touchscreen/htcpen.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/input/touchscreen') diff --git a/drivers/input/touchscreen/htcpen.c b/drivers/input/touchscreen/htcpen.c index 6c4fb8436957..66500852341b 100644 --- a/drivers/input/touchscreen/htcpen.c +++ b/drivers/input/touchscreen/htcpen.c @@ -221,7 +221,7 @@ static struct isa_driver htcpen_isa_driver = { } }; -static struct dmi_system_id __initdata htcshift_dmi_table[] = { +static struct dmi_system_id htcshift_dmi_table[] __initdata = { { .ident = "Shift", .matches = { -- cgit v1.2.3 From e87ca42464b9ec2946ed5a4a921f292834bb494f Mon Sep 17 00:00:00 2001 From: Wei Yongjun Date: Sun, 25 Aug 2013 23:24:35 -0700 Subject: Input: cyttsp4 - remove useless NULL test from cyttsp4_watchdog_timer() Remove useless NULL test from cyttsp4_watchdog_timer(). Signed-off-by: Wei Yongjun Acked-by: Ferruh Yigit Signed-off-by: Dmitry Torokhov --- drivers/input/touchscreen/cyttsp4_core.c | 3 --- 1 file changed, 3 deletions(-) (limited to 'drivers/input/touchscreen') diff --git a/drivers/input/touchscreen/cyttsp4_core.c b/drivers/input/touchscreen/cyttsp4_core.c index 963da052c15e..8238d9881bcb 100644 --- a/drivers/input/touchscreen/cyttsp4_core.c +++ b/drivers/input/touchscreen/cyttsp4_core.c @@ -1246,9 +1246,6 @@ static void cyttsp4_watchdog_timer(unsigned long handle) dev_vdbg(cd->dev, "%s: Watchdog timer triggered\n", __func__); - if (!cd) - return; - if (!work_pending(&cd->watchdog_work)) schedule_work(&cd->watchdog_work); -- cgit v1.2.3 From ca0abe3d89fd95b80654e3429d84e4aad567a395 Mon Sep 17 00:00:00 2001 From: Geert Uytterhoeven Date: Thu, 29 Aug 2013 08:40:42 -0700 Subject: Input: cyttsp4 - kill 'defined but not used' compiler warnings MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If both CONFIG_PM_SLEEP and CONFIG_PM_RUNTIME are unset: drivers/input/touchscreen/cyttsp4_core.c:1556: warning: ‘cyttsp4_core_sleep’ defined but not used drivers/input/touchscreen/cyttsp4_core.c:1634: warning: ‘cyttsp4_core_wake’ defined but not used Move cyttsp4_core_sleep(), cyttsp4_core_wake(), and cyttsp4_core_wake_() (which is called from cyttsp4_core_wake() only) inside the existing section protected by #if defined(CONFIG_PM_SLEEP) || defined(CONFIG_PM_RUNTIME) Signed-off-by: Geert Uytterhoeven Signed-off-by: Dmitry Torokhov --- drivers/input/touchscreen/cyttsp4_core.c | 200 +++++++++++++++---------------- 1 file changed, 100 insertions(+), 100 deletions(-) (limited to 'drivers/input/touchscreen') diff --git a/drivers/input/touchscreen/cyttsp4_core.c b/drivers/input/touchscreen/cyttsp4_core.c index 8238d9881bcb..580004049b9e 100644 --- a/drivers/input/touchscreen/cyttsp4_core.c +++ b/drivers/input/touchscreen/cyttsp4_core.c @@ -1554,106 +1554,6 @@ exit: return rc; } -static int cyttsp4_core_sleep(struct cyttsp4 *cd) -{ - int rc; - - rc = cyttsp4_request_exclusive(cd, cd->dev, - CY_CORE_SLEEP_REQUEST_EXCLUSIVE_TIMEOUT); - if (rc < 0) { - dev_err(cd->dev, "%s: fail get exclusive ex=%p own=%p\n", - __func__, cd->exclusive_dev, cd->dev); - return 0; - } - - rc = cyttsp4_core_sleep_(cd); - - if (cyttsp4_release_exclusive(cd, cd->dev) < 0) - dev_err(cd->dev, "%s: fail to release exclusive\n", __func__); - else - dev_vdbg(cd->dev, "%s: pass release exclusive\n", __func__); - - return rc; -} - -static int cyttsp4_core_wake_(struct cyttsp4 *cd) -{ - struct device *dev = cd->dev; - int rc; - u8 mode; - int t; - - /* Already woken? */ - mutex_lock(&cd->system_lock); - if (cd->sleep_state == SS_SLEEP_OFF) { - mutex_unlock(&cd->system_lock); - return 0; - } - cd->int_status &= ~CY_INT_IGNORE; - cd->int_status |= CY_INT_AWAKE; - cd->sleep_state = SS_WAKING; - - if (cd->cpdata->power) { - dev_dbg(dev, "%s: Power up HW\n", __func__); - rc = cd->cpdata->power(cd->cpdata, 1, dev, &cd->ignore_irq); - } else { - dev_dbg(dev, "%s: No power function\n", __func__); - rc = -ENOSYS; - } - if (rc < 0) { - dev_err(dev, "%s: HW Power up fails r=%d\n", - __func__, rc); - - /* Initiate a read transaction to wake up */ - cyttsp4_adap_read(cd, CY_REG_BASE, sizeof(mode), &mode); - } else - dev_vdbg(cd->dev, "%s: HW power up succeeds\n", - __func__); - mutex_unlock(&cd->system_lock); - - t = wait_event_timeout(cd->wait_q, - (cd->int_status & CY_INT_AWAKE) == 0, - msecs_to_jiffies(CY_CORE_WAKEUP_TIMEOUT)); - if (IS_TMO(t)) { - dev_err(dev, "%s: TMO waiting for wakeup\n", __func__); - mutex_lock(&cd->system_lock); - cd->int_status &= ~CY_INT_AWAKE; - /* Try starting up */ - cyttsp4_queue_startup_(cd); - mutex_unlock(&cd->system_lock); - } - - mutex_lock(&cd->system_lock); - cd->sleep_state = SS_SLEEP_OFF; - mutex_unlock(&cd->system_lock); - - cyttsp4_start_wd_timer(cd); - - return 0; -} - -static int cyttsp4_core_wake(struct cyttsp4 *cd) -{ - int rc; - - rc = cyttsp4_request_exclusive(cd, cd->dev, - CY_CORE_REQUEST_EXCLUSIVE_TIMEOUT); - if (rc < 0) { - dev_err(cd->dev, "%s: fail get exclusive ex=%p own=%p\n", - __func__, cd->exclusive_dev, cd->dev); - return 0; - } - - rc = cyttsp4_core_wake_(cd); - - if (cyttsp4_release_exclusive(cd, cd->dev) < 0) - dev_err(cd->dev, "%s: fail to release exclusive\n", __func__); - else - dev_vdbg(cd->dev, "%s: pass release exclusive\n", __func__); - - return rc; -} - static int cyttsp4_startup_(struct cyttsp4 *cd) { int retry = CY_CORE_STARTUP_RETRY_COUNT; @@ -1823,6 +1723,106 @@ static void cyttsp4_free_si_ptrs(struct cyttsp4 *cd) } #if defined(CONFIG_PM_SLEEP) || defined(CONFIG_PM_RUNTIME) +static int cyttsp4_core_sleep(struct cyttsp4 *cd) +{ + int rc; + + rc = cyttsp4_request_exclusive(cd, cd->dev, + CY_CORE_SLEEP_REQUEST_EXCLUSIVE_TIMEOUT); + if (rc < 0) { + dev_err(cd->dev, "%s: fail get exclusive ex=%p own=%p\n", + __func__, cd->exclusive_dev, cd->dev); + return 0; + } + + rc = cyttsp4_core_sleep_(cd); + + if (cyttsp4_release_exclusive(cd, cd->dev) < 0) + dev_err(cd->dev, "%s: fail to release exclusive\n", __func__); + else + dev_vdbg(cd->dev, "%s: pass release exclusive\n", __func__); + + return rc; +} + +static int cyttsp4_core_wake_(struct cyttsp4 *cd) +{ + struct device *dev = cd->dev; + int rc; + u8 mode; + int t; + + /* Already woken? */ + mutex_lock(&cd->system_lock); + if (cd->sleep_state == SS_SLEEP_OFF) { + mutex_unlock(&cd->system_lock); + return 0; + } + cd->int_status &= ~CY_INT_IGNORE; + cd->int_status |= CY_INT_AWAKE; + cd->sleep_state = SS_WAKING; + + if (cd->cpdata->power) { + dev_dbg(dev, "%s: Power up HW\n", __func__); + rc = cd->cpdata->power(cd->cpdata, 1, dev, &cd->ignore_irq); + } else { + dev_dbg(dev, "%s: No power function\n", __func__); + rc = -ENOSYS; + } + if (rc < 0) { + dev_err(dev, "%s: HW Power up fails r=%d\n", + __func__, rc); + + /* Initiate a read transaction to wake up */ + cyttsp4_adap_read(cd, CY_REG_BASE, sizeof(mode), &mode); + } else + dev_vdbg(cd->dev, "%s: HW power up succeeds\n", + __func__); + mutex_unlock(&cd->system_lock); + + t = wait_event_timeout(cd->wait_q, + (cd->int_status & CY_INT_AWAKE) == 0, + msecs_to_jiffies(CY_CORE_WAKEUP_TIMEOUT)); + if (IS_TMO(t)) { + dev_err(dev, "%s: TMO waiting for wakeup\n", __func__); + mutex_lock(&cd->system_lock); + cd->int_status &= ~CY_INT_AWAKE; + /* Try starting up */ + cyttsp4_queue_startup_(cd); + mutex_unlock(&cd->system_lock); + } + + mutex_lock(&cd->system_lock); + cd->sleep_state = SS_SLEEP_OFF; + mutex_unlock(&cd->system_lock); + + cyttsp4_start_wd_timer(cd); + + return 0; +} + +static int cyttsp4_core_wake(struct cyttsp4 *cd) +{ + int rc; + + rc = cyttsp4_request_exclusive(cd, cd->dev, + CY_CORE_REQUEST_EXCLUSIVE_TIMEOUT); + if (rc < 0) { + dev_err(cd->dev, "%s: fail get exclusive ex=%p own=%p\n", + __func__, cd->exclusive_dev, cd->dev); + return 0; + } + + rc = cyttsp4_core_wake_(cd); + + if (cyttsp4_release_exclusive(cd, cd->dev) < 0) + dev_err(cd->dev, "%s: fail to release exclusive\n", __func__); + else + dev_vdbg(cd->dev, "%s: pass release exclusive\n", __func__); + + return rc; +} + static int cyttsp4_core_suspend(struct device *dev) { struct cyttsp4 *cd = dev_get_drvdata(dev); -- cgit v1.2.3 From d33c4aa32d426a7c00d33b5b1212720d5bc3fa44 Mon Sep 17 00:00:00 2001 From: Fabio Estevam Date: Thu, 29 Aug 2013 09:13:35 -0700 Subject: Input: max11801_ts - convert to devm Converting to devm functions can make the code smaller and cleaner. Signed-off-by: Fabio Estevam Signed-off-by: Dmitry Torokhov --- drivers/input/touchscreen/max11801_ts.c | 37 ++++++++------------------------- 1 file changed, 9 insertions(+), 28 deletions(-) (limited to 'drivers/input/touchscreen') diff --git a/drivers/input/touchscreen/max11801_ts.c b/drivers/input/touchscreen/max11801_ts.c index 00bc6caa27f5..9f84fcd08732 100644 --- a/drivers/input/touchscreen/max11801_ts.c +++ b/drivers/input/touchscreen/max11801_ts.c @@ -181,12 +181,11 @@ static int max11801_ts_probe(struct i2c_client *client, struct input_dev *input_dev; int error; - data = kzalloc(sizeof(struct max11801_data), GFP_KERNEL); - input_dev = input_allocate_device(); + data = devm_kzalloc(&client->dev, sizeof(*data), GFP_KERNEL); + input_dev = devm_input_allocate_device(&client->dev); if (!data || !input_dev) { dev_err(&client->dev, "Failed to allocate memory\n"); - error = -ENOMEM; - goto err_free_mem; + return -ENOMEM; } data->client = client; @@ -205,38 +204,21 @@ static int max11801_ts_probe(struct i2c_client *client, max11801_ts_phy_init(data); - error = request_threaded_irq(client->irq, NULL, max11801_ts_interrupt, - IRQF_TRIGGER_LOW | IRQF_ONESHOT, - "max11801_ts", data); + error = devm_request_threaded_irq(&client->dev, client->irq, NULL, + max11801_ts_interrupt, + IRQF_TRIGGER_LOW | IRQF_ONESHOT, + "max11801_ts", data); if (error) { dev_err(&client->dev, "Failed to register interrupt\n"); - goto err_free_mem; + return error; } error = input_register_device(data->input_dev); if (error) - goto err_free_irq; + return error; i2c_set_clientdata(client, data); return 0; - -err_free_irq: - free_irq(client->irq, data); -err_free_mem: - input_free_device(input_dev); - kfree(data); - return error; -} - -static int max11801_ts_remove(struct i2c_client *client) -{ - struct max11801_data *data = i2c_get_clientdata(client); - - free_irq(client->irq, data); - input_unregister_device(data->input_dev); - kfree(data); - - return 0; } static const struct i2c_device_id max11801_ts_id[] = { @@ -252,7 +234,6 @@ static struct i2c_driver max11801_ts_driver = { }, .id_table = max11801_ts_id, .probe = max11801_ts_probe, - .remove = max11801_ts_remove, }; module_i2c_driver(max11801_ts_driver); -- cgit v1.2.3