Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 185673
b: refs/heads/master
c: 56c2349
h: refs/heads/master
i:
  185671: 7e1d89c
v: v3
  • Loading branch information
Dmitry Torokhov authored and Liam Girdwood committed Mar 3, 2010
1 parent 58528a4 commit b426c2a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 20 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 54d13ab1038911249fc5769efee87fed000623c0
refs/heads/master: 56c23492b2266fcbe38f26a3de217902c70a895b
34 changes: 15 additions & 19 deletions trunk/drivers/regulator/tps6507x-regulator.c
Original file line number Diff line number Diff line change
Expand Up @@ -538,15 +538,16 @@ static struct regulator_ops tps6507x_ldo_ops = {
.list_voltage = tps6507x_ldo_list_voltage,
};

static
int tps_6507x_probe(struct i2c_client *client, const struct i2c_device_id *id)
static int __devinit tps_6507x_probe(struct i2c_client *client,
const struct i2c_device_id *id)
{
static int desc_id;
const struct tps_info *info = (void *)id->driver_data;
struct regulator_init_data *init_data;
struct regulator_dev *rdev;
struct tps_pmic *tps;
int i;
int error;

if (!i2c_check_functionality(client->adapter,
I2C_FUNC_SMBUS_BYTE_DATA))
Expand All @@ -557,7 +558,6 @@ int tps_6507x_probe(struct i2c_client *client, const struct i2c_device_id *id)
* coming from the board-evm file.
*/
init_data = client->dev.platform_data;

if (!init_data)
return -EIO;

Expand Down Expand Up @@ -586,18 +586,8 @@ int tps_6507x_probe(struct i2c_client *client, const struct i2c_device_id *id)
if (IS_ERR(rdev)) {
dev_err(&client->dev, "failed to register %s\n",
id->name);

/* Unregister */
while (i)
regulator_unregister(tps->rdev[--i]);

tps->client = NULL;

/* clear the client data in i2c */
i2c_set_clientdata(client, NULL);

kfree(tps);
return PTR_ERR(rdev);
error = PTR_ERR(rdev);
goto fail;
}

/* Save regulator for cleanup */
Expand All @@ -607,6 +597,13 @@ int tps_6507x_probe(struct i2c_client *client, const struct i2c_device_id *id)
i2c_set_clientdata(client, tps);

return 0;

fail:
while (--i >= 0)
regulator_unregister(tps->rdev[i]);

kfree(tps);
return error;
}

/**
Expand All @@ -620,13 +617,12 @@ static int __devexit tps_6507x_remove(struct i2c_client *client)
struct tps_pmic *tps = i2c_get_clientdata(client);
int i;

/* clear the client data in i2c */
i2c_set_clientdata(client, NULL);

for (i = 0; i < TPS6507X_NUM_REGULATOR; i++)
regulator_unregister(tps->rdev[i]);

tps->client = NULL;

/* clear the client data in i2c */
i2c_set_clientdata(client, NULL);
kfree(tps);

return 0;
Expand Down

0 comments on commit b426c2a

Please sign in to comment.