diff options
| author | Andrey Smirnov <andrew.smirnov@gmail.com> | 2019-04-24 03:16:10 -0400 |
|---|---|---|
| committer | Sebastian Reichel <sre@kernel.org> | 2019-04-25 18:06:56 -0400 |
| commit | 349ced9984ff540ce74ca8a0b2e9b03dc434b9dd (patch) | |
| tree | e8c9796470629e546872f1aba5eb48b700ae0c9c | |
| parent | dbe7208c6c4aec083571f2ec742870a0d0edbea3 (diff) | |
power: supply: sysfs: prevent endless uevent loop with CONFIG_POWER_SUPPLY_DEBUG
Fix a similar endless event loop as was done in commit
8dcf32175b4e ("i2c: prevent endless uevent loop with
CONFIG_I2C_DEBUG_CORE"):
The culprit is the dev_dbg printk in the i2c uevent handler. If
this is activated (for instance by CONFIG_I2C_DEBUG_CORE) it results
in an endless loop with systemd-journald.
This happens if user-space scans the system log and reads the uevent
file to get information about a newly created device, which seems
fair use to me. Unfortunately reading the "uevent" file uses the
same function that runs for creating the uevent for a new device,
generating the next syslog entry
Both CONFIG_I2C_DEBUG_CORE and CONFIG_POWER_SUPPLY_DEBUG were reported
in https://bugs.freedesktop.org/show_bug.cgi?id=76886 but only former
seems to have been fixed. Drop debug prints as it was done in I2C
subsystem to resolve the issue.
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
Cc: Chris Healy <cphealy@gmail.com>
Cc: linux-pm@vger.kernel.org
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
| -rw-r--r-- | drivers/power/supply/power_supply_sysfs.c | 6 |
1 files changed, 0 insertions, 6 deletions
diff --git a/drivers/power/supply/power_supply_sysfs.c b/drivers/power/supply/power_supply_sysfs.c index dce24f596160..5358a80d854f 100644 --- a/drivers/power/supply/power_supply_sysfs.c +++ b/drivers/power/supply/power_supply_sysfs.c | |||
| @@ -383,15 +383,11 @@ int power_supply_uevent(struct device *dev, struct kobj_uevent_env *env) | |||
| 383 | char *prop_buf; | 383 | char *prop_buf; |
| 384 | char *attrname; | 384 | char *attrname; |
| 385 | 385 | ||
| 386 | dev_dbg(dev, "uevent\n"); | ||
| 387 | |||
| 388 | if (!psy || !psy->desc) { | 386 | if (!psy || !psy->desc) { |
| 389 | dev_dbg(dev, "No power supply yet\n"); | 387 | dev_dbg(dev, "No power supply yet\n"); |
| 390 | return ret; | 388 | return ret; |
| 391 | } | 389 | } |
| 392 | 390 | ||
| 393 | dev_dbg(dev, "POWER_SUPPLY_NAME=%s\n", psy->desc->name); | ||
| 394 | |||
| 395 | ret = add_uevent_var(env, "POWER_SUPPLY_NAME=%s", psy->desc->name); | 391 | ret = add_uevent_var(env, "POWER_SUPPLY_NAME=%s", psy->desc->name); |
| 396 | if (ret) | 392 | if (ret) |
| 397 | return ret; | 393 | return ret; |
| @@ -427,8 +423,6 @@ int power_supply_uevent(struct device *dev, struct kobj_uevent_env *env) | |||
| 427 | goto out; | 423 | goto out; |
| 428 | } | 424 | } |
| 429 | 425 | ||
| 430 | dev_dbg(dev, "prop %s=%s\n", attrname, prop_buf); | ||
| 431 | |||
| 432 | ret = add_uevent_var(env, "POWER_SUPPLY_%s=%s", attrname, prop_buf); | 426 | ret = add_uevent_var(env, "POWER_SUPPLY_%s=%s", attrname, prop_buf); |
| 433 | kfree(attrname); | 427 | kfree(attrname); |
| 434 | if (ret) | 428 | if (ret) |
