diff options
Diffstat (limited to 'drivers/mfd/cros_ec.c')
-rw-r--r-- | drivers/mfd/cros_ec.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/drivers/mfd/cros_ec.c b/drivers/mfd/cros_ec.c index a9faebdcfa14..c53804a1451d 100644 --- a/drivers/mfd/cros_ec.c +++ b/drivers/mfd/cros_ec.c @@ -65,7 +65,13 @@ EXPORT_SYMBOL(cros_ec_check_result); int cros_ec_cmd_xfer(struct cros_ec_device *ec_dev, struct cros_ec_command *msg) { - return ec_dev->cmd_xfer(ec_dev, msg); + int ret; + + mutex_lock(&ec_dev->lock); + ret = ec_dev->cmd_xfer(ec_dev, msg); + mutex_unlock(&ec_dev->lock); + + return ret; } EXPORT_SYMBOL(cros_ec_cmd_xfer); @@ -98,6 +104,8 @@ int cros_ec_register(struct cros_ec_device *ec_dev) return -ENOMEM; } + mutex_init(&ec_dev->lock); + err = mfd_add_devices(dev, 0, cros_devs, ARRAY_SIZE(cros_devs), NULL, ec_dev->irq, NULL); |