lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZdVK-4S7XX_m9vBJ@radian>
Date: Tue, 20 Feb 2024 19:59:39 -0500
From: Richard Acayan <mailingradian@...il.com>
To: Konrad Dybcio <konrad.dybcio@...aro.org>
Cc: Stanimir Varbanov <stanimir.k.varbanov@...il.com>,
	Vikash Garodia <quic_vgarodia@...cinc.com>,
	Bryan O'Donoghue <bryan.odonoghue@...aro.org>,
	Andy Gross <agross@...nel.org>,
	Bjorn Andersson <andersson@...nel.org>,
	Mauro Carvalho Chehab <mchehab@...nel.org>,
	Dikshita Agarwal <quic_dikshita@...cinc.com>,
	Philipp Zabel <p.zabel@...gutronix.de>,
	Marijn Suijten <marijn.suijten@...ainline.org>,
	Stanimir Varbanov <stanimir.varbanov@...aro.org>,
	Mauro Carvalho Chehab <mchehab+huawei@...nel.org>,
	linux-media@...r.kernel.org, linux-arm-msm@...r.kernel.org,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 07/20] media: venus: core: Constify all members of the
 resource struct

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@...aro.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
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ