From: shawn.guo@linaro.org (Shawn Guo)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] regulator: core: remove sysfs entry properly in regulator_put
Date: Thu, 5 Jul 2012 14:19:42 +0800 [thread overview]
Message-ID: <1341469182-5079-1-git-send-email-shawn.guo@linaro.org> (raw)
In-Reply-To: <CAOMZO5BD_FcXVU18PauOFudod5FKd9MP-ZNUDJ4F9iQ6+EAjiA@mail.gmail.com>
With changes introduced by commit 222cc7b (regulator: core: Allow
multiple requests of a single supply mapping) on create_regulator,
regulator_put needs a corresponding update on sysfs entry removing.
Also regulator->dev still needs to get assigned in create_regulator,
otherwise, sysfs_remove_link call in regulator_put will get bypassed.
Reported-by: Fabio Estevam <festevam@gmail.com>
Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
---
drivers/regulator/core.c | 7 +++----
1 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index ef07b62..3998d8f 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -1071,6 +1071,8 @@ static struct regulator *create_regulator(struct regulator_dev *rdev,
list_add(®ulator->list, &rdev->consumer_list);
if (dev) {
+ regulator->dev = dev;
+
/* Add a link to the device sysfs entry */
size = scnprintf(buf, REG_STR_SIZE, "%s-%s",
dev->kobj.name, supply_name);
@@ -1367,11 +1369,8 @@ void regulator_put(struct regulator *regulator)
debugfs_remove_recursive(regulator->debugfs);
/* remove any sysfs entries */
- if (regulator->dev) {
+ if (regulator->dev)
sysfs_remove_link(&rdev->dev.kobj, regulator->supply_name);
- device_remove_file(regulator->dev, ®ulator->dev_attr);
- kfree(regulator->dev_attr.attr.name);
- }
kfree(regulator->supply_name);
list_del(®ulator->list);
kfree(regulator);
--
1.7.5.4
next prev parent reply other threads:[~2012-07-05 6:19 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-07-04 3:53 mx28evk: kernel dump on sgtl5000 probe Fabio Estevam
2012-07-04 4:36 ` Marek Vasut
2012-07-05 6:19 ` Shawn Guo [this message]
2012-07-05 8:28 ` [PATCH] regulator: core: remove sysfs entry properly in regulator_put Dong Aisheng
2012-07-05 12:15 ` Mark Brown
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1341469182-5079-1-git-send-email-shawn.guo@linaro.org \
--to=shawn.guo@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).