Skip to content

Binder driver refactor and minor bug fixes

Riley Andrews lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest13 patches 4 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/13drivers: android: correct the size of struct binder_uintptr_t for BC_DEAD_BINDER_DONEdrivers/android/binder.c+1 -11 reply
2/13android: binder: fix duplicate error return.drivers/android/binder.c+1 -10 replies
3/13android: binder: refactor binder_thread_writedrivers/android/binder.c+350 -2631 reply
4/13android: binder: refactor binder_transact handle translationdrivers/android/binder.c+167 -1440 replies
5/13android: binder: refactor binder_transact transaction buffer loopdrivers/android/binder.c+77 -511 reply
6/13android: binder: add function to find target binder nodedrivers/android/binder.c+27 -190 replies
7/13android: binder: add functions for manipulating transaction stackdrivers/android/binder.c+79 -470 replies
8/13android: binder: add function for logging failed transactionsdrivers/android/binder.c+11 -70 replies
9/13android: binder: add function for finding prior thread in transaction stackdrivers/android/binder.c+15 -80 replies
10/13android: binder: refactor binder_thread_read loopdrivers/android/binder.c+231 -2020 replies
11/13android: binder: add function to handle waiting for binder_thread_readdrivers/android/binder.c+66 -380 replies
12/13android: binder: add function to pass thread errors to userspacedrivers/android/binder.c+34 -170 replies
13/13android: binder: add function for processing work nodes in binder_thread_readdrivers/android/binder.c+56 -401 reply

Reviews trailers per patch

1 of 13 patches has a Reviewed-by or Acked-by.

PatchDan Carpenter
1/13
2/13
3/13R-b
4/13
5/13
6/13
7/13
8/13
9/13
10/13
11/13
12/13
13/13

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH 0/13] Binder driver refactor and minor bug fixes

This patch series is a cleanup of the binder driver which should make it more maintainable. That being said, the first two patches in this patch set are simple bug fixes, one fixing an issue with 64 bit, the other removing an instance where an error code could be returned twice. Both are fairly straightforward.

The bulk of the refactoring patches involve splitting up the larger functions in the binder driver: binder_thread_write, binder_thread_read, and binder_transaction. These functions all had switch statements which are now split up into a function per case statement. Other smaller changes split off related bits of functionality from binder_transaction() and binder_thread_read(), hopefully pruning these functions down to a point where their purpose is more clear.

(1) Fix two bugs:
- 64 bit user pointer issue
- error value can get returned to userspace twice

(2) Split binder_thread_write() into smaller functions.
- move all cases into dedicated functions

(3) Split apart binder_transaction().
- move flat binder object translation loop into a separate function, and break every case into a dedicated function.
- add helper functions to move complexity out of binder_transaction() for transaction stack, logging, etc.

(4) Split binder_thread_read() into smaller functions.
- move all cases into dedicated functions
- add helper functions for waiting for work, processing work nodes, and handling errors.