mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-08 11:50:43 +09:00
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 9dce266c7ad8f075f3b7b13cbbb99e058e57d30b) [hridya: commit modified to only include ABI diff]. Signed-off-by: Hridya Valsaraju <hridya@google.com>
This commit is contained in:
committed by
Hridya Valsaraju
parent
cb57b8b85f
commit
ea6eb0f3e5
@@ -925,6 +925,22 @@ int extcon_register_notifier(struct extcon_dev *edev, unsigned int id,
|
|||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(extcon_register_notifier);
|
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.
|
* extcon_unregister_notifier() - Unregister a notifier block from the extcon.
|
||||||
* @edev: the extcon device
|
* @edev: the extcon device
|
||||||
|
|||||||
@@ -48,6 +48,7 @@ struct extcon_dev {
|
|||||||
struct device dev;
|
struct device dev;
|
||||||
struct raw_notifier_head nh_all;
|
struct raw_notifier_head nh_all;
|
||||||
struct raw_notifier_head *nh;
|
struct raw_notifier_head *nh;
|
||||||
|
struct blocking_notifier_head *bnh;
|
||||||
struct list_head entry;
|
struct list_head entry;
|
||||||
int max_supported;
|
int max_supported;
|
||||||
spinlock_t lock; /* could be called by irq handler */
|
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);
|
struct notifier_block *nb);
|
||||||
extern int extcon_unregister_notifier(struct extcon_dev *edev, unsigned int id,
|
extern int extcon_unregister_notifier(struct extcon_dev *edev, unsigned int id,
|
||||||
struct notifier_block *nb);
|
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,
|
extern int devm_extcon_register_notifier(struct device *dev,
|
||||||
struct extcon_dev *edev, unsigned int id,
|
struct extcon_dev *edev, unsigned int id,
|
||||||
struct notifier_block *nb);
|
struct notifier_block *nb);
|
||||||
@@ -268,6 +270,13 @@ static inline int extcon_unregister_notifier(struct extcon_dev *edev,
|
|||||||
return 0;
|
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,
|
static inline int devm_extcon_register_notifier(struct device *dev,
|
||||||
struct extcon_dev *edev, unsigned int id,
|
struct extcon_dev *edev, unsigned int id,
|
||||||
struct notifier_block *nb)
|
struct notifier_block *nb)
|
||||||
|
|||||||
Reference in New Issue
Block a user