Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ea6eb0f3 authored by Mayank Rana's avatar Mayank Rana Committed by Hridya Valsaraju
Browse files

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: default avatarMayank Rana <mrana@codeaurora.org>
Signed-off-by: default avatarJack Pham <jackp@codeaurora.org>
Change-Id: I28d56bd898beea1da1f8c315602cc404e8bc326f
(cherry picked from commit 9dce266c)
[hridya: commit modified to only include ABI diff].
Signed-off-by: default avatarHridya Valsaraju <hridya@google.com>
parent cb57b8b8
Loading
Loading
Loading
Loading
+16 −0
Original line number Diff line number Diff line
@@ -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
+1 −0
Original line number Diff line number Diff line
@@ -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 */
+9 −0
Original line number Diff line number Diff line
@@ -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)