Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 358604
b: refs/heads/master
c: 6ce6176
h: refs/heads/master
v: v3
  • Loading branch information
Milo(Woogyom) Kim authored and Bryan Wu committed Feb 6, 2013
1 parent d95ef45 commit 3e74b92
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 29 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: 22ebeb488b3dbbb64b81146b366551107ae34af8
refs/heads/master: 6ce6176263393dd80b9a537c1e1462b8529f240b
16 changes: 4 additions & 12 deletions trunk/drivers/leds/leds-lp5521.c
Original file line number Diff line number Diff line change
Expand Up @@ -689,16 +689,6 @@ static void lp5521_unregister_sysfs(struct i2c_client *client)
&lp5521_led_attribute_group);
}

static void lp5521_deinit_device(struct lp5521_chip *chip)
{
struct lp5521_platform_data *pdata = chip->pdata;

if (pdata->enable)
pdata->enable(0);
if (pdata->release_resources)
pdata->release_resources();
}

static int lp5521_init_led(struct lp5521_led *led,
struct i2c_client *client,
int chan, struct lp5521_platform_data *pdata)
Expand Down Expand Up @@ -858,21 +848,23 @@ static int lp5521_probe(struct i2c_client *client,
return ret;
fail2:
lp5521_unregister_leds(old_chip);
lp5521_deinit_device(old_chip);
lp55xx_deinit_device(chip);
err_init:
return ret;
}

static int lp5521_remove(struct i2c_client *client)
{
struct lp5521_chip *old_chip = i2c_get_clientdata(client);
struct lp55xx_led *led = i2c_get_clientdata(client);
struct lp55xx_chip *chip = led->chip;

lp5521_run_led_pattern(PATTERN_OFF, old_chip);
lp5521_unregister_sysfs(client);

lp5521_unregister_leds(old_chip);
lp55xx_deinit_device(chip);

lp5521_deinit_device(old_chip);
return 0;
}

Expand Down
16 changes: 4 additions & 12 deletions trunk/drivers/leds/leds-lp5523.c
Original file line number Diff line number Diff line change
Expand Up @@ -872,16 +872,6 @@ static void lp5523_unregister_leds(struct lp5523_chip *chip)
}
}

static void lp5523_deinit_device(struct lp5523_chip *chip)
{
struct lp5523_platform_data *pdata = chip->pdata;

if (pdata->enable)
pdata->enable(0);
if (pdata->release_resources)
pdata->release_resources();
}

/* Chip specific configurations */
static struct lp55xx_device_config lp5523_cfg = {
.reset = {
Expand Down Expand Up @@ -944,23 +934,25 @@ static int lp5523_probe(struct i2c_client *client,
return ret;
fail2:
lp5523_unregister_leds(old_chip);
lp5523_deinit_device(old_chip);
lp55xx_deinit_device(chip);
err_init:
return ret;
}

static int lp5523_remove(struct i2c_client *client)
{
struct lp5523_chip *old_chip = i2c_get_clientdata(client);
struct lp55xx_led *led = i2c_get_clientdata(client);
struct lp55xx_chip *chip = led->chip;

/* Disable engine mode */
lp5523_write(client, LP5523_REG_OP_MODE, LP5523_CMD_DISABLED);

lp5523_unregister_sysfs(client);

lp5523_unregister_leds(old_chip);
lp55xx_deinit_device(chip);

lp5523_deinit_device(old_chip);
return 0;
}

Expand Down
15 changes: 12 additions & 3 deletions trunk/drivers/leds/leds-lp55xx-common.c
Original file line number Diff line number Diff line change
Expand Up @@ -152,14 +152,23 @@ int lp55xx_init_device(struct lp55xx_chip *chip)
return 0;

err_post_init:
lp55xx_deinit_device(chip);
err:
return ret;
}
EXPORT_SYMBOL_GPL(lp55xx_init_device);

void lp55xx_deinit_device(struct lp55xx_chip *chip)
{
struct lp55xx_platform_data *pdata = chip->pdata;

if (pdata->enable)
pdata->enable(0);

if (pdata->release_resources)
pdata->release_resources();
err:
return ret;
}
EXPORT_SYMBOL_GPL(lp55xx_init_device);
EXPORT_SYMBOL_GPL(lp55xx_deinit_device);

MODULE_AUTHOR("Milo Kim <milo.kim@ti.com>");
MODULE_DESCRIPTION("LP55xx Common Driver");
Expand Down
3 changes: 2 additions & 1 deletion trunk/drivers/leds/leds-lp55xx-common.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,8 @@ extern int lp55xx_read(struct lp55xx_chip *chip, u8 reg, u8 *val);
extern int lp55xx_update_bits(struct lp55xx_chip *chip, u8 reg,
u8 mask, u8 val);

/* common device init functions */
/* common device init/deinit functions */
extern int lp55xx_init_device(struct lp55xx_chip *chip);
extern void lp55xx_deinit_device(struct lp55xx_chip *chip);

#endif /* _LEDS_LP55XX_COMMON_H */

0 comments on commit 3e74b92

Please sign in to comment.