public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Extcon: Notify changed state for only one cable to notifee
@ 2012-04-27  6:17 Chanwoo Choi
  0 siblings, 0 replies; only message in thread
From: Chanwoo Choi @ 2012-04-27  6:17 UTC (permalink / raw)
  To: myungjoo.ham@samsung.com, gregkh
  Cc: Kyungmin Park, Mark Brown, linux-kernel@vger.kernel.org

This patch inform the state of only one cable instead of previous data
including the state of 32 cables to notifee which use
extcon_register_interest()
function to monitor whether the specific cable is attachd or detached.

Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Myungjoo Ham <myungjoo.ham@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
---
 drivers/extcon/extcon_class.c |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/drivers/extcon/extcon_class.c b/drivers/extcon/extcon_class.c
index dbd3bfb..9cf3166 100644
--- a/drivers/extcon/extcon_class.c
+++ b/drivers/extcon/extcon_class.c
@@ -425,8 +425,15 @@ static int _call_per_cable(struct notifier_block
*nb, unsigned long val,

 	if ((val & (1 << obj->cable_index)) !=
 	    (edev->state & (1 << obj->cable_index))) {
+		bool cable_state = true;
+
 		obj->previous_value = val;
-		return obj->user_nb->notifier_call(obj->user_nb, val, ptr);
+
+		if (val & (1 << obj->cable_index))
+			cable_state = false;
+
+		return obj->user_nb->notifier_call(obj->user_nb,
+				cable_state, ptr);
 	}

 	return NOTIFY_OK;
-- 
1.7.0.4


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

only message in thread, other threads:[~2012-04-27  6:17 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-04-27  6:17 [PATCH] Extcon: Notify changed state for only one cable to notifee Chanwoo Choi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox