Skip to content

Commit

Permalink
Extcon: Notify changed state for only one cable to notifee
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Myungjoo Ham <[email protected]>
Signed-off-by: Kyungmin Park <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
  • Loading branch information
chanwoochoi authored and gregkh committed Apr 30, 2012
1 parent a1d26ac commit f4cce69
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion drivers/extcon/extcon_class.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit f4cce69

Please sign in to comment.