aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHuang Yiwei2020-12-25 04:07:37 -0600
committerTodd Kjos2021-01-04 13:10:23 -0600
commita34582feccd08890467f7d5a9009e332a912217f (patch)
tree86ff3e95622bb013e56bab5a186ccea6ed4d59ea
parent4eae6d1947bf494dbb97e2b45c76d40c5eb3ec6d (diff)
downloadkernel-a34582feccd08890467f7d5a9009e332a912217f.tar.gz
kernel-a34582feccd08890467f7d5a9009e332a912217f.tar.xz
kernel-a34582feccd08890467f7d5a9009e332a912217f.zip
ANDROID: rwsem: Export rwsem_waiter struct for loadable modules
The rwsem_waiter struct is needed in vendor hook alter_rwsem_list_add. It has parameter sem which is a struct rw_semaphore (already export in rwsem.h), inside the structure there is a wait_list to link "struct rwsem_waiter" items. The task information in each item of the wait_list is needed to be referenced in vendor loadable modules. Bug: 174902706 Signed-off-by: Huang Yiwei <hyiwei@codeaurora.org> Change-Id: Ic7d21ffdd795eaa203989751d26f8b1f32134d8b
-rw-r--r--include/linux/rwsem.h13
-rw-r--r--kernel/locking/rwsem.c12
2 files changed, 13 insertions, 12 deletions
diff --git a/include/linux/rwsem.h b/include/linux/rwsem.h
index 9248dc0b75a0..0d5b108a88d1 100644
--- a/include/linux/rwsem.h
+++ b/include/linux/rwsem.h
@@ -55,6 +55,19 @@ struct rw_semaphore {
55 ANDROID_VENDOR_DATA(1); 55 ANDROID_VENDOR_DATA(1);
56}; 56};
57 57
58enum rwsem_waiter_type {
59 RWSEM_WAITING_FOR_WRITE,
60 RWSEM_WAITING_FOR_READ
61};
62
63struct rwsem_waiter {
64 struct list_head list;
65 struct task_struct *task;
66 enum rwsem_waiter_type type;
67 unsigned long timeout;
68 unsigned long last_rowner;
69};
70
58/* In all implementations count != 0 means locked */ 71/* In all implementations count != 0 means locked */
59static inline int rwsem_is_locked(struct rw_semaphore *sem) 72static inline int rwsem_is_locked(struct rw_semaphore *sem)
60{ 73{
diff --git a/kernel/locking/rwsem.c b/kernel/locking/rwsem.c
index 46bb563f9a43..28e481fbcf5a 100644
--- a/kernel/locking/rwsem.c
+++ b/kernel/locking/rwsem.c
@@ -346,18 +346,6 @@ void __init_rwsem(struct rw_semaphore *sem, const char *name,
346} 346}
347EXPORT_SYMBOL(__init_rwsem); 347EXPORT_SYMBOL(__init_rwsem);
348 348
349enum rwsem_waiter_type {
350 RWSEM_WAITING_FOR_WRITE,
351 RWSEM_WAITING_FOR_READ
352};
353
354struct rwsem_waiter {
355 struct list_head list;
356 struct task_struct *task;
357 enum rwsem_waiter_type type;
358 unsigned long timeout;
359 unsigned long last_rowner;
360};
361#define rwsem_first_waiter(sem) \ 349#define rwsem_first_waiter(sem) \
362 list_first_entry(&sem->wait_list, struct rwsem_waiter, list) 350 list_first_entry(&sem->wait_list, struct rwsem_waiter, list)
363 351