ANDROID: GKI: panic: add vendor callback function in panic()

Each vendor might want to implement some debug code when the kernel
panics. So, add a vendor_panic_cb callback for vendors to implement.

Bug: 149258398
Test: compile
Change-Id: I7a374b0089f72c2511db6fe3b8cdd18f41a1eb6c
Signed-off-by: Saravana Kannan <saravanak@google.com>
(cherry picked from commit 911d9c70c2c50b0383ed0b652bb84ca8832e4a2b)
Signed-off-by: Will McVicker <willmcvicker@google.com>
[willmcvicker: only pulled in the ABI diffs]
This commit is contained in:
Will McVicker
2020-04-13 17:12:00 -07:00
committed by Will Mcvicker
parent 7de8e1e424
commit 56ebfff5eb
2 changed files with 6 additions and 1 deletions

View File

@@ -323,6 +323,7 @@ static inline void might_fault(void) { }
#endif
extern struct atomic_notifier_head panic_notifier_list;
extern void (*vendor_panic_cb)(u64 sp);
extern long (*panic_blink)(int state);
__printf(1, 2)
void panic(const char *fmt, ...) __noreturn __cold;

View File

@@ -47,9 +47,11 @@ int panic_timeout = CONFIG_PANIC_TIMEOUT;
EXPORT_SYMBOL_GPL(panic_timeout);
ATOMIC_NOTIFIER_HEAD(panic_notifier_list);
EXPORT_SYMBOL(panic_notifier_list);
void (*vendor_panic_cb)(u64 sp);
EXPORT_SYMBOL_GPL(vendor_panic_cb);
static long no_blink(int state)
{
return 0;
@@ -177,6 +179,8 @@ void panic(const char *fmt, ...)
va_start(args, fmt);
vsnprintf(buf, sizeof(buf), fmt, args);
va_end(args);
if (vendor_panic_cb)
vendor_panic_cb(0);
pr_emerg("Kernel panic - not syncing: %s\n", buf);
#ifdef CONFIG_DEBUG_BUGVERBOSE
/*