* [PATCH 0/4] platform/x86: Constify static attribute_group structs
@ 2021-06-05 20:38 Rikard Falkeborn
2021-06-05 20:38 ` [PATCH 1/4] platform/x86: hdaps: Constify static attribute_group struct Rikard Falkeborn
` (4 more replies)
0 siblings, 5 replies; 8+ messages in thread
From: Rikard Falkeborn @ 2021-06-05 20:38 UTC (permalink / raw)
To: Hans de Goede, Mark Gross, Frank Seidel, David E. Box, Justin Ernst
Cc: Alexander Duyck, platform-driver-x86, linux-kernel, Mike Travis,
Rikard Falkeborn
Constify a couple of static attribute_group structs which are never
modified to allow the compiler to put them in read-only memory.
Rikard Falkeborn (4):
platform/x86: hdaps: Constify static attribute_group struct
platform/x86: intel_pmt_crashlog: Constify static attribute_group
struct
platform/x86: tc1100-wmi: Constify static attribute_group struct
x86/platform/uv: Constify static attribute_group struct
drivers/platform/x86/hdaps.c | 2 +-
drivers/platform/x86/intel_pmt_crashlog.c | 2 +-
drivers/platform/x86/tc1100-wmi.c | 2 +-
drivers/platform/x86/uv_sysfs.c | 4 ++--
4 files changed, 5 insertions(+), 5 deletions(-)
--
2.31.1
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 1/4] platform/x86: hdaps: Constify static attribute_group struct
2021-06-05 20:38 [PATCH 0/4] platform/x86: Constify static attribute_group structs Rikard Falkeborn
@ 2021-06-05 20:38 ` Rikard Falkeborn
2021-06-07 16:21 ` Frank Seidel
2021-06-05 20:38 ` [PATCH 2/4] platform/x86: intel_pmt_crashlog: " Rikard Falkeborn
` (3 subsequent siblings)
4 siblings, 1 reply; 8+ messages in thread
From: Rikard Falkeborn @ 2021-06-05 20:38 UTC (permalink / raw)
To: Hans de Goede, Mark Gross, Frank Seidel, David E. Box, Justin Ernst
Cc: Alexander Duyck, platform-driver-x86, linux-kernel, Mike Travis,
Rikard Falkeborn
The only use of hdaps_attribute_group is to pass its address to
sysfs_create_group() and sysfs_remove_group(), both which takes 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>
---
drivers/platform/x86/hdaps.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/platform/x86/hdaps.c b/drivers/platform/x86/hdaps.c
index a72270932ec3..9996485f5295 100644
--- a/drivers/platform/x86/hdaps.c
+++ b/drivers/platform/x86/hdaps.c
@@ -462,7 +462,7 @@ static struct attribute *hdaps_attributes[] = {
NULL,
};
-static struct attribute_group hdaps_attribute_group = {
+static const struct attribute_group hdaps_attribute_group = {
.attrs = hdaps_attributes,
};
--
2.31.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 2/4] platform/x86: intel_pmt_crashlog: Constify static attribute_group struct
2021-06-05 20:38 [PATCH 0/4] platform/x86: Constify static attribute_group structs Rikard Falkeborn
2021-06-05 20:38 ` [PATCH 1/4] platform/x86: hdaps: Constify static attribute_group struct Rikard Falkeborn
@ 2021-06-05 20:38 ` Rikard Falkeborn
2021-06-05 20:38 ` [PATCH 3/4] platform/x86: tc1100-wmi: " Rikard Falkeborn
` (2 subsequent siblings)
4 siblings, 0 replies; 8+ messages in thread
From: Rikard Falkeborn @ 2021-06-05 20:38 UTC (permalink / raw)
To: Hans de Goede, Mark Gross, Frank Seidel, David E. Box, Justin Ernst
Cc: Alexander Duyck, platform-driver-x86, linux-kernel, Mike Travis,
Rikard Falkeborn
The only use of pmt_crashlog_group is to assign its address to the
attr_grp field in the intel_pmt_namespace struct, which is a pointer to
const attribute_group. Make it const to allow the compiler to put it in
read-only memory.
Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com>
---
drivers/platform/x86/intel_pmt_crashlog.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/platform/x86/intel_pmt_crashlog.c b/drivers/platform/x86/intel_pmt_crashlog.c
index 92d315a16cfd..56963ceb6345 100644
--- a/drivers/platform/x86/intel_pmt_crashlog.c
+++ b/drivers/platform/x86/intel_pmt_crashlog.c
@@ -218,7 +218,7 @@ static struct attribute *pmt_crashlog_attrs[] = {
NULL
};
-static struct attribute_group pmt_crashlog_group = {
+static const struct attribute_group pmt_crashlog_group = {
.attrs = pmt_crashlog_attrs,
};
--
2.31.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 3/4] platform/x86: tc1100-wmi: Constify static attribute_group struct
2021-06-05 20:38 [PATCH 0/4] platform/x86: Constify static attribute_group structs Rikard Falkeborn
2021-06-05 20:38 ` [PATCH 1/4] platform/x86: hdaps: Constify static attribute_group struct Rikard Falkeborn
2021-06-05 20:38 ` [PATCH 2/4] platform/x86: intel_pmt_crashlog: " Rikard Falkeborn
@ 2021-06-05 20:38 ` Rikard Falkeborn
2021-06-05 20:38 ` [PATCH 4/4] x86/platform/uv: " Rikard Falkeborn
2021-06-09 14:26 ` [PATCH 0/4] platform/x86: Constify static attribute_group structs Hans de Goede
4 siblings, 0 replies; 8+ messages in thread
From: Rikard Falkeborn @ 2021-06-05 20:38 UTC (permalink / raw)
To: Hans de Goede, Mark Gross, Frank Seidel, David E. Box, Justin Ernst
Cc: Alexander Duyck, platform-driver-x86, linux-kernel, Mike Travis,
Rikard Falkeborn
The only use of tc1100_attribute_group is to pass its address to
sysfs_create_group() and sysfs_remove_group(), both which takes pointer
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>
---
drivers/platform/x86/tc1100-wmi.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/platform/x86/tc1100-wmi.c b/drivers/platform/x86/tc1100-wmi.c
index 803920b6f01d..9072eb302618 100644
--- a/drivers/platform/x86/tc1100-wmi.c
+++ b/drivers/platform/x86/tc1100-wmi.c
@@ -156,7 +156,7 @@ static struct attribute *tc1100_attributes[] = {
NULL
};
-static struct attribute_group tc1100_attribute_group = {
+static const struct attribute_group tc1100_attribute_group = {
.attrs = tc1100_attributes,
};
--
2.31.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 4/4] x86/platform/uv: Constify static attribute_group struct
2021-06-05 20:38 [PATCH 0/4] platform/x86: Constify static attribute_group structs Rikard Falkeborn
` (2 preceding siblings ...)
2021-06-05 20:38 ` [PATCH 3/4] platform/x86: tc1100-wmi: " Rikard Falkeborn
@ 2021-06-05 20:38 ` Rikard Falkeborn
2021-06-07 14:34 ` Ernst, Justin
2021-06-09 14:26 ` [PATCH 0/4] platform/x86: Constify static attribute_group structs Hans de Goede
4 siblings, 1 reply; 8+ messages in thread
From: Rikard Falkeborn @ 2021-06-05 20:38 UTC (permalink / raw)
To: Hans de Goede, Mark Gross, Frank Seidel, David E. Box, Justin Ernst
Cc: Alexander Duyck, platform-driver-x86, linux-kernel, Mike Travis,
Rikard Falkeborn
The only use of base_attr_group and hubless_base_attr_group is to pass
their addresses to sysfs_create_group() and sysfs_remove_group(), both
which takes pointers to const attribute_group structs. Make them const
to allow the compiler to put them in read-only memory.
Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com>
---
drivers/platform/x86/uv_sysfs.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/platform/x86/uv_sysfs.c b/drivers/platform/x86/uv_sysfs.c
index 7badcfa3f384..956a354b57c1 100644
--- a/drivers/platform/x86/uv_sysfs.c
+++ b/drivers/platform/x86/uv_sysfs.c
@@ -778,7 +778,7 @@ static struct attribute *base_attrs[] = {
NULL,
};
-static struct attribute_group base_attr_group = {
+static const struct attribute_group base_attr_group = {
.attrs = base_attrs
};
@@ -823,7 +823,7 @@ static struct attribute *hubless_base_attrs[] = {
NULL,
};
-static struct attribute_group hubless_base_attr_group = {
+static const struct attribute_group hubless_base_attr_group = {
.attrs = hubless_base_attrs
};
--
2.31.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* RE: [PATCH 4/4] x86/platform/uv: Constify static attribute_group struct
2021-06-05 20:38 ` [PATCH 4/4] x86/platform/uv: " Rikard Falkeborn
@ 2021-06-07 14:34 ` Ernst, Justin
0 siblings, 0 replies; 8+ messages in thread
From: Ernst, Justin @ 2021-06-07 14:34 UTC (permalink / raw)
To: Rikard Falkeborn, Hans de Goede, Mark Gross, Frank Seidel, David E. Box
Cc: Alexander Duyck, platform-driver-x86, linux-kernel, Travis, Mike
> The only use of base_attr_group and hubless_base_attr_group is to pass
> their addresses to sysfs_create_group() and sysfs_remove_group(), both
> which takes pointers to const attribute_group structs. Make them const
> to allow the compiler to put them in read-only memory.
>
> Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com>
Thank you for the patch.
Reviewed-by: Justin Ernst <justin.ernst@hpe.com>
> ---
> drivers/platform/x86/uv_sysfs.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/platform/x86/uv_sysfs.c b/drivers/platform/x86/uv_sysfs.c
> index 7badcfa3f384..956a354b57c1 100644
> --- a/drivers/platform/x86/uv_sysfs.c
> +++ b/drivers/platform/x86/uv_sysfs.c
> @@ -778,7 +778,7 @@ static struct attribute *base_attrs[] = {
> NULL,
> };
>
> -static struct attribute_group base_attr_group = {
> +static const struct attribute_group base_attr_group = {
> .attrs = base_attrs
> };
>
> @@ -823,7 +823,7 @@ static struct attribute *hubless_base_attrs[] = {
> NULL,
> };
>
> -static struct attribute_group hubless_base_attr_group = {
> +static const struct attribute_group hubless_base_attr_group = {
> .attrs = hubless_base_attrs
> };
>
> --
> 2.31.1
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/4] platform/x86: hdaps: Constify static attribute_group struct
2021-06-05 20:38 ` [PATCH 1/4] platform/x86: hdaps: Constify static attribute_group struct Rikard Falkeborn
@ 2021-06-07 16:21 ` Frank Seidel
0 siblings, 0 replies; 8+ messages in thread
From: Frank Seidel @ 2021-06-07 16:21 UTC (permalink / raw)
To: Rikard Falkeborn, Hans de Goede, Mark Gross, David E. Box,
Justin Ernst, Frank Seidel
Cc: Alexander Duyck, platform-driver-x86, linux-kernel, Mike Travis
> The only use of hdaps_attribute_group is to pass its address to
> sysfs_create_group() and sysfs_remove_group(), both which takes 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>
Thanks for the patch and keeping me informed.
Reviewed-by: Frank Seidel <frank@f-seidel.de>
> ---
> drivers/platform/x86/hdaps.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/platform/x86/hdaps.c b/drivers/platform/x86/hdaps.c
> index a72270932ec3..9996485f5295 100644
> --- a/drivers/platform/x86/hdaps.c
> +++ b/drivers/platform/x86/hdaps.c
> @@ -462,7 +462,7 @@ static struct attribute *hdaps_attributes[] = {
> NULL,
> };
>
> -static struct attribute_group hdaps_attribute_group = {
> +static const struct attribute_group hdaps_attribute_group = {
> .attrs = hdaps_attributes,
> };
>
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 0/4] platform/x86: Constify static attribute_group structs
2021-06-05 20:38 [PATCH 0/4] platform/x86: Constify static attribute_group structs Rikard Falkeborn
` (3 preceding siblings ...)
2021-06-05 20:38 ` [PATCH 4/4] x86/platform/uv: " Rikard Falkeborn
@ 2021-06-09 14:26 ` Hans de Goede
4 siblings, 0 replies; 8+ messages in thread
From: Hans de Goede @ 2021-06-09 14:26 UTC (permalink / raw)
To: Rikard Falkeborn, Mark Gross, Frank Seidel, David E. Box, Justin Ernst
Cc: Alexander Duyck, platform-driver-x86, linux-kernel, Mike Travis
Hi,
On 6/5/21 10:38 PM, Rikard Falkeborn wrote:
> Constify a couple of static attribute_group structs which are never
> modified to allow the compiler to put them in read-only memory.
>
> Rikard Falkeborn (4):
> platform/x86: hdaps: Constify static attribute_group struct
> platform/x86: intel_pmt_crashlog: Constify static attribute_group
> struct
> platform/x86: tc1100-wmi: Constify static attribute_group struct
> x86/platform/uv: Constify static attribute_group struct
Thank you for your patch-series, I've applied the series to my
review-hans branch:
https://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86.git/log/?h=review-hans
Note it will show up in my review-hans branch once I've pushed my
local branch there, which might take a while.
Once I've run some tests on this branch the patches there will be
added to the platform-drivers-x86/for-next branch and eventually
will be included in the pdx86 pull-request to Linus for the next
merge-window.
Regards,
Hans
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2021-06-09 14:27 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-05 20:38 [PATCH 0/4] platform/x86: Constify static attribute_group structs Rikard Falkeborn
2021-06-05 20:38 ` [PATCH 1/4] platform/x86: hdaps: Constify static attribute_group struct Rikard Falkeborn
2021-06-07 16:21 ` Frank Seidel
2021-06-05 20:38 ` [PATCH 2/4] platform/x86: intel_pmt_crashlog: " Rikard Falkeborn
2021-06-05 20:38 ` [PATCH 3/4] platform/x86: tc1100-wmi: " Rikard Falkeborn
2021-06-05 20:38 ` [PATCH 4/4] x86/platform/uv: " Rikard Falkeborn
2021-06-07 14:34 ` Ernst, Justin
2021-06-09 14:26 ` [PATCH 0/4] platform/x86: Constify static attribute_group structs Hans de Goede
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).