Loading drivers/input/misc/akm8963.c +30 −10 Original line number Diff line number Diff line /* drivers/input/misc/akm8963.c - akm8963 compass driver * * Copyright (c) 2015, The Linux Foundation. All rights reserved. * * Copyright (C) 2007-2008 HTC Corporation. * Author: Hou-Kun Chen <houkun.chen@gmail.com> Loading Loading @@ -66,6 +68,7 @@ struct akm_compass_data { struct pinctrl_state *pin_default; struct pinctrl_state *pin_sleep; struct sensors_classdev cdev; struct workqueue_struct *data_wq; struct delayed_work dwork; struct mutex op_mutex; Loading Loading @@ -872,9 +875,10 @@ static int akm_enable_set(struct sensors_classdev *sensors_cdev, if (enable) { AKECS_SetMode(akm, AKM_MODE_SNG_MEASURE | AKM8963_BIT_OP_16); schedule_delayed_work(&akm->dwork, msecs_to_jiffies( akm->delay[MAG_DATA_FLAG])); queue_delayed_work(akm->data_wq, &akm->dwork, msecs_to_jiffies (akm->delay[MAG_DATA_FLAG])); } else { cancel_delayed_work_sync(&akm->dwork); AKECS_SetMode(akm, AKM_MODE_POWERDOWN); Loading Loading @@ -1486,7 +1490,8 @@ static int akm_compass_resume(struct device *dev) if (AKM_IS_MAG_DATA_ENABLED() && akm->use_poll && akm->pdata->auto_report) schedule_delayed_work(&akm->dwork, queue_delayed_work(akm->data_wq, &akm->dwork, (unsigned long)nsecs_to_jiffies64( akm->delay[MAG_DATA_FLAG])); } Loading Loading @@ -1826,7 +1831,8 @@ exit: dev_warn(&akm->i2c->dev, "Failed to set mode\n"); if (akm->use_poll) schedule_delayed_work(&akm->dwork, queue_delayed_work(akm->data_wq, &akm->dwork, msecs_to_jiffies(akm->delay[MAG_DATA_FLAG])); } Loading Loading @@ -1949,10 +1955,11 @@ int akm8963_compass_probe( err = pinctrl_select_state(s_akm->pinctrl, s_akm->pin_default); if (err) { dev_err(&i2c->dev, "Can't select pinctrl state\n"); goto err_compass_pwr_off; goto err_unregister_device; } } s_akm->data_wq = NULL; if ((s_akm->pdata->use_int) && gpio_is_valid(s_akm->pdata->gpio_int)) { s_akm->use_poll = false; Loading Loading @@ -1998,6 +2005,12 @@ int akm8963_compass_probe( } } else if (s_akm->pdata->auto_report) { s_akm->use_poll = true; s_akm->data_wq = create_freezable_workqueue("akm8963_data_work"); if (!s_akm->data_wq) { dev_err(&i2c->dev, "Cannot create workqueue!\n"); goto err_unregister_device; } INIT_DELAYED_WORK(&s_akm->dwork, akm_dev_poll); } Loading @@ -2006,7 +2019,7 @@ int akm8963_compass_probe( if (0 > err) { dev_err(&i2c->dev, "%s: create sysfs failed.", __func__); goto err_free_irq; goto err_destroy_workqueue; } s_akm->cdev = sensors_cdev; Loading @@ -2031,15 +2044,17 @@ int akm8963_compass_probe( remove_sysfs: remove_sysfs_interfaces(s_akm); err_free_irq: err_destroy_workqueue: if (s_akm->data_wq) destroy_workqueue(s_akm->data_wq); if (s_akm->i2c->irq) free_irq(s_akm->i2c->irq, s_akm); err_unregister_device: input_unregister_device(s_akm->input); err_gpio_free: if ((s_akm->pdata->use_int) && (gpio_is_valid(s_akm->pdata->gpio_int))) gpio_free(s_akm->pdata->gpio_int); err_unregister_device: input_unregister_device(s_akm->input); err_compass_pwr_off: akm_compass_power_set(s_akm, false); err_compass_pwr_init: Loading @@ -2059,8 +2074,13 @@ static int akm8963_compass_remove(struct i2c_client *i2c) if (akm_compass_power_init(akm, false)) dev_err(&i2c->dev, "power deinit failed.\n"); remove_sysfs_interfaces(akm); if (akm->data_wq) destroy_workqueue(s_akm->data_wq); if (akm->i2c->irq) free_irq(akm->i2c->irq, akm); if ((s_akm->pdata->use_int) && (gpio_is_valid(s_akm->pdata->gpio_int))) gpio_free(s_akm->pdata->gpio_int); input_unregister_device(akm->input); devm_kfree(&i2c->dev, akm); dev_info(&i2c->dev, "successfully removed."); Loading drivers/input/misc/bma2x2.c +17 −5 Original line number Diff line number Diff line Loading @@ -1472,6 +1472,7 @@ struct bma2x2_data { struct mutex value_mutex; struct mutex enable_mutex; struct mutex mode_mutex; struct workqueue_struct *data_wq; struct delayed_work work; struct work_struct irq_work; struct regulator *vdd; Loading Loading @@ -4909,7 +4910,7 @@ static void bma2x2_work_func(struct work_struct *work) mutex_lock(&bma2x2->value_mutex); bma2x2->value = acc; mutex_unlock(&bma2x2->value_mutex); schedule_delayed_work(&bma2x2->work, delay); queue_delayed_work(bma2x2->data_wq, &bma2x2->work, delay); } #endif Loading Loading @@ -5165,7 +5166,8 @@ static void bma2x2_set_enable(struct device *dev, int enable) bma2x2_set_mode(bma2x2->bma2x2_client, BMA2X2_MODE_NORMAL); #ifndef CONFIG_BMA_ENABLE_NEWDATA_INT schedule_delayed_work(&bma2x2->work, queue_delayed_work(bma2x2->data_wq, &bma2x2->work, msecs_to_jiffies(atomic_read(&bma2x2->delay))); #endif atomic_set(&bma2x2->enable, 1); Loading Loading @@ -7249,6 +7251,12 @@ static int bma2x2_probe(struct i2c_client *client, #ifndef CONFIG_BMA_ENABLE_NEWDATA_INT INIT_DELAYED_WORK(&data->work, bma2x2_work_func); #endif data->data_wq = create_freezable_workqueue("bma2x2_data_work"); if (!data->data_wq) { dev_err(&client->dev, "Cannot get create workqueue!\n"); goto free_irq_exit; } atomic_set(&data->delay, POLL_DEFAULT_INTERVAL_MS); atomic_set(&data->enable, 0); Loading @@ -7257,7 +7265,7 @@ static int bma2x2_probe(struct i2c_client *client, dev_err(&client->dev, "Cannot allocate input device\n"); err = -ENOMEM; goto free_irq_exit; goto destroy_workqueue_exit; } dev_interrupt = devm_input_allocate_device(&client->dev); Loading @@ -7265,7 +7273,7 @@ static int bma2x2_probe(struct i2c_client *client, dev_err(&client->dev, "Cannot allocate input interrupt device\n"); err = -ENOMEM; goto free_irq_exit; goto destroy_workqueue_exit; } /* only value events reported */ Loading Loading @@ -7486,6 +7494,8 @@ destroy_g_sensor_class_exit: class_destroy(data->g_sensor_class); #endif destroy_workqueue_exit: destroy_workqueue(data->data_wq); free_irq_exit: disable_power_exit: bma2x2_power_ctl(data, false); Loading Loading @@ -7528,7 +7538,8 @@ static void bma2x2_late_resume(struct early_suspend *h) if (atomic_read(&data->enable) == 1) { bma2x2_set_mode(data->bma2x2_client, BMA2X2_MODE_NORMAL); #ifndef CONFIG_BMA_ENABLE_NEWDATA_INT schedule_delayed_work(&data->work, queue_delayed_work(data->data_wq, &data->work, msecs_to_jiffies(atomic_read(&data->delay))); #endif } Loading Loading @@ -7558,6 +7569,7 @@ static int bma2x2_remove(struct i2c_client *client) sysfs_remove_group(&data->input->dev.kobj, &bma2x2_attribute_group); destroy_workqueue(data->data_wq); bma2x2_set_enable(&client->dev, 0); bma2x2_power_deinit(data); i2c_set_clientdata(client, NULL); Loading drivers/input/misc/lis3dh_acc.c +21 −7 Original line number Diff line number Diff line /******************** (C) COPYRIGHT 2010 STMicroelectronics ******************** * * Copyright (c) 2014, The Linux Foundation. All rights reserved. * Copyright (c) 2014-2015, The Linux Foundation. All rights reserved. * * File Name : lis3dh_acc.c * Authors : MSH - Motion Mems BU - Application Team Loading Loading @@ -263,6 +263,7 @@ struct lis3dh_acc_data { struct pinctrl_state *pin_sleep; struct mutex lock; struct workqueue_struct *data_wq; struct delayed_work input_work; struct input_dev *input_dev; Loading Loading @@ -1135,7 +1136,7 @@ static int lis3dh_acc_enable(struct lis3dh_acc_data *acc) return err; } if (!acc->pdata->enable_int && !acc->use_batch) { schedule_delayed_work(&acc->input_work, queue_delayed_work(acc->data_wq, &acc->input_work, msecs_to_jiffies(acc->delay_ms)); return 0; } Loading Loading @@ -1768,8 +1769,8 @@ static void lis3dh_acc_input_work_func(struct work_struct *work) else lis3dh_acc_report_values(acc, xyz); schedule_delayed_work(&acc->input_work, msecs_to_jiffies( acc->delay_ms)); queue_delayed_work(acc->data_wq, &acc->input_work, msecs_to_jiffies(acc->delay_ms)); mutex_unlock(&acc->lock); } Loading Loading @@ -1825,8 +1826,6 @@ static int lis3dh_acc_input_init(struct lis3dh_acc_data *acc) { int err; if (!acc->pdata->enable_int) INIT_DELAYED_WORK(&acc->input_work, lis3dh_acc_input_work_func); acc->input_dev = devm_input_allocate_device(&acc->client->dev); if (!acc->input_dev) { err = -ENOMEM; Loading Loading @@ -2150,12 +2149,22 @@ static int lis3dh_acc_probe(struct i2c_client *client, goto err_power_off; } acc->data_wq = NULL; if (!acc->pdata->enable_int) { acc->data_wq = create_freezable_workqueue("lis3dh_data_work"); if (!acc->data_wq) { dev_err(&client->dev, "create workquque failed\n"); goto err_power_off; } INIT_DELAYED_WORK(&acc->input_work, lis3dh_acc_input_work_func); } err = create_sysfs_interfaces(&client->dev); if (err < 0) { dev_err(&client->dev, "device LIS3DH_ACC_DEV_NAME sysfs register failed\n"); goto err_power_off; goto err_destroy_workqueue; } acc->cdev = lis3dh_acc_cdev; Loading Loading @@ -2226,6 +2235,9 @@ err_unreg_sensor_class: sensors_classdev_unregister(&acc->cdev); err_remove_sysfs_int: remove_sysfs_interfaces(&client->dev); err_destroy_workqueue: if (acc->data_wq) destroy_workqueue(acc->data_wq); err_power_off: lis3dh_acc_device_power_off(acc); err_regulator_init: Loading Loading @@ -2257,6 +2269,8 @@ static int lis3dh_acc_remove(struct i2c_client *client) sensors_classdev_unregister(&acc->cdev); lis3dh_acc_config_regulator(acc, false); remove_sysfs_interfaces(&client->dev); if (acc->data_wq) destroy_workqueue(acc->data_wq); if (acc->pdata->exit) acc->pdata->exit(); Loading drivers/input/misc/mma8x5x.c +20 −5 Original line number Diff line number Diff line Loading @@ -2,7 +2,7 @@ * mma8x5x.c - Linux kernel modules for 3-Axis Orientation/Motion * Detection Sensor MMA8451/MMA8452/MMA8453 * * Copyright (c) 2013-2014, The Linux Foundation. All Rights Reserved. * Copyright (c) 2013-2015, The Linux Foundation. All Rights Reserved. * Linux Foundation chooses to take subject only to the GPLv2 license * terms, and distributes only under these terms. * Copyright (C) 2010-2011 Freescale Semiconductor, Inc. All Rights Reserved. Loading Loading @@ -189,6 +189,7 @@ struct mma8x5x_data_axis { }; struct mma8x5x_data { struct i2c_client *client; struct workqueue_struct *data_wq; struct delayed_work dwork; struct input_dev *idev; struct mutex data_lock; Loading Loading @@ -512,7 +513,8 @@ static void mma8x5x_dev_poll(struct work_struct *work) if ((pdata->active & MMA_STATE_MASK) == MMA_ACTIVED) { mma8x5x_report_data(pdata); schedule_delayed_work(&pdata->dwork, queue_delayed_work(pdata->data_wq, &pdata->dwork, msecs_to_jiffies(pdata->poll_delay)); } } Loading Loading @@ -580,7 +582,8 @@ static int mma8x5x_enable_set(struct sensors_classdev *sensors_cdev, goto err_failed; } if (!pdata->use_int) schedule_delayed_work(&pdata->dwork, queue_delayed_work(pdata->data_wq, &pdata->dwork, msecs_to_jiffies(pdata->poll_delay)); pdata->active = MMA_ACTIVED; Loading Loading @@ -883,6 +886,7 @@ static int mma8x5x_probe(struct i2c_client *client, i2c_set_clientdata(client, pdata); /* Initialize the MMA8X5X chip */ mma8x5x_device_init(client); pdata->data_wq = NULL; if (pdata->use_int) { if (pdata->int_pin >= 0) client->irq = gpio_to_irq(pdata->int_pin); Loading Loading @@ -916,6 +920,11 @@ static int mma8x5x_probe(struct i2c_client *client, mma8x5x_device_int_init(client); } else { INIT_DELAYED_WORK(&pdata->dwork, mma8x5x_dev_poll); pdata->data_wq = create_freezable_workqueue("mma_data_work"); if (!pdata->data_wq) { dev_err(&client->dev, "Create workqueue failed!\n"); goto err_alloc_work_queue; } } idev = devm_input_allocate_device(&client->dev); if (!idev) { Loading Loading @@ -963,9 +972,12 @@ static int mma8x5x_probe(struct i2c_client *client, err_create_class_sysfs: sysfs_remove_group(&idev->dev.kobj, &mma8x5x_attr_group); err_alloc_poll_device: if (pdata->data_wq) destroy_workqueue(pdata->data_wq); err_register_irq: if (pdata->use_int) device_init_wakeup(&client->dev, false); err_alloc_work_queue: err_set_gpio_direction: if (gpio_is_valid(pdata->int_pin) && pdata->use_int) gpio_free(pdata->int_pin); Loading @@ -986,6 +998,8 @@ static int mma8x5x_remove(struct i2c_client *client) if (pdata) { idev = pdata->idev; sysfs_remove_group(&idev->dev.kobj, &mma8x5x_attr_group); if (pdata->data_wq) destroy_workqueue(pdata->data_wq); if (pdata->use_int) { device_init_wakeup(&client->dev, false); if (gpio_is_valid(pdata->int_pin)) Loading Loading @@ -1039,7 +1053,8 @@ static int mma8x5x_resume(struct device *dev) if (pdata->active == MMA_ACTIVED) { val = i2c_smbus_read_byte_data(client, MMA8X5X_CTRL_REG1); i2c_smbus_write_byte_data(client, MMA8X5X_CTRL_REG1, val|0x01); schedule_delayed_work(&pdata->dwork, queue_delayed_work(pdata->data_wq, &pdata->dwork, msecs_to_jiffies(pdata->poll_delay)); } Loading drivers/input/misc/mmc3416x.c +21 −5 Original line number Diff line number Diff line /* * Copyright (c) 2014, Linux Foundation. All rights reserved. * Copyright (c) 2014-2015, Linux Foundation. All rights reserved. * Linux Foundation chooses to take subject only to the GPLv2 license * terms, and distributes only under these terms. * Copyright (C) 2010 MEMSIC, Inc. Loading Loading @@ -102,6 +102,7 @@ struct mmc3416x_vec { struct mmc3416x_data { struct mutex ecompass_lock; struct mutex ops_lock; struct workqueue_struct *data_wq; struct delayed_work dwork; struct sensors_classdev cdev; struct mmc3416x_vec last; Loading Loading @@ -276,7 +277,8 @@ static void mmc3416x_poll(struct work_struct *work) input_sync(memsic->idev); exit: schedule_delayed_work(&memsic->dwork, queue_delayed_work(memsic->data_wq, &memsic->dwork, msecs_to_jiffies(memsic->poll_interval)); } Loading Loading @@ -554,7 +556,8 @@ static int mmc3416x_set_enable(struct sensors_classdev *sensors_cdev, memsic->timeout = jiffies; if (memsic->auto_report) schedule_delayed_work(&memsic->dwork, queue_delayed_work(memsic->data_wq, &memsic->dwork, msecs_to_jiffies(memsic->poll_interval)); } else if ((!enable) && memsic->enable) { if (memsic->auto_report) Loading Loading @@ -663,9 +666,16 @@ static int mmc3416x_probe(struct i2c_client *client, const struct i2c_device_id goto out_init_input; } memsic->data_wq = NULL; if (memsic->auto_report) { dev_info(&client->dev, "auto report is enabled\n"); dev_dbg(&client->dev, "auto report is enabled\n"); INIT_DELAYED_WORK(&memsic->dwork, mmc3416x_poll); memsic->data_wq = create_freezable_workqueue("mmc3416_data_work"); if (!memsic->data_wq) { dev_err(&client->dev, "Cannot create workqueue.\n"); goto out_create_workqueue; } } memsic->cdev = sensors_cdev; Loading @@ -692,6 +702,9 @@ static int mmc3416x_probe(struct i2c_client *client, const struct i2c_device_id out_power_set: sensors_classdev_unregister(&memsic->cdev); out_register_classdev: if (memsic->data_wq) destroy_workqueue(memsic->data_wq); out_create_workqueue: input_unregister_device(memsic->idev); out_init_input: out_check_device: Loading @@ -705,6 +718,8 @@ static int mmc3416x_remove(struct i2c_client *client) struct mmc3416x_data *memsic = dev_get_drvdata(&client->dev); sensors_classdev_unregister(&memsic->cdev); if (memsic->data_wq) destroy_workqueue(memsic->data_wq); mmc3416x_power_deinit(memsic); if (memsic->idev) Loading Loading @@ -751,7 +766,8 @@ static int mmc3416x_resume(struct device *dev) } if (memsic->auto_report) schedule_delayed_work(&memsic->dwork, queue_delayed_work(memsic->data_wq, &memsic->dwork, msecs_to_jiffies(memsic->poll_interval)); } Loading Loading
drivers/input/misc/akm8963.c +30 −10 Original line number Diff line number Diff line /* drivers/input/misc/akm8963.c - akm8963 compass driver * * Copyright (c) 2015, The Linux Foundation. All rights reserved. * * Copyright (C) 2007-2008 HTC Corporation. * Author: Hou-Kun Chen <houkun.chen@gmail.com> Loading Loading @@ -66,6 +68,7 @@ struct akm_compass_data { struct pinctrl_state *pin_default; struct pinctrl_state *pin_sleep; struct sensors_classdev cdev; struct workqueue_struct *data_wq; struct delayed_work dwork; struct mutex op_mutex; Loading Loading @@ -872,9 +875,10 @@ static int akm_enable_set(struct sensors_classdev *sensors_cdev, if (enable) { AKECS_SetMode(akm, AKM_MODE_SNG_MEASURE | AKM8963_BIT_OP_16); schedule_delayed_work(&akm->dwork, msecs_to_jiffies( akm->delay[MAG_DATA_FLAG])); queue_delayed_work(akm->data_wq, &akm->dwork, msecs_to_jiffies (akm->delay[MAG_DATA_FLAG])); } else { cancel_delayed_work_sync(&akm->dwork); AKECS_SetMode(akm, AKM_MODE_POWERDOWN); Loading Loading @@ -1486,7 +1490,8 @@ static int akm_compass_resume(struct device *dev) if (AKM_IS_MAG_DATA_ENABLED() && akm->use_poll && akm->pdata->auto_report) schedule_delayed_work(&akm->dwork, queue_delayed_work(akm->data_wq, &akm->dwork, (unsigned long)nsecs_to_jiffies64( akm->delay[MAG_DATA_FLAG])); } Loading Loading @@ -1826,7 +1831,8 @@ exit: dev_warn(&akm->i2c->dev, "Failed to set mode\n"); if (akm->use_poll) schedule_delayed_work(&akm->dwork, queue_delayed_work(akm->data_wq, &akm->dwork, msecs_to_jiffies(akm->delay[MAG_DATA_FLAG])); } Loading Loading @@ -1949,10 +1955,11 @@ int akm8963_compass_probe( err = pinctrl_select_state(s_akm->pinctrl, s_akm->pin_default); if (err) { dev_err(&i2c->dev, "Can't select pinctrl state\n"); goto err_compass_pwr_off; goto err_unregister_device; } } s_akm->data_wq = NULL; if ((s_akm->pdata->use_int) && gpio_is_valid(s_akm->pdata->gpio_int)) { s_akm->use_poll = false; Loading Loading @@ -1998,6 +2005,12 @@ int akm8963_compass_probe( } } else if (s_akm->pdata->auto_report) { s_akm->use_poll = true; s_akm->data_wq = create_freezable_workqueue("akm8963_data_work"); if (!s_akm->data_wq) { dev_err(&i2c->dev, "Cannot create workqueue!\n"); goto err_unregister_device; } INIT_DELAYED_WORK(&s_akm->dwork, akm_dev_poll); } Loading @@ -2006,7 +2019,7 @@ int akm8963_compass_probe( if (0 > err) { dev_err(&i2c->dev, "%s: create sysfs failed.", __func__); goto err_free_irq; goto err_destroy_workqueue; } s_akm->cdev = sensors_cdev; Loading @@ -2031,15 +2044,17 @@ int akm8963_compass_probe( remove_sysfs: remove_sysfs_interfaces(s_akm); err_free_irq: err_destroy_workqueue: if (s_akm->data_wq) destroy_workqueue(s_akm->data_wq); if (s_akm->i2c->irq) free_irq(s_akm->i2c->irq, s_akm); err_unregister_device: input_unregister_device(s_akm->input); err_gpio_free: if ((s_akm->pdata->use_int) && (gpio_is_valid(s_akm->pdata->gpio_int))) gpio_free(s_akm->pdata->gpio_int); err_unregister_device: input_unregister_device(s_akm->input); err_compass_pwr_off: akm_compass_power_set(s_akm, false); err_compass_pwr_init: Loading @@ -2059,8 +2074,13 @@ static int akm8963_compass_remove(struct i2c_client *i2c) if (akm_compass_power_init(akm, false)) dev_err(&i2c->dev, "power deinit failed.\n"); remove_sysfs_interfaces(akm); if (akm->data_wq) destroy_workqueue(s_akm->data_wq); if (akm->i2c->irq) free_irq(akm->i2c->irq, akm); if ((s_akm->pdata->use_int) && (gpio_is_valid(s_akm->pdata->gpio_int))) gpio_free(s_akm->pdata->gpio_int); input_unregister_device(akm->input); devm_kfree(&i2c->dev, akm); dev_info(&i2c->dev, "successfully removed."); Loading
drivers/input/misc/bma2x2.c +17 −5 Original line number Diff line number Diff line Loading @@ -1472,6 +1472,7 @@ struct bma2x2_data { struct mutex value_mutex; struct mutex enable_mutex; struct mutex mode_mutex; struct workqueue_struct *data_wq; struct delayed_work work; struct work_struct irq_work; struct regulator *vdd; Loading Loading @@ -4909,7 +4910,7 @@ static void bma2x2_work_func(struct work_struct *work) mutex_lock(&bma2x2->value_mutex); bma2x2->value = acc; mutex_unlock(&bma2x2->value_mutex); schedule_delayed_work(&bma2x2->work, delay); queue_delayed_work(bma2x2->data_wq, &bma2x2->work, delay); } #endif Loading Loading @@ -5165,7 +5166,8 @@ static void bma2x2_set_enable(struct device *dev, int enable) bma2x2_set_mode(bma2x2->bma2x2_client, BMA2X2_MODE_NORMAL); #ifndef CONFIG_BMA_ENABLE_NEWDATA_INT schedule_delayed_work(&bma2x2->work, queue_delayed_work(bma2x2->data_wq, &bma2x2->work, msecs_to_jiffies(atomic_read(&bma2x2->delay))); #endif atomic_set(&bma2x2->enable, 1); Loading Loading @@ -7249,6 +7251,12 @@ static int bma2x2_probe(struct i2c_client *client, #ifndef CONFIG_BMA_ENABLE_NEWDATA_INT INIT_DELAYED_WORK(&data->work, bma2x2_work_func); #endif data->data_wq = create_freezable_workqueue("bma2x2_data_work"); if (!data->data_wq) { dev_err(&client->dev, "Cannot get create workqueue!\n"); goto free_irq_exit; } atomic_set(&data->delay, POLL_DEFAULT_INTERVAL_MS); atomic_set(&data->enable, 0); Loading @@ -7257,7 +7265,7 @@ static int bma2x2_probe(struct i2c_client *client, dev_err(&client->dev, "Cannot allocate input device\n"); err = -ENOMEM; goto free_irq_exit; goto destroy_workqueue_exit; } dev_interrupt = devm_input_allocate_device(&client->dev); Loading @@ -7265,7 +7273,7 @@ static int bma2x2_probe(struct i2c_client *client, dev_err(&client->dev, "Cannot allocate input interrupt device\n"); err = -ENOMEM; goto free_irq_exit; goto destroy_workqueue_exit; } /* only value events reported */ Loading Loading @@ -7486,6 +7494,8 @@ destroy_g_sensor_class_exit: class_destroy(data->g_sensor_class); #endif destroy_workqueue_exit: destroy_workqueue(data->data_wq); free_irq_exit: disable_power_exit: bma2x2_power_ctl(data, false); Loading Loading @@ -7528,7 +7538,8 @@ static void bma2x2_late_resume(struct early_suspend *h) if (atomic_read(&data->enable) == 1) { bma2x2_set_mode(data->bma2x2_client, BMA2X2_MODE_NORMAL); #ifndef CONFIG_BMA_ENABLE_NEWDATA_INT schedule_delayed_work(&data->work, queue_delayed_work(data->data_wq, &data->work, msecs_to_jiffies(atomic_read(&data->delay))); #endif } Loading Loading @@ -7558,6 +7569,7 @@ static int bma2x2_remove(struct i2c_client *client) sysfs_remove_group(&data->input->dev.kobj, &bma2x2_attribute_group); destroy_workqueue(data->data_wq); bma2x2_set_enable(&client->dev, 0); bma2x2_power_deinit(data); i2c_set_clientdata(client, NULL); Loading
drivers/input/misc/lis3dh_acc.c +21 −7 Original line number Diff line number Diff line /******************** (C) COPYRIGHT 2010 STMicroelectronics ******************** * * Copyright (c) 2014, The Linux Foundation. All rights reserved. * Copyright (c) 2014-2015, The Linux Foundation. All rights reserved. * * File Name : lis3dh_acc.c * Authors : MSH - Motion Mems BU - Application Team Loading Loading @@ -263,6 +263,7 @@ struct lis3dh_acc_data { struct pinctrl_state *pin_sleep; struct mutex lock; struct workqueue_struct *data_wq; struct delayed_work input_work; struct input_dev *input_dev; Loading Loading @@ -1135,7 +1136,7 @@ static int lis3dh_acc_enable(struct lis3dh_acc_data *acc) return err; } if (!acc->pdata->enable_int && !acc->use_batch) { schedule_delayed_work(&acc->input_work, queue_delayed_work(acc->data_wq, &acc->input_work, msecs_to_jiffies(acc->delay_ms)); return 0; } Loading Loading @@ -1768,8 +1769,8 @@ static void lis3dh_acc_input_work_func(struct work_struct *work) else lis3dh_acc_report_values(acc, xyz); schedule_delayed_work(&acc->input_work, msecs_to_jiffies( acc->delay_ms)); queue_delayed_work(acc->data_wq, &acc->input_work, msecs_to_jiffies(acc->delay_ms)); mutex_unlock(&acc->lock); } Loading Loading @@ -1825,8 +1826,6 @@ static int lis3dh_acc_input_init(struct lis3dh_acc_data *acc) { int err; if (!acc->pdata->enable_int) INIT_DELAYED_WORK(&acc->input_work, lis3dh_acc_input_work_func); acc->input_dev = devm_input_allocate_device(&acc->client->dev); if (!acc->input_dev) { err = -ENOMEM; Loading Loading @@ -2150,12 +2149,22 @@ static int lis3dh_acc_probe(struct i2c_client *client, goto err_power_off; } acc->data_wq = NULL; if (!acc->pdata->enable_int) { acc->data_wq = create_freezable_workqueue("lis3dh_data_work"); if (!acc->data_wq) { dev_err(&client->dev, "create workquque failed\n"); goto err_power_off; } INIT_DELAYED_WORK(&acc->input_work, lis3dh_acc_input_work_func); } err = create_sysfs_interfaces(&client->dev); if (err < 0) { dev_err(&client->dev, "device LIS3DH_ACC_DEV_NAME sysfs register failed\n"); goto err_power_off; goto err_destroy_workqueue; } acc->cdev = lis3dh_acc_cdev; Loading Loading @@ -2226,6 +2235,9 @@ err_unreg_sensor_class: sensors_classdev_unregister(&acc->cdev); err_remove_sysfs_int: remove_sysfs_interfaces(&client->dev); err_destroy_workqueue: if (acc->data_wq) destroy_workqueue(acc->data_wq); err_power_off: lis3dh_acc_device_power_off(acc); err_regulator_init: Loading Loading @@ -2257,6 +2269,8 @@ static int lis3dh_acc_remove(struct i2c_client *client) sensors_classdev_unregister(&acc->cdev); lis3dh_acc_config_regulator(acc, false); remove_sysfs_interfaces(&client->dev); if (acc->data_wq) destroy_workqueue(acc->data_wq); if (acc->pdata->exit) acc->pdata->exit(); Loading
drivers/input/misc/mma8x5x.c +20 −5 Original line number Diff line number Diff line Loading @@ -2,7 +2,7 @@ * mma8x5x.c - Linux kernel modules for 3-Axis Orientation/Motion * Detection Sensor MMA8451/MMA8452/MMA8453 * * Copyright (c) 2013-2014, The Linux Foundation. All Rights Reserved. * Copyright (c) 2013-2015, The Linux Foundation. All Rights Reserved. * Linux Foundation chooses to take subject only to the GPLv2 license * terms, and distributes only under these terms. * Copyright (C) 2010-2011 Freescale Semiconductor, Inc. All Rights Reserved. Loading Loading @@ -189,6 +189,7 @@ struct mma8x5x_data_axis { }; struct mma8x5x_data { struct i2c_client *client; struct workqueue_struct *data_wq; struct delayed_work dwork; struct input_dev *idev; struct mutex data_lock; Loading Loading @@ -512,7 +513,8 @@ static void mma8x5x_dev_poll(struct work_struct *work) if ((pdata->active & MMA_STATE_MASK) == MMA_ACTIVED) { mma8x5x_report_data(pdata); schedule_delayed_work(&pdata->dwork, queue_delayed_work(pdata->data_wq, &pdata->dwork, msecs_to_jiffies(pdata->poll_delay)); } } Loading Loading @@ -580,7 +582,8 @@ static int mma8x5x_enable_set(struct sensors_classdev *sensors_cdev, goto err_failed; } if (!pdata->use_int) schedule_delayed_work(&pdata->dwork, queue_delayed_work(pdata->data_wq, &pdata->dwork, msecs_to_jiffies(pdata->poll_delay)); pdata->active = MMA_ACTIVED; Loading Loading @@ -883,6 +886,7 @@ static int mma8x5x_probe(struct i2c_client *client, i2c_set_clientdata(client, pdata); /* Initialize the MMA8X5X chip */ mma8x5x_device_init(client); pdata->data_wq = NULL; if (pdata->use_int) { if (pdata->int_pin >= 0) client->irq = gpio_to_irq(pdata->int_pin); Loading Loading @@ -916,6 +920,11 @@ static int mma8x5x_probe(struct i2c_client *client, mma8x5x_device_int_init(client); } else { INIT_DELAYED_WORK(&pdata->dwork, mma8x5x_dev_poll); pdata->data_wq = create_freezable_workqueue("mma_data_work"); if (!pdata->data_wq) { dev_err(&client->dev, "Create workqueue failed!\n"); goto err_alloc_work_queue; } } idev = devm_input_allocate_device(&client->dev); if (!idev) { Loading Loading @@ -963,9 +972,12 @@ static int mma8x5x_probe(struct i2c_client *client, err_create_class_sysfs: sysfs_remove_group(&idev->dev.kobj, &mma8x5x_attr_group); err_alloc_poll_device: if (pdata->data_wq) destroy_workqueue(pdata->data_wq); err_register_irq: if (pdata->use_int) device_init_wakeup(&client->dev, false); err_alloc_work_queue: err_set_gpio_direction: if (gpio_is_valid(pdata->int_pin) && pdata->use_int) gpio_free(pdata->int_pin); Loading @@ -986,6 +998,8 @@ static int mma8x5x_remove(struct i2c_client *client) if (pdata) { idev = pdata->idev; sysfs_remove_group(&idev->dev.kobj, &mma8x5x_attr_group); if (pdata->data_wq) destroy_workqueue(pdata->data_wq); if (pdata->use_int) { device_init_wakeup(&client->dev, false); if (gpio_is_valid(pdata->int_pin)) Loading Loading @@ -1039,7 +1053,8 @@ static int mma8x5x_resume(struct device *dev) if (pdata->active == MMA_ACTIVED) { val = i2c_smbus_read_byte_data(client, MMA8X5X_CTRL_REG1); i2c_smbus_write_byte_data(client, MMA8X5X_CTRL_REG1, val|0x01); schedule_delayed_work(&pdata->dwork, queue_delayed_work(pdata->data_wq, &pdata->dwork, msecs_to_jiffies(pdata->poll_delay)); } Loading
drivers/input/misc/mmc3416x.c +21 −5 Original line number Diff line number Diff line /* * Copyright (c) 2014, Linux Foundation. All rights reserved. * Copyright (c) 2014-2015, Linux Foundation. All rights reserved. * Linux Foundation chooses to take subject only to the GPLv2 license * terms, and distributes only under these terms. * Copyright (C) 2010 MEMSIC, Inc. Loading Loading @@ -102,6 +102,7 @@ struct mmc3416x_vec { struct mmc3416x_data { struct mutex ecompass_lock; struct mutex ops_lock; struct workqueue_struct *data_wq; struct delayed_work dwork; struct sensors_classdev cdev; struct mmc3416x_vec last; Loading Loading @@ -276,7 +277,8 @@ static void mmc3416x_poll(struct work_struct *work) input_sync(memsic->idev); exit: schedule_delayed_work(&memsic->dwork, queue_delayed_work(memsic->data_wq, &memsic->dwork, msecs_to_jiffies(memsic->poll_interval)); } Loading Loading @@ -554,7 +556,8 @@ static int mmc3416x_set_enable(struct sensors_classdev *sensors_cdev, memsic->timeout = jiffies; if (memsic->auto_report) schedule_delayed_work(&memsic->dwork, queue_delayed_work(memsic->data_wq, &memsic->dwork, msecs_to_jiffies(memsic->poll_interval)); } else if ((!enable) && memsic->enable) { if (memsic->auto_report) Loading Loading @@ -663,9 +666,16 @@ static int mmc3416x_probe(struct i2c_client *client, const struct i2c_device_id goto out_init_input; } memsic->data_wq = NULL; if (memsic->auto_report) { dev_info(&client->dev, "auto report is enabled\n"); dev_dbg(&client->dev, "auto report is enabled\n"); INIT_DELAYED_WORK(&memsic->dwork, mmc3416x_poll); memsic->data_wq = create_freezable_workqueue("mmc3416_data_work"); if (!memsic->data_wq) { dev_err(&client->dev, "Cannot create workqueue.\n"); goto out_create_workqueue; } } memsic->cdev = sensors_cdev; Loading @@ -692,6 +702,9 @@ static int mmc3416x_probe(struct i2c_client *client, const struct i2c_device_id out_power_set: sensors_classdev_unregister(&memsic->cdev); out_register_classdev: if (memsic->data_wq) destroy_workqueue(memsic->data_wq); out_create_workqueue: input_unregister_device(memsic->idev); out_init_input: out_check_device: Loading @@ -705,6 +718,8 @@ static int mmc3416x_remove(struct i2c_client *client) struct mmc3416x_data *memsic = dev_get_drvdata(&client->dev); sensors_classdev_unregister(&memsic->cdev); if (memsic->data_wq) destroy_workqueue(memsic->data_wq); mmc3416x_power_deinit(memsic); if (memsic->idev) Loading Loading @@ -751,7 +766,8 @@ static int mmc3416x_resume(struct device *dev) } if (memsic->auto_report) schedule_delayed_work(&memsic->dwork, queue_delayed_work(memsic->data_wq, &memsic->dwork, msecs_to_jiffies(memsic->poll_interval)); } Loading