From: Mike Rapoport <mike@compulab.co.il>
To: Liam Girdwood <lrg@slimlogic.co.uk>
Cc: LKML <linux-kernel@vger.kernel.org>
Subject: [PATCH] regulator: add unset_regulator_supplies to fix regulator_unregister
Date: Thu, 22 Jan 2009 16:00:29 +0200 [thread overview]
Message-ID: <49787BFD.3020702@compulab.co.il> (raw)
Currently regulator_unregister does not clear regulator <--> consumer
mapping.
This patch introduces unset_regulator_supplies that clear the map.
Signed-off-by: Mike Rapoport <mike@compulab.co.il>
---
drivers/regulator/core.c | 14 ++++++++++++++
1 files changed, 14 insertions(+), 0 deletions(-)
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index f511a40..ab1beec 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -817,6 +817,19 @@ static void unset_consumer_device_supply(struct regulator_dev *rdev,
}
}
+static void unset_regulator_supplies(struct regulator_dev *rdev)
+{
+ struct regulator_map *node, *n;
+
+ list_for_each_entry_safe(node, n, ®ulator_map_list, list) {
+ if (rdev == node->regulator) {
+ list_del(&node->list);
+ kfree(node);
+ return;
+ }
+ }
+}
+
#define REG_STR_SIZE 32
static struct regulator *create_regulator(struct regulator_dev *rdev,
@@ -1945,6 +1958,7 @@ void regulator_unregister(struct regulator_dev *rdev)
return;
mutex_lock(®ulator_list_mutex);
+ unset_regulator_supplies(rdev);
list_del(&rdev->list);
if (rdev->supply)
sysfs_remove_link(&rdev->dev.kobj, "supply");
--
1.5.6.4
--
Sincerely yours,
Mike.
next reply other threads:[~2009-01-22 14:00 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-01-22 14:00 Mike Rapoport [this message]
2009-01-22 14:11 ` Mark Brown
2009-01-22 17:08 ` Liam Girdwood
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=49787BFD.3020702@compulab.co.il \
--to=mike@compulab.co.il \
--cc=linux-kernel@vger.kernel.org \
--cc=lrg@slimlogic.co.uk \
/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
all inboxes | Powered by JetHome®