From 8165a6c24551478d4aa6b6123e0a7603961e9204 Mon Sep 17 00:00:00 2001 From: Aidan MacDonald Date: Sat, 3 Dec 2022 15:04:06 +0000 Subject: rbcodec dsp: Remove INIT_ATTR from the DSP library All of these are technically unsafe cross-section references but most aren't reported by the linker, probably due to inlining. In practice there was no problem because the affected code was only run at init time anyway. For now, remove INIT_ATTR until the init code can be refactored to avoid the problematic references. This should also save code size by moving more code to the init section. dsp_init() gets to keep its attribute because it's already OK. Change-Id: Idc9ac0e02cb07f31d186686e0382275c02a85dbb --- lib/rbcodec/dsp/dsp_core.c | 2 +- lib/rbcodec/dsp/dsp_core.h | 2 +- lib/rbcodec/dsp/dsp_misc.c | 3 +-- lib/rbcodec/dsp/dsp_sample_input.c | 8 ++++---- lib/rbcodec/dsp/dsp_sample_output.c | 2 +- lib/rbcodec/dsp/resample.c | 8 ++++---- lib/rbcodec/dsp/tdspeed.c | 4 ++-- 7 files changed, 14 insertions(+), 15 deletions(-) (limited to 'lib/rbcodec/dsp') diff --git a/lib/rbcodec/dsp/dsp_core.c b/lib/rbcodec/dsp/dsp_core.c index 5a08ce8e37..3e72322ea6 100644 --- a/lib/rbcodec/dsp/dsp_core.c +++ b/lib/rbcodec/dsp/dsp_core.c @@ -505,7 +505,7 @@ enum dsp_ids dsp_get_id(const struct dsp_config *dsp) /* Do what needs initializing before enable/disable calls can be made. * Must be done before changing settings for the first time. */ -void INIT_ATTR dsp_init(void) +void dsp_init(void) { static const uint8_t slot_count[DSP_COUNT] INITDATA_ATTR = { diff --git a/lib/rbcodec/dsp/dsp_core.h b/lib/rbcodec/dsp/dsp_core.h index 0f63b62e00..e18d045056 100644 --- a/lib/rbcodec/dsp/dsp_core.h +++ b/lib/rbcodec/dsp/dsp_core.h @@ -144,6 +144,6 @@ intptr_t dsp_configure(struct dsp_config *dsp, unsigned int setting, intptr_t value); /* One-time startup init that must come before settings reset/apply */ -void dsp_init(void); +void dsp_init(void) INIT_ATTR; #endif /* _DSP_H */ diff --git a/lib/rbcodec/dsp/dsp_misc.c b/lib/rbcodec/dsp/dsp_misc.c index ad6f5b5b31..83e577935b 100644 --- a/lib/rbcodec/dsp/dsp_misc.c +++ b/lib/rbcodec/dsp/dsp_misc.c @@ -149,8 +149,7 @@ unsigned int dsp_get_output_frequency(struct dsp_config *dsp) return dsp_configure(dsp, DSP_GET_OUT_FREQUENCY, 0); } -static void INIT_ATTR misc_dsp_init(struct dsp_config *dsp, - enum dsp_ids dsp_id) +static void misc_dsp_init(struct dsp_config *dsp, enum dsp_ids dsp_id) { /* Enable us for the audio DSP at startup */ if (dsp_id == CODEC_IDX_AUDIO) diff --git a/lib/rbcodec/dsp/dsp_sample_input.c b/lib/rbcodec/dsp/dsp_sample_input.c index 537a659b73..c57f81bb4f 100644 --- a/lib/rbcodec/dsp/dsp_sample_input.c +++ b/lib/rbcodec/dsp/dsp_sample_input.c @@ -257,8 +257,8 @@ static void dsp_sample_input_flush(struct sample_io_data *this) this->sample_buf.remcount = 0; } -static void INIT_ATTR dsp_sample_input_init(struct sample_io_data *this, - enum dsp_ids dsp_id) +static void dsp_sample_input_init(struct sample_io_data *this, + enum dsp_ids dsp_id) { int32_t *lbuf, *rbuf; @@ -283,8 +283,8 @@ static void INIT_ATTR dsp_sample_input_init(struct sample_io_data *this, this->sample_buf_p[1] = rbuf; } -static void INIT_ATTR dsp_sample_io_init(struct sample_io_data *this, - enum dsp_ids dsp_id) +static void dsp_sample_io_init(struct sample_io_data *this, + enum dsp_ids dsp_id) { this->output_sampr = DSP_OUT_DEFAULT_HZ; dsp_sample_input_init(this, dsp_id); diff --git a/lib/rbcodec/dsp/dsp_sample_output.c b/lib/rbcodec/dsp/dsp_sample_output.c index 65cd7ccf15..705a498a58 100644 --- a/lib/rbcodec/dsp/dsp_sample_output.c +++ b/lib/rbcodec/dsp/dsp_sample_output.c @@ -181,7 +181,7 @@ void dsp_sample_output_format_change(struct sample_io_data *this, this->output_version = format->version; } -void INIT_ATTR dsp_sample_output_init(struct sample_io_data *this) +void dsp_sample_output_init(struct sample_io_data *this) { this->output_version = 0; this->output_samples = sample_output_stereo; diff --git a/lib/rbcodec/dsp/resample.c b/lib/rbcodec/dsp/resample.c index 0a97bdf70c..a583f60a55 100644 --- a/lib/rbcodec/dsp/resample.c +++ b/lib/rbcodec/dsp/resample.c @@ -262,8 +262,8 @@ static intptr_t resample_new_format(struct dsp_proc_entry *this, return PROC_NEW_FORMAT_DEACTIVATED; } -static void INIT_ATTR resample_dsp_init(struct dsp_config *dsp, - enum dsp_ids dsp_id) +static void resample_dsp_init(struct dsp_config *dsp, + enum dsp_ids dsp_id) { int32_t *lbuf, *rbuf; @@ -291,8 +291,8 @@ static void INIT_ATTR resample_dsp_init(struct dsp_config *dsp, resample_data[dsp_id].resample_out_p[1] = rbuf; } -static void INIT_ATTR resample_proc_init(struct dsp_proc_entry *this, - struct dsp_config *dsp) +static void resample_proc_init(struct dsp_proc_entry *this, + struct dsp_config *dsp) { struct resample_data *data = &resample_data[dsp_get_id(dsp)]; this->data = (intptr_t)data; diff --git a/lib/rbcodec/dsp/tdspeed.c b/lib/rbcodec/dsp/tdspeed.c index 64cbaf5e12..7a9d818f19 100644 --- a/lib/rbcodec/dsp/tdspeed.c +++ b/lib/rbcodec/dsp/tdspeed.c @@ -521,8 +521,8 @@ static intptr_t tdspeed_new_format(struct dsp_proc_entry *this, (void)this; } -static void INIT_ATTR tdspeed_dsp_init(struct tdspeed_state_s *st, - enum dsp_ids dsp_id) +static void tdspeed_dsp_init(struct tdspeed_state_s *st, + enum dsp_ids dsp_id) { /* everything is at 100% until dsp_set_timestretch is called with some other value and timestretch is enabled at the time */ -- cgit v1.2.3