* [PATCH] PM: Constify static struct attribute_group
@ 2021-02-01 22:57 Rikard Falkeborn
2021-02-12 15:48 ` Rafael J. Wysocki
0 siblings, 1 reply; 2+ messages in thread
From: Rikard Falkeborn @ 2021-02-01 22:57 UTC (permalink / raw)
To: Rafael J. Wysocki, Len Brown, Pavel Machek
Cc: linux-pm, linux-kernel, Rikard Falkeborn
The only usage of suspend_attr_group is to put its address in an array of
pointers to const attribute_group structs. Make it const to allow the
compiler to put it in read-only memory.
Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com>
---
kernel/power/main.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/power/main.c b/kernel/power/main.c
index 0aefd6f57e0a..12c7e1bb442f 100644
--- a/kernel/power/main.c
+++ b/kernel/power/main.c
@@ -387,7 +387,7 @@ static struct attribute *suspend_attrs[] = {
NULL,
};
-static struct attribute_group suspend_attr_group = {
+static const struct attribute_group suspend_attr_group = {
.name = "suspend_stats",
.attrs = suspend_attrs,
};
--
2.30.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] PM: Constify static struct attribute_group
2021-02-01 22:57 [PATCH] PM: Constify static struct attribute_group Rikard Falkeborn
@ 2021-02-12 15:48 ` Rafael J. Wysocki
0 siblings, 0 replies; 2+ messages in thread
From: Rafael J. Wysocki @ 2021-02-12 15:48 UTC (permalink / raw)
To: Rikard Falkeborn
Cc: Rafael J. Wysocki, Len Brown, Pavel Machek, Linux PM,
Linux Kernel Mailing List
On Mon, Feb 1, 2021 at 11:58 PM Rikard Falkeborn
<rikard.falkeborn@gmail.com> wrote:
>
> The only usage of suspend_attr_group is to put its address in an array of
> pointers to const attribute_group structs. Make it const to allow the
> compiler to put it in read-only memory.
>
> Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com>
> ---
> kernel/power/main.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/kernel/power/main.c b/kernel/power/main.c
> index 0aefd6f57e0a..12c7e1bb442f 100644
> --- a/kernel/power/main.c
> +++ b/kernel/power/main.c
> @@ -387,7 +387,7 @@ static struct attribute *suspend_attrs[] = {
> NULL,
> };
>
> -static struct attribute_group suspend_attr_group = {
> +static const struct attribute_group suspend_attr_group = {
> .name = "suspend_stats",
> .attrs = suspend_attrs,
> };
> --
Applied as 5.12 material, thanks!
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-02-12 15:49 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-01 22:57 [PATCH] PM: Constify static struct attribute_group Rikard Falkeborn
2021-02-12 15:48 ` Rafael J. Wysocki
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).