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 <edgarf@codeaurora.org>
This commit is contained in:
Edgar Flores 2020-05-06 12:32:08 -07:00 committed by Gerrit - the friendly Code Review server
parent 53badd7fe5
commit 0cc4c7b94a
2 changed files with 13 additions and 3 deletions

View File

@ -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 <linux/dma-buf.h>
#include <linux/dma-mapping.h>
#include <linux/slab.h>

View File

@ -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");\
} \