summaryrefslogtreecommitdiff
path: root/drivers/misc/bh1770glc.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/misc/bh1770glc.c')
-rw-r--r--drivers/misc/bh1770glc.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/drivers/misc/bh1770glc.c b/drivers/misc/bh1770glc.c
index bedbe0efb330..45f8fc69a711 100644
--- a/drivers/misc/bh1770glc.c
+++ b/drivers/misc/bh1770glc.c
@@ -640,7 +640,9 @@ static ssize_t bh1770_power_state_store(struct device *dev,
mutex_lock(&chip->mutex);
if (value) {
- pm_runtime_get_sync(dev);
+ ret = pm_runtime_resume_and_get(dev);
+ if (ret < 0)
+ goto leave;
ret = bh1770_lux_rate(chip, chip->lux_rate_index);
if (ret < 0) {
@@ -680,15 +682,15 @@ static ssize_t bh1770_lux_result_show(struct device *dev,
{
struct bh1770_chip *chip = dev_get_drvdata(dev);
ssize_t ret;
- long timeout;
+ long time_left;
if (pm_runtime_suspended(dev))
return -EIO; /* Chip is not enabled at all */
- timeout = wait_event_interruptible_timeout(chip->wait,
- !chip->lux_wait_result,
- msecs_to_jiffies(BH1770_TIMEOUT));
- if (!timeout)
+ time_left = wait_event_interruptible_timeout(chip->wait,
+ !chip->lux_wait_result,
+ msecs_to_jiffies(BH1770_TIMEOUT));
+ if (!time_left)
return -EIO;
mutex_lock(&chip->mutex);
@@ -1361,8 +1363,8 @@ static int bh1770_runtime_resume(struct device *dev)
#endif
static const struct i2c_device_id bh1770_id[] = {
- {"bh1770glc", 0 },
- {"sfh7770", 0 },
+ { "bh1770glc" },
+ { "sfh7770" },
{}
};
@@ -1374,11 +1376,11 @@ static const struct dev_pm_ops bh1770_pm_ops = {
};
static struct i2c_driver bh1770_driver = {
- .driver = {
+ .driver = {
.name = "bh1770glc",
.pm = &bh1770_pm_ops,
},
- .probe_new = bh1770_probe,
+ .probe = bh1770_probe,
.remove = bh1770_remove,
.id_table = bh1770_id,
};