[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87tud5rk8o.fsf@dja-thinkpad.axtens.net>
Date: Fri, 11 Feb 2022 17:27:19 +1100
From: Daniel Axtens <dja@...ens.net>
To: Rikard Falkeborn <rikard.falkeborn@...il.com>,
Herbert Xu <herbert@...dor.apana.org.au>,
"David S. Miller" <davem@...emloft.net>,
Michael Ellerman <mpe@...erman.id.au>,
Benjamin Herrenschmidt <benh@...nel.crashing.org>,
Paul Mackerras <paulus@...ba.org>
Cc: linuxppc-dev@...ts.ozlabs.org, linux-crypto@...r.kernel.org,
Rikard Falkeborn <rikard.falkeborn@...il.com>,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH 3/3] crypto/nx: Constify static attribute_group structs
Hi Rikard,
> The only usage of these is to pass their address to
> sysfs_{create,remove}_group(), which takes pointers to const struct
> attribute_group. Make them const to allow the compiler to put them in
> read-only memory.
I checked the file. Indeed, those structs are only used in
sysfs_{create,remove}_group. So I agree that they can be constified.
They also pass all the automated tests:
https://patchwork.ozlabs.org/project/linuxppc-dev/patch/20220210202805.7750-4-rikard.falkeborn@gmail.com/
Reviewed-by: Daniel Axtens <dja@...ens.net>
Kind regards,
Daniel
>
> Signed-off-by: Rikard Falkeborn <rikard.falkeborn@...il.com>
> ---
> drivers/crypto/nx/nx-common-pseries.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/crypto/nx/nx-common-pseries.c b/drivers/crypto/nx/nx-common-pseries.c
> index 4e304f6081e4..7584a34ba88c 100644
> --- a/drivers/crypto/nx/nx-common-pseries.c
> +++ b/drivers/crypto/nx/nx-common-pseries.c
> @@ -962,7 +962,7 @@ static struct attribute *nx842_sysfs_entries[] = {
> NULL,
> };
>
> -static struct attribute_group nx842_attribute_group = {
> +static const struct attribute_group nx842_attribute_group = {
> .name = NULL, /* put in device directory */
> .attrs = nx842_sysfs_entries,
> };
> @@ -992,7 +992,7 @@ static struct attribute *nxcop_caps_sysfs_entries[] = {
> NULL,
> };
>
> -static struct attribute_group nxcop_caps_attr_group = {
> +static const struct attribute_group nxcop_caps_attr_group = {
> .name = "nx_gzip_caps",
> .attrs = nxcop_caps_sysfs_entries,
> };
> --
> 2.35.1
Powered by blists - more mailing lists