Message ID | 20230911-topic-mars-v2-7-3dac84b88c4b@linaro.org (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | Venus cleanups | expand |
On Fri, Feb 09, 2024 at 10:09:51PM +0100, Konrad Dybcio wrote: > Nothing inside the resource struct needs to be mutable. Sprinkle > 'const' all over it. A lot of 'const'. We already have 'const struct venus_resources'. Is that not sufficient? Maybe it's just style, since the string arrays are const? > > Signed-off-by: Konrad Dybcio <konrad.dybcio@linaro.org> > --- > drivers/media/platform/qcom/venus/core.h | 58 ++++++++++++++++---------------- > 1 file changed, 29 insertions(+), 29 deletions(-) > > diff --git a/drivers/media/platform/qcom/venus/core.h b/drivers/media/platform/qcom/venus/core.h > index 6a77de374454..6b1887f7d9cb 100644 > --- a/drivers/media/platform/qcom/venus/core.h > +++ b/drivers/media/platform/qcom/venus/core.h > @@ -56,39 +56,39 @@ enum vpu_version { > }; > > struct venus_resources { > - u64 dma_mask; > - const struct freq_tbl *freq_tbl; > - unsigned int freq_tbl_size; > - const struct bw_tbl *bw_tbl_enc; > - unsigned int bw_tbl_enc_size; > - const struct bw_tbl *bw_tbl_dec; > - unsigned int bw_tbl_dec_size; > - const struct reg_val *reg_tbl; > - unsigned int reg_tbl_size; > - const struct hfi_ubwc_config *ubwc_conf; > + const u64 dma_mask; > + const struct freq_tbl * const freq_tbl; > + const unsigned int freq_tbl_size; > + const struct bw_tbl * const bw_tbl_enc; > + const unsigned int bw_tbl_enc_size; > + const struct bw_tbl * const bw_tbl_dec; > + const unsigned int bw_tbl_dec_size; > + const struct reg_val * const reg_tbl; > + const unsigned int reg_tbl_size; > + const struct hfi_ubwc_config * const ubwc_conf; > const char * const clks[VIDC_CLKS_NUM_MAX]; > - unsigned int clks_num; > + const unsigned int clks_num; > const char * const vcodec0_clks[VIDC_VCODEC_CLKS_NUM_MAX]; > const char * const vcodec1_clks[VIDC_VCODEC_CLKS_NUM_MAX]; > - unsigned int vcodec_clks_num; > - const char **vcodec_pmdomains; > - unsigned int vcodec_pmdomains_num; > - const char **opp_pmdomain; > - unsigned int vcodec_num; > + const unsigned int vcodec_clks_num; > + const char * const *vcodec_pmdomains; This doesn't error on: const char *pmdomains[] = { "venus", "vcodec0", "vcodec1" }; struct venus_resources res; res.vcodec_pmdomains = pmdomains; res.vcodec_pmdomains = NULL; > + const unsigned int vcodec_pmdomains_num; > + const char * const * const opp_pmdomain; > + const unsigned int vcodec_num; > const char * const resets[VIDC_RESETS_NUM_MAX]; > - unsigned int resets_num; > - enum hfi_version hfi_version; > - enum vpu_version vpu_version; > - u8 num_vpp_pipes; > - u32 max_load; > - unsigned int vmem_id; > - u32 vmem_size; > - u32 vmem_addr; > - u32 cp_start; > - u32 cp_size; > - u32 cp_nonpixel_start; > - u32 cp_nonpixel_size; > - const char *fwname; > + const unsigned int resets_num; > + const enum hfi_version hfi_version; > + const enum vpu_version vpu_version; > + const u8 num_vpp_pipes; > + const u32 max_load; > + const unsigned int vmem_id; > + const u32 vmem_size; > + const u32 vmem_addr; > + const u32 cp_start; > + const u32 cp_size; > + const u32 cp_nonpixel_start; > + const u32 cp_nonpixel_size; > + const char * const fwname; > }; > > enum venus_fmt { > > -- > 2.43.0 >
diff --git a/drivers/media/platform/qcom/venus/core.h b/drivers/media/platform/qcom/venus/core.h index 6a77de374454..6b1887f7d9cb 100644 --- a/drivers/media/platform/qcom/venus/core.h +++ b/drivers/media/platform/qcom/venus/core.h @@ -56,39 +56,39 @@ enum vpu_version { }; struct venus_resources { - u64 dma_mask; - const struct freq_tbl *freq_tbl; - unsigned int freq_tbl_size; - const struct bw_tbl *bw_tbl_enc; - unsigned int bw_tbl_enc_size; - const struct bw_tbl *bw_tbl_dec; - unsigned int bw_tbl_dec_size; - const struct reg_val *reg_tbl; - unsigned int reg_tbl_size; - const struct hfi_ubwc_config *ubwc_conf; + const u64 dma_mask; + const struct freq_tbl * const freq_tbl; + const unsigned int freq_tbl_size; + const struct bw_tbl * const bw_tbl_enc; + const unsigned int bw_tbl_enc_size; + const struct bw_tbl * const bw_tbl_dec; + const unsigned int bw_tbl_dec_size; + const struct reg_val * const reg_tbl; + const unsigned int reg_tbl_size; + const struct hfi_ubwc_config * const ubwc_conf; const char * const clks[VIDC_CLKS_NUM_MAX]; - unsigned int clks_num; + const unsigned int clks_num; const char * const vcodec0_clks[VIDC_VCODEC_CLKS_NUM_MAX]; const char * const vcodec1_clks[VIDC_VCODEC_CLKS_NUM_MAX]; - unsigned int vcodec_clks_num; - const char **vcodec_pmdomains; - unsigned int vcodec_pmdomains_num; - const char **opp_pmdomain; - unsigned int vcodec_num; + const unsigned int vcodec_clks_num; + const char * const *vcodec_pmdomains; + const unsigned int vcodec_pmdomains_num; + const char * const * const opp_pmdomain; + const unsigned int vcodec_num; const char * const resets[VIDC_RESETS_NUM_MAX]; - unsigned int resets_num; - enum hfi_version hfi_version; - enum vpu_version vpu_version; - u8 num_vpp_pipes; - u32 max_load; - unsigned int vmem_id; - u32 vmem_size; - u32 vmem_addr; - u32 cp_start; - u32 cp_size; - u32 cp_nonpixel_start; - u32 cp_nonpixel_size; - const char *fwname; + const unsigned int resets_num; + const enum hfi_version hfi_version; + const enum vpu_version vpu_version; + const u8 num_vpp_pipes; + const u32 max_load; + const unsigned int vmem_id; + const u32 vmem_size; + const u32 vmem_addr; + const u32 cp_start; + const u32 cp_size; + const u32 cp_nonpixel_start; + const u32 cp_nonpixel_size; + const char * const fwname; }; enum venus_fmt {
Nothing inside the resource struct needs to be mutable. Sprinkle 'const' all over it. A lot of 'const'. Signed-off-by: Konrad Dybcio <konrad.dybcio@linaro.org> --- drivers/media/platform/qcom/venus/core.h | 58 ++++++++++++++++---------------- 1 file changed, 29 insertions(+), 29 deletions(-)