diff options
author | Milo(Woogyom) Kim <milo.kim@ti.com> | 2013-02-05 04:58:35 -0500 |
---|---|---|
committer | Bryan Wu <cooloney@gmail.com> | 2013-02-06 18:59:27 -0500 |
commit | 22ebeb488b3dbbb64b81146b366551107ae34af8 (patch) | |
tree | 74eef8d5dcbc48c39b5452560bda094a0e8718ea /drivers/leds/leds-lp5523.c | |
parent | ffbdccdbbaee814963a09d25b1cc598cfe131366 (diff) |
leds-lp55xx: clean up init function
lp5521/5523_init_device() are replaced with lp55xx common function,
lp55xx_init_device().
Error handler in init_device:
deinit function are matched with 'err_post_init' section in
lp55xx_init_device().
Remove LP5523 engine intialization code:
Engine functionality is not mandatory but optional.
Moreover engine initialization is done internally with device reset command.
Therefore, this code is unnecessary.
Signed-off-by: Milo(Woogyom) Kim <milo.kim@ti.com>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
Diffstat (limited to 'drivers/leds/leds-lp5523.c')
-rw-r--r-- | drivers/leds/leds-lp5523.c | 46 |
1 files changed, 2 insertions, 44 deletions
diff --git a/drivers/leds/leds-lp5523.c b/drivers/leds/leds-lp5523.c index 110565b066e2..80b7fb4a3ad6 100644 --- a/drivers/leds/leds-lp5523.c +++ b/drivers/leds/leds-lp5523.c | |||
@@ -773,18 +773,6 @@ static void lp5523_set_mode(struct lp5523_engine *engine, u8 mode) | |||
773 | /*--------------------------------------------------------------*/ | 773 | /*--------------------------------------------------------------*/ |
774 | /* Probe, Attach, Remove */ | 774 | /* Probe, Attach, Remove */ |
775 | /*--------------------------------------------------------------*/ | 775 | /*--------------------------------------------------------------*/ |
776 | static int __init lp5523_init_engine(struct lp5523_engine *engine, int id) | ||
777 | { | ||
778 | if (id < 1 || id > LP5523_ENGINES) | ||
779 | return -1; | ||
780 | engine->id = id; | ||
781 | engine->engine_mask = LP5523_ENG_MASK_BASE >> SHIFT_MASK(id); | ||
782 | engine->prog_page = id - 1; | ||
783 | engine->mux_page = id + 2; | ||
784 | |||
785 | return 0; | ||
786 | } | ||
787 | |||
788 | static int lp5523_init_led(struct lp5523_led *led, struct device *dev, | 776 | static int lp5523_init_led(struct lp5523_led *led, struct device *dev, |
789 | int chan, struct lp5523_platform_data *pdata, | 777 | int chan, struct lp5523_platform_data *pdata, |
790 | const char *chip_name) | 778 | const char *chip_name) |
@@ -884,26 +872,6 @@ static void lp5523_unregister_leds(struct lp5523_chip *chip) | |||
884 | } | 872 | } |
885 | } | 873 | } |
886 | 874 | ||
887 | static void lp5523_deinit_device(struct lp5523_chip *chip); | ||
888 | static int lp5523_init_device(struct lp5523_chip *chip) | ||
889 | { | ||
890 | struct i2c_client *client = chip->client; | ||
891 | struct lp55xx_chip *temp; | ||
892 | int ret; | ||
893 | |||
894 | ret = lp5523_post_init_device(temp); | ||
895 | if (ret < 0) { | ||
896 | dev_err(&client->dev, "error configuring chip\n"); | ||
897 | goto err_config; | ||
898 | } | ||
899 | |||
900 | return 0; | ||
901 | |||
902 | err_config: | ||
903 | lp5523_deinit_device(chip); | ||
904 | return ret; | ||
905 | } | ||
906 | |||
907 | static void lp5523_deinit_device(struct lp5523_chip *chip) | 875 | static void lp5523_deinit_device(struct lp5523_chip *chip) |
908 | { | 876 | { |
909 | struct lp5523_platform_data *pdata = chip->pdata; | 877 | struct lp5523_platform_data *pdata = chip->pdata; |
@@ -931,7 +899,7 @@ static int lp5523_probe(struct i2c_client *client, | |||
931 | const struct i2c_device_id *id) | 899 | const struct i2c_device_id *id) |
932 | { | 900 | { |
933 | struct lp5523_chip *old_chip = NULL; | 901 | struct lp5523_chip *old_chip = NULL; |
934 | int ret, i; | 902 | int ret; |
935 | struct lp55xx_chip *chip; | 903 | struct lp55xx_chip *chip; |
936 | struct lp55xx_led *led; | 904 | struct lp55xx_led *led; |
937 | struct lp55xx_platform_data *pdata = client->dev.platform_data; | 905 | struct lp55xx_platform_data *pdata = client->dev.platform_data; |
@@ -958,21 +926,12 @@ static int lp5523_probe(struct i2c_client *client, | |||
958 | 926 | ||
959 | i2c_set_clientdata(client, led); | 927 | i2c_set_clientdata(client, led); |
960 | 928 | ||
961 | ret = lp5523_init_device(old_chip); | 929 | ret = lp55xx_init_device(chip); |
962 | if (ret) | 930 | if (ret) |
963 | goto err_init; | 931 | goto err_init; |
964 | 932 | ||
965 | dev_info(&client->dev, "%s Programmable led chip found\n", id->name); | 933 | dev_info(&client->dev, "%s Programmable led chip found\n", id->name); |
966 | 934 | ||
967 | /* Initialize engines */ | ||
968 | for (i = 0; i < ARRAY_SIZE(old_chip->engines); i++) { | ||
969 | ret = lp5523_init_engine(&old_chip->engines[i], i + 1); | ||
970 | if (ret) { | ||
971 | dev_err(&client->dev, "error initializing engine\n"); | ||
972 | goto fail1; | ||
973 | } | ||
974 | } | ||
975 | |||
976 | ret = lp5523_register_leds(old_chip, id->name); | 935 | ret = lp5523_register_leds(old_chip, id->name); |
977 | if (ret) | 936 | if (ret) |
978 | goto fail2; | 937 | goto fail2; |
@@ -985,7 +944,6 @@ static int lp5523_probe(struct i2c_client *client, | |||
985 | return ret; | 944 | return ret; |
986 | fail2: | 945 | fail2: |
987 | lp5523_unregister_leds(old_chip); | 946 | lp5523_unregister_leds(old_chip); |
988 | fail1: | ||
989 | lp5523_deinit_device(old_chip); | 947 | lp5523_deinit_device(old_chip); |
990 | err_init: | 948 | err_init: |
991 | return ret; | 949 | return ret; |