Skip to content

Commit

Permalink
power: supply: sysfs: prevent endless uevent loop with CONFIG_POWER_S…
Browse files Browse the repository at this point in the history
…UPPLY_DEBUG

Fix a similar endless event loop as was done in commit
8dcf321 ("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>
  • Loading branch information
Andrey Smirnov authored and Sebastian Reichel committed Apr 25, 2019
1 parent dbe7208 commit 349ced9
Showing 1 changed file with 0 additions and 6 deletions.
6 changes: 0 additions & 6 deletions drivers/power/supply/power_supply_sysfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -383,15 +383,11 @@ int power_supply_uevent(struct device *dev, struct kobj_uevent_env *env)
char *prop_buf;
char *attrname;

dev_dbg(dev, "uevent\n");

if (!psy || !psy->desc) {
dev_dbg(dev, "No power supply yet\n");
return ret;
}

dev_dbg(dev, "POWER_SUPPLY_NAME=%s\n", psy->desc->name);

ret = add_uevent_var(env, "POWER_SUPPLY_NAME=%s", psy->desc->name);
if (ret)
return ret;
Expand Down Expand Up @@ -427,8 +423,6 @@ int power_supply_uevent(struct device *dev, struct kobj_uevent_env *env)
goto out;
}

dev_dbg(dev, "prop %s=%s\n", attrname, prop_buf);

ret = add_uevent_var(env, "POWER_SUPPLY_%s=%s", attrname, prop_buf);
kfree(attrname);
if (ret)
Expand Down

0 comments on commit 349ced9

Please sign in to comment.