Commit c732eaf0 authored by Dan Murphy's avatar Dan Murphy Committed by Pavel Machek
Browse files

leds: lp55xx: Convert LED class registration to devm_*



Convert the LED class registration calls to the LED devm_*
registration calls.

Acked-by: default avatarJacek Anaszewski <jacek.anaszewski@gmail.com>
Acked-by: default avatarPavel Machek <pavel@ucw.cz>
Signed-off-by: default avatarDan Murphy <dmurphy@ti.com>
Signed-off-by: default avatarPavel Machek <pavel@ucw.cz>
parent a89d385d
Loading
Loading
Loading
Loading
+3 −6
Original line number Diff line number Diff line
@@ -541,19 +541,17 @@ static int lp5521_probe(struct i2c_client *client,

	ret = lp55xx_register_leds(led, chip);
	if (ret)
		goto err_register_leds;
		goto err_out;

	ret = lp55xx_register_sysfs(chip);
	if (ret) {
		dev_err(&client->dev, "registering sysfs failed\n");
		goto err_register_sysfs;
		goto err_out;
	}

	return 0;

err_register_sysfs:
	lp55xx_unregister_leds(led, chip);
err_register_leds:
err_out:
	lp55xx_deinit_device(chip);
err_init:
	return ret;
@@ -566,7 +564,6 @@ static int lp5521_remove(struct i2c_client *client)

	lp5521_stop_all_engines(chip);
	lp55xx_unregister_sysfs(chip);
	lp55xx_unregister_leds(led, chip);
	lp55xx_deinit_device(chip);

	return 0;
+3 −6
Original line number Diff line number Diff line
@@ -909,19 +909,17 @@ static int lp5523_probe(struct i2c_client *client,

	ret = lp55xx_register_leds(led, chip);
	if (ret)
		goto err_register_leds;
		goto err_out;

	ret = lp55xx_register_sysfs(chip);
	if (ret) {
		dev_err(&client->dev, "registering sysfs failed\n");
		goto err_register_sysfs;
		goto err_out;
	}

	return 0;

err_register_sysfs:
	lp55xx_unregister_leds(led, chip);
err_register_leds:
err_out:
	lp55xx_deinit_device(chip);
err_init:
	return ret;
@@ -934,7 +932,6 @@ static int lp5523_remove(struct i2c_client *client)

	lp5523_stop_all_engines(chip);
	lp55xx_unregister_sysfs(chip);
	lp55xx_unregister_leds(led, chip);
	lp55xx_deinit_device(chip);

	return 0;
+3 −6
Original line number Diff line number Diff line
@@ -554,19 +554,17 @@ static int lp5562_probe(struct i2c_client *client,

	ret = lp55xx_register_leds(led, chip);
	if (ret)
		goto err_register_leds;
		goto err_out;

	ret = lp55xx_register_sysfs(chip);
	if (ret) {
		dev_err(&client->dev, "registering sysfs failed\n");
		goto err_register_sysfs;
		goto err_out;
	}

	return 0;

err_register_sysfs:
	lp55xx_unregister_leds(led, chip);
err_register_leds:
err_out:
	lp55xx_deinit_device(chip);
err_init:
	return ret;
@@ -580,7 +578,6 @@ static int lp5562_remove(struct i2c_client *client)
	lp5562_stop_engine(chip);

	lp55xx_unregister_sysfs(chip);
	lp55xx_unregister_leds(led, chip);
	lp55xx_deinit_device(chip);

	return 0;
+1 −14
Original line number Diff line number Diff line
@@ -179,7 +179,7 @@ static int lp55xx_init_led(struct lp55xx_led *led,
		led->cdev.name = name;
	}

	ret = led_classdev_register(dev, &led->cdev);
	ret = devm_led_classdev_register(dev, &led->cdev);
	if (ret) {
		dev_err(dev, "led register err: %d\n", ret);
		return ret;
@@ -480,23 +480,10 @@ int lp55xx_register_leds(struct lp55xx_led *led, struct lp55xx_chip *chip)
	return 0;

err_init_led:
	lp55xx_unregister_leds(led, chip);
	return ret;
}
EXPORT_SYMBOL_GPL(lp55xx_register_leds);

void lp55xx_unregister_leds(struct lp55xx_led *led, struct lp55xx_chip *chip)
{
	int i;
	struct lp55xx_led *each;

	for (i = 0; i < chip->num_leds; i++) {
		each = led + i;
		led_classdev_unregister(&each->cdev);
	}
}
EXPORT_SYMBOL_GPL(lp55xx_unregister_leds);

int lp55xx_register_sysfs(struct lp55xx_chip *chip)
{
	struct device *dev = &chip->cl->dev;
+0 −2
Original line number Diff line number Diff line
@@ -189,8 +189,6 @@ extern void lp55xx_deinit_device(struct lp55xx_chip *chip);
/* common LED class device functions */
extern int lp55xx_register_leds(struct lp55xx_led *led,
				struct lp55xx_chip *chip);
extern void lp55xx_unregister_leds(struct lp55xx_led *led,
				struct lp55xx_chip *chip);

/* common device attributes functions */
extern int lp55xx_register_sysfs(struct lp55xx_chip *chip);
Loading