media: Constify struct regmap_config
Subsystems (2)
cover media: Constify struct regmap_config
This series adds the const modifier to the remaining regmap_config structs under media/ that are effectively used as const (i.e., only read after their declaration), but kept as writtable data.
---
Javier Carrasco (2):
media: i2c: tvp5150: Constify struct regmap_config
media: platform: allegro-dvt: Constify struct regmap_config
drivers/media/i2c/tvp5150.c | 2 +- drivers/media/platform/allegro-dvt/allegro-core.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-)
---
base-commit: 0b58e108042b0ed28a71cd7edf5175999955b233
change-id: 20240705-media-const-regmap_config-958dfd37063c
Best regards,
Signature · 1 line
Javier Carrasco <[email protected]>
PATCH 1/2 media: i2c: tvp5150: Constify struct regmap_config
tvp5150_config is not modified and can be declared as const to move its data to a read-only section.
--- drivers/media/i2c/tvp5150.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/i2c/tvp5150.c +1 -1
@@ -1812,7 +1812,7 @@ static const struct regmap_access_table tvp5150_readable_table = { .n_yes_ranges = ARRAY_SIZE(tvp5150_readable_ranges), }; -static struct regmap_config tvp5150_config = { +static const struct regmap_config tvp5150_config = { .reg_bits =8 , .val_bits =8 , .max_register =0xff ,
Signature · 1 line
2.40.1
Re: [PATCH 1/2] media: i2c: tvp5150: Constify struct regmap_config
Quoted 2 lines · Javier Carrasco
tvp5150_configis not modified and can be declared as const to move its data to a read-only section.
This is a duplicate of:
I'll take that one since that also constifies i2c_vbi_ram_value.
Regards,
Hans
Quoted 20 lines
Signed-off-by Javier Carrasco <[email protected]>--- drivers/media/i2c/tvp5150.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/media/i2c/tvp5150.c +1
-1@@ -1812,7 +1812,7 @@ static const struct regmap_access_table tvp5150_readable_table = { .n_yes_ranges = ARRAY_SIZE(tvp5150_readable_ranges), }; -static struct regmap_config tvp5150_config = { +static const struct regmap_config tvp5150_config = { .reg_bits =8 , .val_bits =8 , .max_register =0xff ,
PATCH 2/2 media: platform: allegro-dvt: Constify struct regmap_config
In reply to Javier Carrascoallegro_regmap_config and allegro_sram_config are not modified and can be declared as const to move their data to a read-only section.
--- drivers/media/platform/allegro-dvt/allegro-core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/media/platform/allegro-dvt/allegro-core.c +2 -2
@@ -179,7 +179,7 @@ struct allegro_dev {struct list_head channels; }; -static struct regmap_config allegro_regmap_config = { +static const struct regmap_config allegro_regmap_config = { .name ="regmap" , .reg_bits =32 , .val_bits =32 ,
@@ -188,7 +188,7 @@ static struct regmap_config allegro_regmap_config = { .cache_type = REGCACHE_NONE, }; -static struct regmap_config allegro_sram_config = { +static const struct regmap_config allegro_sram_config = { .name ="sram" , .reg_bits =32 , .val_bits =32 ,
Signature · 1 line
2.40.1
Michael Tretter
maintainerRe: [PATCH 2/2] media: platform: allegro-dvt: Constify struct regmap_config
Quoted 2 lines · Javier Carrasco
allegro_regmap_configandallegro_sram_configare not modified and can be declared as const to move their data to a read-only section.
Christophe sent a similar patch [0] before, which already has my Reviewed-by.
Michael
Quoted 33 lines
Signed-off-by Javier Carrasco <[email protected]>--- drivers/media/platform/allegro-dvt/allegro-core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/media/platform/allegro-dvt/allegro-core.c +2
-2@@ -179,7 +179,7 @@ struct allegro_dev {struct list_head channels; }; -static struct regmap_config allegro_regmap_config = { +static const struct regmap_config allegro_regmap_config = { .name ="regmap" , .reg_bits =32 , .val_bits =32 ,@@ -188,7 +188,7 @@ static struct regmap_config allegro_regmap_config = { .cache_type = REGCACHE_NONE, }; -static struct regmap_config allegro_sram_config = { +static const struct regmap_config allegro_sram_config = { .name ="sram" , .reg_bits =32 , .val_bits =32 ,Signature · 2 lines
-- 2.40.1