Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 358593
b: refs/heads/master
c: f6c64c6
h: refs/heads/master
i:
  358591: 4d67324
v: v3
  • Loading branch information
Milo(Woogyom) Kim authored and Bryan Wu committed Feb 6, 2013
1 parent c3802a4 commit 749082d
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 17 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: 86eb7748cef00faa3eaefc8fc450ed30281a09e7
refs/heads/master: f6c64c6fc8d793b414446f1a655a37b7bfce68e3
26 changes: 17 additions & 9 deletions trunk/drivers/leds/leds-lp5521.c
Original file line number Diff line number Diff line change
Expand Up @@ -694,6 +694,7 @@ static void lp5521_reset_device(struct lp5521_chip *chip)
lp5521_write(client, LP5521_REG_RESET, 0xff);
}

static void lp5521_deinit_device(struct lp5521_chip *chip);
static int lp5521_init_device(struct lp5521_chip *chip)
{
struct lp5521_platform_data *pdata = chip->pdata;
Expand Down Expand Up @@ -742,9 +743,22 @@ static int lp5521_init_device(struct lp5521_chip *chip)
usleep_range(10000, 20000);

ret = lp5521_detect(client);
if (ret)
if (ret) {
dev_err(&client->dev, "Chip not found\n");
goto err;
}

ret = lp5521_configure(client);
if (ret < 0) {
dev_err(&client->dev, "error configuring chip\n");
goto err_config;
}

return 0;

err_config:
lp5521_deinit_device(chip);
err:
return ret;
}

Expand Down Expand Up @@ -882,16 +896,10 @@ static int lp5521_probe(struct i2c_client *client,

ret = lp5521_init_device(chip);
if (ret)
goto fail1;
goto err_init;

dev_info(&client->dev, "%s programmable led chip found\n", id->name);

ret = lp5521_configure(client);
if (ret < 0) {
dev_err(&client->dev, "error configuring chip\n");
goto fail1;
}

ret = lp5521_register_leds(chip);
if (ret)
goto fail2;
Expand All @@ -904,8 +912,8 @@ static int lp5521_probe(struct i2c_client *client,
return ret;
fail2:
lp5521_unregister_leds(chip);
fail1:
lp5521_deinit_device(chip);
err_init:
return ret;
}

Expand Down
26 changes: 19 additions & 7 deletions trunk/drivers/leds/leds-lp5523.c
Original file line number Diff line number Diff line change
Expand Up @@ -953,6 +953,7 @@ static void lp5523_reset_device(struct lp5523_chip *chip)
lp5523_write(client, LP5523_REG_RESET, 0xff);
}

static void lp5523_deinit_device(struct lp5523_chip *chip);
static int lp5523_init_device(struct lp5523_chip *chip)
{
struct lp5523_platform_data *pdata = chip->pdata;
Expand All @@ -978,7 +979,22 @@ static int lp5523_init_device(struct lp5523_chip *chip)
* Exact value is not available. 10 - 20ms
* appears to be enough for reset.
*/
return lp5523_detect(client);
ret = lp5523_detect(client);
if (ret)
goto err;

ret = lp5523_configure(client);
if (ret < 0) {
dev_err(&client->dev, "error configuring chip\n");
goto err_config;
}

return 0;

err_config:
lp5523_deinit_device(chip);
err:
return ret;
}

static void lp5523_deinit_device(struct lp5523_chip *chip)
Expand Down Expand Up @@ -1018,7 +1034,7 @@ static int lp5523_probe(struct i2c_client *client,

ret = lp5523_init_device(chip);
if (ret)
goto fail1;
goto err_init;

dev_info(&client->dev, "%s Programmable led chip found\n", id->name);

Expand All @@ -1030,11 +1046,6 @@ static int lp5523_probe(struct i2c_client *client,
goto fail1;
}
}
ret = lp5523_configure(client);
if (ret < 0) {
dev_err(&client->dev, "error configuring chip\n");
goto fail1;
}

ret = lp5523_register_leds(chip, id->name);
if (ret)
Expand All @@ -1050,6 +1061,7 @@ static int lp5523_probe(struct i2c_client *client,
lp5523_unregister_leds(chip);
fail1:
lp5523_deinit_device(chip);
err_init:
return ret;
}

Expand Down

0 comments on commit 749082d

Please sign in to comment.