[PATCH] extcon: usbc-tusb320: Constify struct tusb320_ops
Christophe JAILLET <[email protected]>
| Newsgroups | org.kernel.vger.kernel-janitors,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <f0d7dbdc9794f13b424d3f6e21685d778ef31e5f.1786278909.git.christophe.jaillet@wanadoo.fr> |
'struct tusb320_ops' is not modified in these drivers. Constifying this structure moves some data to a read-only section, so increases overall security, especially when the structure holds some function pointers. On a x86_64, with allmodconfig: Before: ====== text data bss dec hex filename 19942 6128 64 26134 6616 drivers/extcon/extcon-usbc-tusb320.o After: ===== text data bss dec hex filename 19949 6000 64 26013 659d drivers/extcon/extcon-usbc-tusb320.o Signed-off-by: Christophe JAILLET <[email protected]> --- Compile tested only. --- drivers/extcon/extcon-usbc-tusb320.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/extcon/extcon-usbc-tusb320.c b/drivers/extcon/extcon-usbc-tusb320.c index 920b03421850..49176b166565 100644 --- a/drivers/extcon/extcon-usbc-tusb320.c +++ b/drivers/extcon/extcon-usbc-tusb320.c @@ -203,11 +203,11 @@ static int tusb320l_get_revision(struct tusb320_priv *priv, unsigned int *revisi return regmap_read(priv->regmap, TUSB320L_REGA0_REVISION, revision); } -static struct tusb320_ops tusb320_ops = { +static const struct tusb320_ops tusb320_ops = { .set_mode = tusb320_set_mode, }; -static struct tusb320_ops tusb320l_ops = { +static const struct tusb320_ops tusb320l_ops = { .set_mode = tusb320l_set_mode, .get_revision = tusb320l_get_revision, }; -- 2.55.0