Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1a991485 authored by Milo(Woogyom) Kim's avatar Milo(Woogyom) Kim Committed by Bryan Wu
Browse files

leds-lp55xx: clean up deinit_device() in lp5521/5523



 Device de-initialization code is moved to _deinit_device() at each driver.
 This patch is a preceding step for lp55xx common driver architecture.

Signed-off-by: default avatarMilo(Woogyom) Kim <milo.kim@ti.com>
Signed-off-by: default avatarBryan Wu <cooloney@gmail.com>
parent 944f7b1d
Loading
Loading
Loading
Loading
+12 −8
Original line number Original line Diff line number Diff line
@@ -740,6 +740,16 @@ static int lp5521_init_device(struct lp5521_chip *chip)
	return ret;
	return ret;
}
}


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,
static int lp5521_init_led(struct lp5521_led *led,
				struct i2c_client *client,
				struct i2c_client *client,
				int chan, struct lp5521_platform_data *pdata)
				int chan, struct lp5521_platform_data *pdata)
@@ -865,10 +875,7 @@ static int lp5521_probe(struct i2c_client *client,
		cancel_work_sync(&chip->leds[i].brightness_work);
		cancel_work_sync(&chip->leds[i].brightness_work);
	}
	}
fail1:
fail1:
	if (pdata->enable)
	lp5521_deinit_device(chip);
		pdata->enable(0);
	if (pdata->release_resources)
		pdata->release_resources();
	return ret;
	return ret;
}
}


@@ -885,10 +892,7 @@ static int lp5521_remove(struct i2c_client *client)
		cancel_work_sync(&chip->leds[i].brightness_work);
		cancel_work_sync(&chip->leds[i].brightness_work);
	}
	}


	if (chip->pdata->enable)
	lp5521_deinit_device(chip);
		chip->pdata->enable(0);
	if (chip->pdata->release_resources)
		chip->pdata->release_resources();
	return 0;
	return 0;
}
}


+12 −8
Original line number Original line Diff line number Diff line
@@ -923,6 +923,16 @@ static int lp5523_init_device(struct lp5523_chip *chip)
	return lp5523_detect(client);
	return lp5523_detect(client);
}
}


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();
}

static int lp5523_probe(struct i2c_client *client,
static int lp5523_probe(struct i2c_client *client,
			const struct i2c_device_id *id)
			const struct i2c_device_id *id)
{
{
@@ -1009,10 +1019,7 @@ static int lp5523_probe(struct i2c_client *client,
		flush_work(&chip->leds[i].brightness_work);
		flush_work(&chip->leds[i].brightness_work);
	}
	}
fail1:
fail1:
	if (pdata->enable)
	lp5523_deinit_device(chip);
		pdata->enable(0);
	if (pdata->release_resources)
		pdata->release_resources();
	return ret;
	return ret;
}
}


@@ -1031,10 +1038,7 @@ static int lp5523_remove(struct i2c_client *client)
		flush_work(&chip->leds[i].brightness_work);
		flush_work(&chip->leds[i].brightness_work);
	}
	}


	if (chip->pdata->enable)
	lp5523_deinit_device(chip);
		chip->pdata->enable(0);
	if (chip->pdata->release_resources)
		chip->pdata->release_resources();
	return 0;
	return 0;
}
}