From 0cc4c7b94aab188056fddf7d12e26cf22845d5cf Mon Sep 17 00:00:00 2001 From: Edgar Flores Date: Wed, 6 May 2020 12:32:08 -0700 Subject: [PATCH] msm: adsprpc: add support to print logs on VERIFY failures Add support for eng builds to print error logs when VERIFY statements fail. Driver needs to be recompiled with feature flag enabled. Change-Id: If3519003425bb40b3c653c88ed975f5a818c9bb2 Signed-off-by: Edgar Flores --- drivers/char/adsprpc.c | 8 ++++++++ drivers/char/adsprpc_shared.h | 8 +++++--- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/drivers/char/adsprpc.c b/drivers/char/adsprpc.c index 1b6f180bf011..42f3fa604a10 100644 --- a/drivers/char/adsprpc.c +++ b/drivers/char/adsprpc.c @@ -2,6 +2,14 @@ /* * Copyright (c) 2012-2020, The Linux Foundation. All rights reserved. */ + +/* Uncomment this block to log an error on every VERIFY failure */ +/* + * #ifndef VERIFY_PRINT_ERROR + * #define VERIFY_PRINT_ERROR + * #endif + */ + #include #include #include diff --git a/drivers/char/adsprpc_shared.h b/drivers/char/adsprpc_shared.h index 2e33bd5e14a6..2eafed739d23 100644 --- a/drivers/char/adsprpc_shared.h +++ b/drivers/char/adsprpc_shared.h @@ -105,8 +105,9 @@ #define REMOTE_SCALARS_MAKE(method, in, out) \ REMOTE_SCALARS_MAKEX(0, method, in, out, 0, 0) - -#ifndef VERIFY_PRINT_ERROR +#ifdef VERIFY_PRINT_ERROR +#define VERIFY_EPRINTF(format, ...) pr_err(format, ##__VA_ARGS__) +#else #define VERIFY_EPRINTF(format, args) (void)0 #endif @@ -118,13 +119,14 @@ #define __STR__(x) #x ":" #define __TOSTR__(x) __STR__(x) #define __FILE_LINE__ __FILE__ ":" __TOSTR__(__LINE__) +#define __ADSPRPC_LINE__ "adsprpc:" __TOSTR__(__LINE__) #define VERIFY(err, val) \ do {\ VERIFY_IPRINTF(__FILE_LINE__"info: calling: " #val "\n");\ if ((val) == 0) {\ (err) = (err) == 0 ? -1 : (err);\ - VERIFY_EPRINTF(__FILE_LINE__"error: %d: " #val "\n", (err));\ + VERIFY_EPRINTF(__ADSPRPC_LINE__" error: %d: "#val "\n", (err));\ } else {\ VERIFY_IPRINTF(__FILE_LINE__"info: passed: " #val "\n");\ } \