ANDROID: GKI: extcon: Add extcon_register_blocking_notifier API.

This change adds the extcon_register_blocking_notifier
API to register blocking notifier calls
for blocking functionality using extcon framework.

Bug: 150893404
Test: make
Signed-off-by: Mayank Rana <mrana@codeaurora.org>
Signed-off-by: Jack Pham <jackp@codeaurora.org>
Change-Id: I28d56bd898beea1da1f8c315602cc404e8bc326f
(cherry picked from commit 9dce266c7a)
[hridya: commit modified to only include ABI diff].
Signed-off-by: Hridya Valsaraju <hridya@google.com>
This commit is contained in:
Mayank Rana 2017-07-06 16:42:06 -07:00 committed by Hridya Valsaraju
parent cb57b8b85f
commit ea6eb0f3e5
3 changed files with 26 additions and 0 deletions

View File

@ -925,6 +925,22 @@ int extcon_register_notifier(struct extcon_dev *edev, unsigned int id,
}
EXPORT_SYMBOL_GPL(extcon_register_notifier);
int extcon_register_blocking_notifier(struct extcon_dev *edev, unsigned int id,
struct notifier_block *nb)
{
int idx = -EINVAL;
if (!edev || !nb)
return -EINVAL;
idx = find_cable_index_by_id(edev, id);
if (idx < 0)
return idx;
return blocking_notifier_chain_register(&edev->bnh[idx], nb);
}
EXPORT_SYMBOL(extcon_register_blocking_notifier);
/**
* extcon_unregister_notifier() - Unregister a notifier block from the extcon.
* @edev: the extcon device

View File

@ -48,6 +48,7 @@ struct extcon_dev {
struct device dev;
struct raw_notifier_head nh_all;
struct raw_notifier_head *nh;
struct blocking_notifier_head *bnh;
struct list_head entry;
int max_supported;
spinlock_t lock; /* could be called by irq handler */

View File

@ -208,6 +208,8 @@ extern int extcon_register_notifier(struct extcon_dev *edev, unsigned int id,
struct notifier_block *nb);
extern int extcon_unregister_notifier(struct extcon_dev *edev, unsigned int id,
struct notifier_block *nb);
extern int extcon_register_blocking_notifier(struct extcon_dev *edev,
unsigned int id, struct notifier_block *nb);
extern int devm_extcon_register_notifier(struct device *dev,
struct extcon_dev *edev, unsigned int id,
struct notifier_block *nb);
@ -268,6 +270,13 @@ static inline int extcon_unregister_notifier(struct extcon_dev *edev,
return 0;
}
static inline int extcon_register_blocking_notifier(struct extcon_dev *edev,
unsigned int id,
struct notifier_block *nb)
{
return 0;
}
static inline int devm_extcon_register_notifier(struct device *dev,
struct extcon_dev *edev, unsigned int id,
struct notifier_block *nb)