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:
parent
cb57b8b85f
commit
ea6eb0f3e5
3 changed files with 26 additions and 0 deletions
|
@ -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
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue