[PATCH] ASoC: cs42l51: Constify struct i2c_device_id

Christophe JAILLET posted 1 patch 1 year, 2 months ago
sound/soc/codecs/cs42l51-i2c.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
[PATCH] ASoC: cs42l51: Constify struct i2c_device_id
Posted by Christophe JAILLET 1 year, 2 months ago
'struct i2c_device_id' is not modified in this driver.

Constifying this structure moves some data to a read-only section, so
increase overall security.

While at it, also add some space to be consistent with cs42l51_of_match a
few lines below.

On a x86_64, with allmodconfig:
Before:
======
   text	   data	    bss	    dec	    hex	filename
   1551	    384	     16	   1951	    79f	sound/soc/codecs/cs42l51-i2c.o

After:
=====
   text	   data	    bss	    dec	    hex	filename
   1631	    304	     16	   1951	    79f	sound/soc/codecs/cs42l51-i2c.o

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
Compile tested-only.
---
 sound/soc/codecs/cs42l51-i2c.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/sound/soc/codecs/cs42l51-i2c.c b/sound/soc/codecs/cs42l51-i2c.c
index e7cc50096297..f171bd66fcac 100644
--- a/sound/soc/codecs/cs42l51-i2c.c
+++ b/sound/soc/codecs/cs42l51-i2c.c
@@ -13,9 +13,9 @@
 
 #include "cs42l51.h"
 
-static struct i2c_device_id cs42l51_i2c_id[] = {
-	{"cs42l51"},
-	{}
+static const struct i2c_device_id cs42l51_i2c_id[] = {
+	{ "cs42l51" },
+	{ }
 };
 MODULE_DEVICE_TABLE(i2c, cs42l51_i2c_id);
 
-- 
2.47.0
Re: [PATCH] ASoC: cs42l51: Constify struct i2c_device_id
Posted by Mark Brown 1 year, 2 months ago
On Fri, 15 Nov 2024 17:54:25 +0100, Christophe JAILLET wrote:
> 'struct i2c_device_id' is not modified in this driver.
> 
> Constifying this structure moves some data to a read-only section, so
> increase overall security.
> 
> While at it, also add some space to be consistent with cs42l51_of_match a
> few lines below.
> 
> [...]

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next

Thanks!

[1/1] ASoC: cs42l51: Constify struct i2c_device_id
      commit: 3787255c967ba64dc72adc3038f0cb81211bd297

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark