msm: rtb: Separate initialization from enablement
The buffers for rtb are not set up immediately at boot time. If a client tries to log into the buffer before these are set up, rtb quietly exits. If enable is set on the command line, rtb will try to log before the buffer is set up, causing crashes. Fix this by creating a separate initialized variable to indicate when the rtb buffer is set up. Change-Id: Ia038347cd4b389cd0c82ac308c632404e000b17c Signed-off-by: Laura Abbott <lauraa@codeaurora.org>
This commit is contained in:
@@ -54,6 +54,7 @@ struct msm_rtb_state {
|
||||
int nentries;
|
||||
int size;
|
||||
int enabled;
|
||||
int initialized;
|
||||
uint32_t filter;
|
||||
int step_size;
|
||||
};
|
||||
@@ -66,6 +67,7 @@ static atomic_t msm_rtb_idx;
|
||||
|
||||
struct msm_rtb_state msm_rtb = {
|
||||
.filter = 1 << LOGK_LOGBUF,
|
||||
.enabled = 1,
|
||||
};
|
||||
|
||||
module_param_named(filter, msm_rtb.filter, uint, 0644);
|
||||
@@ -73,7 +75,7 @@ module_param_named(enable, msm_rtb.enabled, int, 0644);
|
||||
|
||||
int msm_rtb_event_should_log(enum logk_event_type log_type)
|
||||
{
|
||||
return msm_rtb.enabled &&
|
||||
return msm_rtb.initialized && msm_rtb.enabled &&
|
||||
((1 << log_type) & msm_rtb.filter);
|
||||
}
|
||||
EXPORT_SYMBOL(msm_rtb_event_should_log);
|
||||
@@ -217,7 +219,7 @@ int msm_rtb_probe(struct platform_device *pdev)
|
||||
#endif
|
||||
|
||||
|
||||
msm_rtb.enabled = 1;
|
||||
msm_rtb.initialized = 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user