linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RESEND PATCH 0/3] drivers/mfd: Constify static attribute_group structs
@ 2021-03-02 21:05 Rikard Falkeborn
  2021-03-02 21:05 ` [RESEND PATCH 1/3] mfd: gateworks-gsc: Constify static struct attribute_group Rikard Falkeborn
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Rikard Falkeborn @ 2021-03-02 21:05 UTC (permalink / raw)
  To: Lee Jones; +Cc: linux-kernel, Tim Harvey, Robert Jones, Rikard Falkeborn

Seems the first submission somehow didn't make it to LKML, here's a
resend.

The only usage of the structs is to pass their address 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.

Done with the help of coccinelle.

With these patches applied, all static attribute_group structs in
drivers/mfd are const.

Rikard Falkeborn (3):
  mfd: gateworks-gsc: Constify static struct attribute_group
  mfd: lm3533: Constify static struct attribute_group
  mfd: pcf50633: Constify static struct attribute_group

 drivers/mfd/gateworks-gsc.c | 2 +-
 drivers/mfd/lm3533-core.c   | 2 +-
 drivers/mfd/pcf50633-core.c | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

-- 
2.30.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [RESEND PATCH 1/3] mfd: gateworks-gsc: Constify static struct attribute_group
  2021-03-02 21:05 [RESEND PATCH 0/3] drivers/mfd: Constify static attribute_group structs Rikard Falkeborn
@ 2021-03-02 21:05 ` Rikard Falkeborn
  2021-03-02 21:05 ` [RESEND PATCH 2/3] mfd: lm3533: " Rikard Falkeborn
  2021-03-02 21:05 ` [RESEND PATCH 3/3] mfd: pcf50633: " Rikard Falkeborn
  2 siblings, 0 replies; 4+ messages in thread
From: Rikard Falkeborn @ 2021-03-02 21:05 UTC (permalink / raw)
  To: Lee Jones; +Cc: linux-kernel, Tim Harvey, Robert Jones, Rikard Falkeborn

The only usage of attr_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.

Done with the help of coccinelle.

Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com>
---
 drivers/mfd/gateworks-gsc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mfd/gateworks-gsc.c b/drivers/mfd/gateworks-gsc.c
index d87876747b91..8745f9d8c26f 100644
--- a/drivers/mfd/gateworks-gsc.c
+++ b/drivers/mfd/gateworks-gsc.c
@@ -150,7 +150,7 @@ static struct attribute *gsc_attrs[] = {
 	NULL,
 };
 
-static struct attribute_group attr_group = {
+static const struct attribute_group attr_group = {
 	.attrs = gsc_attrs,
 };
 
-- 
2.30.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [RESEND PATCH 2/3] mfd: lm3533: Constify static struct attribute_group
  2021-03-02 21:05 [RESEND PATCH 0/3] drivers/mfd: Constify static attribute_group structs Rikard Falkeborn
  2021-03-02 21:05 ` [RESEND PATCH 1/3] mfd: gateworks-gsc: Constify static struct attribute_group Rikard Falkeborn
@ 2021-03-02 21:05 ` Rikard Falkeborn
  2021-03-02 21:05 ` [RESEND PATCH 3/3] mfd: pcf50633: " Rikard Falkeborn
  2 siblings, 0 replies; 4+ messages in thread
From: Rikard Falkeborn @ 2021-03-02 21:05 UTC (permalink / raw)
  To: Lee Jones; +Cc: linux-kernel, Tim Harvey, Robert Jones, Rikard Falkeborn

The only usage of lm3533_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.

Done with the help of coccinelle.

Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com>
---
 drivers/mfd/lm3533-core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mfd/lm3533-core.c b/drivers/mfd/lm3533-core.c
index 22fdffd564f7..523dcf05db78 100644
--- a/drivers/mfd/lm3533-core.c
+++ b/drivers/mfd/lm3533-core.c
@@ -373,7 +373,7 @@ static umode_t lm3533_attr_is_visible(struct kobject *kobj,
 	return mode;
 };
 
-static struct attribute_group lm3533_attribute_group = {
+static const struct attribute_group lm3533_attribute_group = {
 	.is_visible	= lm3533_attr_is_visible,
 	.attrs		= lm3533_attributes
 };
-- 
2.30.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [RESEND PATCH 3/3] mfd: pcf50633: Constify static struct attribute_group
  2021-03-02 21:05 [RESEND PATCH 0/3] drivers/mfd: Constify static attribute_group structs Rikard Falkeborn
  2021-03-02 21:05 ` [RESEND PATCH 1/3] mfd: gateworks-gsc: Constify static struct attribute_group Rikard Falkeborn
  2021-03-02 21:05 ` [RESEND PATCH 2/3] mfd: lm3533: " Rikard Falkeborn
@ 2021-03-02 21:05 ` Rikard Falkeborn
  2 siblings, 0 replies; 4+ messages in thread
From: Rikard Falkeborn @ 2021-03-02 21:05 UTC (permalink / raw)
  To: Lee Jones; +Cc: linux-kernel, Tim Harvey, Robert Jones, Rikard Falkeborn

The only usage of pcf_attr_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.

Done with the help of coccinelle.

Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com>
---
 drivers/mfd/pcf50633-core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mfd/pcf50633-core.c b/drivers/mfd/pcf50633-core.c
index 148bcd6120f4..0768d684113a 100644
--- a/drivers/mfd/pcf50633-core.c
+++ b/drivers/mfd/pcf50633-core.c
@@ -131,7 +131,7 @@ static struct attribute *pcf_sysfs_entries[] = {
 	NULL,
 };
 
-static struct attribute_group pcf_attr_group = {
+static const struct attribute_group pcf_attr_group = {
 	.name	= NULL,			/* put in device directory */
 	.attrs	= pcf_sysfs_entries,
 };
-- 
2.30.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-03-02 22:55 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-02 21:05 [RESEND PATCH 0/3] drivers/mfd: Constify static attribute_group structs Rikard Falkeborn
2021-03-02 21:05 ` [RESEND PATCH 1/3] mfd: gateworks-gsc: Constify static struct attribute_group Rikard Falkeborn
2021-03-02 21:05 ` [RESEND PATCH 2/3] mfd: lm3533: " Rikard Falkeborn
2021-03-02 21:05 ` [RESEND PATCH 3/3] mfd: pcf50633: " Rikard Falkeborn

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).