summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvenu byravarasu <vbyravarasu@nvidia.com>2011-09-08 14:19:07 +0530
committerVarun Colbert <vcolbert@nvidia.com>2011-09-09 14:36:52 -0700
commit6b39c9f51b3c09c6aa0b1cd7e7a3fdb122200d14 (patch)
tree811debb72fe635e146c00f0ba4b3f98e83e95d71
parentf66aaace70f4327a8612913a8d5e2cb967dcdad6 (diff)
misc: nct1008: fixing regulator handling
Corrected regulator handling of NCT1008 bug 869217 Change-Id: I2cf72abe7b5a14fbe03463bbd4105f0b0bac34d9 Reviewed-on: http://git-master/r/51296 Tested-by: Venu Byravarasu <vbyravarasu@nvidia.com> Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
-rw-r--r--drivers/misc/nct1008.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/drivers/misc/nct1008.c b/drivers/misc/nct1008.c
index ef157c3334e7..c1875ebeae5c 100644
--- a/drivers/misc/nct1008.c
+++ b/drivers/misc/nct1008.c
@@ -545,14 +545,16 @@ static irqreturn_t nct1008_irq(int irq, void *dev_id)
return IRQ_HANDLED;
}
-static void nct1008_power_control(struct nct1008_data *data, bool is_enable)
+static void nct1008_power_control(struct device *dev,
+ struct nct1008_data *data, bool is_enable)
{
int ret;
if (!data->nct_reg) {
- data->nct_reg = regulator_get(NULL, "vdd_nct1008");
+ data->nct_reg = regulator_get(dev, "vdd");
if (IS_ERR_OR_NULL(data->nct_reg)) {
- dev_warn(&data->client->dev, "Error in getting the "
- "regulator handle for vdd_nct1008\n");
+ dev_warn(&data->client->dev, "Error [%d] in"
+ "getting the regulator handle for vdd of %s\n",
+ data->nct_reg, dev_name(dev));
data->nct_reg = NULL;
return;
}
@@ -774,7 +776,7 @@ static int __devinit nct1008_probe(struct i2c_client *client,
i2c_set_clientdata(client, data);
mutex_init(&data->mutex);
- nct1008_power_control(data, true);
+ nct1008_power_control(&client->dev, data, true);
err = nct1008_configure_sensor(data); /* sensor is in standby */
if (err < 0) {
dev_err(&client->dev, "\n error file: %s : %s(), line=%d ",
@@ -810,7 +812,7 @@ static int __devinit nct1008_probe(struct i2c_client *client,
error:
dev_err(&client->dev, "\n exit %s, err=%d ", __func__, err);
- nct1008_power_control(data, false);
+ nct1008_power_control(&client->dev, data, false);
if (data->nct_reg)
regulator_put(data->nct_reg);
kfree(data);
@@ -824,7 +826,7 @@ static int __devexit nct1008_remove(struct i2c_client *client)
free_irq(data->client->irq, data);
cancel_work_sync(&data->work);
sysfs_remove_group(&client->dev.kobj, &nct1008_attr_group);
- nct1008_power_control(data, false);
+ nct1008_power_control(&client->dev, data, false);
if (data->nct_reg)
regulator_put(data->nct_reg);
kfree(data);