linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH/RFC] regulator: pass voltage to notifiers
@ 2012-01-25 14:13 Bill Gatliff
  0 siblings, 0 replies; only message in thread
From: Bill Gatliff @ 2012-01-25 14:13 UTC (permalink / raw)
  To: lrg, lkml; +Cc: Ryan Kuester, John Marland

[-- Attachment #1: Type: text/plain, Size: 557 bytes --]

Guys:


The attached patch file passes the new regulator voltage forward to
notifiers in the *data argument.  This eliminates the need for a
schedule_work() in situations where the notifier needs to know what
the new voltage is.

I apologize for sending it outside of git send-email, but I am behind
a firewall at the moment and wanted to get this out now rather than
waiting.  Will re-send if necessary.

Also, this is against linux-3.0.8, but I am happy to rebase if
upstream is interested.


Kindest regards,


b.g.
-- 
Bill Gatliff
bgat@billgatliff.com

[-- Attachment #2: 0001-regulator-pass-voltage-to-notifiers.patch --]
[-- Type: application/octet-stream, Size: 2494 bytes --]

From c46e97e574fae554112acd931565fc5aa4b511d6 Mon Sep 17 00:00:00 2001
From: Bill Gatliff <bill.gatliff@sonyericsson.com>
Date: Wed, 25 Jan 2012 14:59:13 +0100
Subject: [PATCH] regulator: pass voltage to notifiers

The regulator API goes to great lengths to stay synchronized with
regulator states, but then throws all that hard work away by not
pasing the current regulator voltage to notifiers.  This forces
notifiers to do a schedule_work() or similar to take action based on
regulator voltage, since they cannot call regulator_get_voltage() in
the notifier function itself.  This un-synchronizes them from
regulator state changes.

The enclosed patch passes the new regulator voltage forward to
notifiers, allowing them to stay synchronized with the regulator if
that is the only information they need.

Change-Id: I9d6dfe82c464a2834ac149275f6d7f0cdf8a8167

Signed-off-by: Bill Gatliff <bill.gatliff@sonyericsson.com>
---
 drivers/regulator/core.c |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index 5b2328d..9a57ee6 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -643,7 +643,8 @@ static int update_voltage(struct regulator *regulator, int min_uV, int max_uV)
 	if (!ret)
 		goto out;
 
-	_notifier_call_chain(rdev, REGULATOR_EVENT_VOLTAGE_CHANGE, NULL);
+	_notifier_call_chain(rdev, REGULATOR_EVENT_VOLTAGE_CHANGE,
+			     (void*)_regulator_get_voltage(rdev));
 
 out:
 	return ret;
@@ -670,7 +671,8 @@ static int update_voltage_prev(struct regulator_dev *rdev)
 	if (!ret)
 		return ret;
 
-	_notifier_call_chain(rdev, REGULATOR_EVENT_VOLTAGE_CHANGE, NULL);
+	_notifier_call_chain(rdev, REGULATOR_EVENT_VOLTAGE_CHANGE,
+			     (void*)_regulator_get_voltage(rdev));
 
 	return ret;
 }
@@ -1852,7 +1854,7 @@ static int _regulator_do_set_voltage(struct regulator_dev *rdev,
 
 	if (ret == 0)
 		_notifier_call_chain(rdev, REGULATOR_EVENT_VOLTAGE_CHANGE,
-				     NULL);
+				     (void*)_regulator_get_voltage(rdev));
 
 	trace_regulator_set_voltage_complete(rdev_get_name(rdev), selector);
 
@@ -2342,7 +2344,7 @@ static void _notifier_call_chain(struct regulator_dev *rdev,
 	struct regulator_dev *_rdev;
 
 	/* call rdev chain first */
-	blocking_notifier_call_chain(&rdev->notifier, event, NULL);
+	blocking_notifier_call_chain(&rdev->notifier, event, data);
 
 	/* now notify regulator we supply */
 	list_for_each_entry(_rdev, &rdev->supply_list, slist) {
-- 
1.7.5.4


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2012-01-25 14:13 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-01-25 14:13 [PATCH/RFC] regulator: pass voltage to notifiers Bill Gatliff

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).