2022-02-11 04:54:57

by Rikard Falkeborn

[permalink] [raw]
Subject: [PATCH 0/3] drivers/crypto: Constify static attribute_group

This series constifies a couple of static attribute_group structs that
are not modified. This allows the compiler to put them in read-only
memory. The patches are independent and can be applied in any order (and
go through different trees if needed).

Rikard Falkeborn (3):
crypto: omap-aes - Constify static attribute_group
crypto: omap-sham - Constify static attribute_group
crypto/nx: Constify static attribute_group structs

drivers/crypto/nx/nx-common-pseries.c | 4 ++--
drivers/crypto/omap-aes.c | 2 +-
drivers/crypto/omap-sham.c | 2 +-
3 files changed, 4 insertions(+), 4 deletions(-)

--
2.35.1



2022-02-11 05:56:15

by Rikard Falkeborn

[permalink] [raw]
Subject: [PATCH 1/3] crypto: omap-aes - Constify static attribute_group

The only usage of omap_aes_attr_group is to pass its address to
sysfs_{create,remove}_group(), which takes pointers to const struct
attribute_group. Make it const to allow the compiler to put it in
read-only memory.

Signed-off-by: Rikard Falkeborn <[email protected]>
---
drivers/crypto/omap-aes.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/crypto/omap-aes.c b/drivers/crypto/omap-aes.c
index a196bb8b1701..581211a92628 100644
--- a/drivers/crypto/omap-aes.c
+++ b/drivers/crypto/omap-aes.c
@@ -1093,7 +1093,7 @@ static struct attribute *omap_aes_attrs[] = {
NULL,
};

-static struct attribute_group omap_aes_attr_group = {
+static const struct attribute_group omap_aes_attr_group = {
.attrs = omap_aes_attrs,
};

--
2.35.1