Messages in this thread Patch in this message | | | From | Haojian Zhuang <> | Subject | [PATCH] mfd: add workqueue thread into 88pm860x | Date | Mon, 7 Mar 2011 23:43:13 +0800 |
| |
Create workqueue thread in 88pm860x driver since 88pm860x driver needs to handle event in workqueue.
Avoid to use system workqueue since i2c operation cost a lot of time. It would impact system performance.
Signed-off-by: Haojian Zhuang <haojian.zhuang@marvell.com> --- drivers/mfd/88pm860x-core.c | 12 ++++++++++++ include/linux/mfd/88pm860x.h | 1 + 2 files changed, 13 insertions(+), 0 deletions(-)
diff --git a/drivers/mfd/88pm860x-core.c b/drivers/mfd/88pm860x-core.c index 9c511c1..42c4fa2 100644 --- a/drivers/mfd/88pm860x-core.c +++ b/drivers/mfd/88pm860x-core.c @@ -766,11 +766,21 @@ static void __devinit device_8607_init(struct pm860x_chip *chip, if (ret < 0) goto out; + chip->monitor_wqueue = create_singlethread_workqueue("88pm860x"); + if (!chip->monitor_wqueue) { + ret = -ESRCH; + goto out_work; + } + device_regulator_init(chip, i2c, pdata); device_onkey_init(chip, i2c, pdata); device_touch_init(chip, i2c, pdata); device_power_init(chip, i2c, pdata); device_codec_init(chip, i2c, pdata); + return; + +out_work: + device_irq_exit(chip); out: return; } @@ -807,6 +817,8 @@ int __devinit pm860x_device_init(struct pm860x_chip *chip, void __devexit pm860x_device_exit(struct pm860x_chip *chip) { + flush_workqueue(chip->monitor_wqueue); + destroy_workqueue(chip->monitor_wqueue); device_irq_exit(chip); mfd_remove_devices(chip->dev); } diff --git a/include/linux/mfd/88pm860x.h b/include/linux/mfd/88pm860x.h index a6f6f81..87df510 100644 --- a/include/linux/mfd/88pm860x.h +++ b/include/linux/mfd/88pm860x.h @@ -301,6 +301,7 @@ struct pm860x_chip { struct mutex irq_lock; struct i2c_client *client; struct i2c_client *companion; /* companion chip client */ + struct workqueue_struct *monitor_wqueue; int buck3_double; /* DVC ramp slope double */ unsigned short companion_addr; -- 1.5.6.5
| |