From: Philip Rakity <philipspatches@gmail.com>
To: linux-kernel@vger.kernel.org, broonie@opensource.wolfsonmicro.com
Cc: linux-mmc@vger.kernel.org, Philip Rakity <prakity@marvell.com>
Subject: [PATCH] regulator: pass voltage when calling notifier for change
Date: Sat, 9 Jun 2012 12:39:15 -0700 [thread overview]
Message-ID: <1339270755-2503-1-git-send-email-prakity@marvell.com> (raw)
The notified call back does pass the voltage that has
changed when calling the notifier callback. This makes
it impossible to know what to do. Pass the data
parameter (voltage) to the notifier.
A call to regulator_get_voltage cannot be made by the
receiver of the notifier since the mutex is held by
the regulator code and the call is blocked. Deadlock
occurs.
This code was tested on a slightly earlier version of
linux where it was used to adjust the chip pad voltage
when doing SD vccq signaling for SDXC cards.
Signed-off-by: Philip Rakity <prakity@marvell.com>
---
drivers/regulator/core.c | 15 ++++++++++-----
1 files changed, 10 insertions(+), 5 deletions(-)
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index e70dd38..f3d66d6 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -1916,11 +1916,16 @@ static int _regulator_do_set_voltage(struct regulator_dev *rdev,
udelay(delay);
}
- if (ret == 0)
- _notifier_call_chain(rdev, REGULATOR_EVENT_VOLTAGE_CHANGE,
- NULL);
+ if (ret == 0) {
+ int voltage;
- trace_regulator_set_voltage_complete(rdev_get_name(rdev), selector);
+ voltage = _regulator_get_voltage(rdev);
+ if (voltage >= 0)
+ _notifier_call_chain(rdev,
+ REGULATOR_EVENT_VOLTAGE_CHANGE,
+ (void *)voltage);
+ }
+ trace_regulator_set_voltage_complete(rdev_get_name(rdev), ret);
return ret;
}
@@ -2405,7 +2410,7 @@ static void _notifier_call_chain(struct regulator_dev *rdev,
unsigned long event, void *data)
{
/* call rdev chain first */
- blocking_notifier_call_chain(&rdev->notifier, event, NULL);
+ blocking_notifier_call_chain(&rdev->notifier, event, data);
}
/**
--
1.7.0.4
next reply other threads:[~2012-06-09 19:39 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-06-09 19:39 Philip Rakity [this message]
2012-06-11 3:59 ` [PATCH] regulator: pass voltage when calling notifier for change 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=1339270755-2503-1-git-send-email-prakity@marvell.com \
--to=philipspatches@gmail.com \
--cc=broonie@opensource.wolfsonmicro.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mmc@vger.kernel.org \
--cc=prakity@marvell.com \
/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).