diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2023-09-20 12:33:08 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2023-09-20 14:32:23 +0200 |
commit | d7496abd0a0f26be39dc2fea4618a8346844ac6a (patch) | |
tree | 7e6d0fa9f6c017f37b418c2179182cb57e49dbc2 /drivers/regulator/core.c | |
parent | 28cfaed2e28e748e9f916fa848214cc0ef98699a (diff) | |
download | barebox-d7496abd0a0f26be39dc2fea4618a8346844ac6a.tar.gz barebox-d7496abd0a0f26be39dc2fea4618a8346844ac6a.tar.xz |
regulator: introduce regulator logging functions.
dev_* functions only print the struct device * as context, but often
a single struct device * implements multiple regulators. Add rdev_*
logging functions which allow to to print one specific regulator as
context.
Reviewed-by: Marco Felsch <m.felsch@pengutronix.de>
Link: https://lore.barebox.org/20230920103316.2758383-4-s.hauer@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'drivers/regulator/core.c')
-rw-r--r-- | drivers/regulator/core.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c index 41a3378ac8..8ef5a2372c 100644 --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c @@ -19,6 +19,14 @@ struct regulator { struct device *dev; }; +const char *rdev_get_name(struct regulator_dev *rdev) +{ + if (rdev->name) + return rdev->name; + + return ""; +} + static int regulator_map_voltage(struct regulator_dev *rdev, int min_uV, int max_uV) { @@ -125,7 +133,7 @@ static int regulator_resolve_supply(struct regulator_dev *rdev) if (!supply_name) return 0; - dev_dbg(rdev->dev, "resolving %s\n", supply_name); + rdev_dbg(rdev, "resolving %s\n", supply_name); supply = regulator_get(rdev->dev, supply_name); if (IS_ERR(supply)) { @@ -141,7 +149,7 @@ static int regulator_resolve_supply(struct regulator_dev *rdev) * we couldn't. If you want to get rid of this warning, consider * migrating your platform to have deep probe support. */ - dev_warn(rdev->dev, "Failed to get '%s' regulator (ignored).\n", + rdev_warn(rdev, "Failed to get '%s' regulator (ignored).\n", supply_name); return 0; } |