Skip to content

Commit

Permalink
binder: Stub out debug prints by default
Browse files Browse the repository at this point in the history
Binder code is very hot, so checking frequently to see if a debug
message should be printed is a waste of cycles. We're not debugging
binder, so just stub out the debug prints to compile them out entirely.

Signed-off-by: Sultan Alsawaf <sultan@kerneltoast.com>
Change-Id: I66ac2d22bbc8943976b4dffa742e55b4e118d042
Signed-off-by: Helium-Studio <67852324+Helium-Studio@users.noreply.github.com>
Signed-off-by: onettboots <blackcocopet@gmail.com>
  • Loading branch information
kerneltoast authored and onettboots committed May 26, 2024
1 parent 4483b60 commit 78da344
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions drivers/android/binder.c
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ static int binder_set_stop_on_user_error(const char *val,
module_param_call(stop_on_user_error, binder_set_stop_on_user_error,
param_get_int, &binder_stop_on_user_error, 0644);

#ifdef DEBUG
#define binder_debug(mask, x...) \
do { \
if (binder_debug_mask & mask) \
Expand All @@ -157,6 +158,16 @@ module_param_call(stop_on_user_error, binder_set_stop_on_user_error,
if (binder_stop_on_user_error) \
binder_stop_on_user_error = 2; \
} while (0)
#else
static inline void binder_debug(uint32_t mask, const char *fmt, ...)
{
}
static inline void binder_user_error(const char *fmt, ...)
{
if (binder_stop_on_user_error)
binder_stop_on_user_error = 2;
}
#endif

#define to_flat_binder_object(hdr) \
container_of(hdr, struct flat_binder_object, hdr)
Expand Down

0 comments on commit 78da344

Please sign in to comment.