regulator: core: Set more descriptive device names

We have proper names for regulators, so use them instead of meaningless
numbers generated at boot that make it hard to identify regulators
based on their device names alone.

Signed-off-by: Danny Lin <danny@kdrag0n.dev>
This commit is contained in:
Danny Lin 2020-11-01 18:38:23 -08:00 committed by spakkkk
parent 0e4c247c72
commit 71f41132c1

View File

@ -4733,7 +4733,6 @@ regulator_register(const struct regulator_desc *regulator_desc,
{
const struct regulator_init_data *init_data;
struct regulator_config *config = NULL;
static atomic_t regulator_no = ATOMIC_INIT(-1);
struct regulator_dev *rdev;
struct device *dev;
int ret, i;
@ -4826,8 +4825,7 @@ regulator_register(const struct regulator_desc *regulator_desc,
/* register with sysfs */
rdev->dev.class = &regulator_class;
rdev->dev.parent = dev;
dev_set_name(&rdev->dev, "regulator.%lu",
(unsigned long) atomic_inc_return(&regulator_no));
dev_set_name(&rdev->dev, "regulator:%s", regulator_desc->name);
/* set regulator constraints */
if (init_data)