All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] soundwire: sysfs: Constiyf static struct attribute_group
@ 2021-01-17 22:06 ` Rikard Falkeborn
  0 siblings, 0 replies; 6+ messages in thread
From: Rikard Falkeborn @ 2021-01-17 22:06 UTC (permalink / raw
  To: Vinod Koul
  Cc: Bard Liao, Pierre-Louis Bossart, Sanyog Kale, alsa-devel,
	linux-kernel, Rikard Falkeborn

The only place sdw_slave_dev_attr_group is used is when its address is
passed to devm_device_add_group() which takes a pointer to const struct
attribute_group. Make it const to allow the compiler to put it in
read-only memory. This makes all attribute_group structs in the file
const. Done with the help of Coccinelle.

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

diff --git a/drivers/soundwire/sysfs_slave.c b/drivers/soundwire/sysfs_slave.c
index b48b6617a396..3210359cd944 100644
--- a/drivers/soundwire/sysfs_slave.c
+++ b/drivers/soundwire/sysfs_slave.c
@@ -130,7 +130,7 @@ static struct attribute *slave_dev_attrs[] = {
  * we don't use ATTRIBUTES_GROUP here since we want to add a subdirectory
  * for device-level properties
  */
-static struct attribute_group sdw_slave_dev_attr_group = {
+static const struct attribute_group sdw_slave_dev_attr_group = {
 	.attrs	= slave_dev_attrs,
 	.name = "dev-properties",
 };
-- 
2.30.0


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

* [PATCH] soundwire: sysfs: Constiyf static struct attribute_group
@ 2021-01-17 22:06 ` Rikard Falkeborn
  0 siblings, 0 replies; 6+ messages in thread
From: Rikard Falkeborn @ 2021-01-17 22:06 UTC (permalink / raw
  To: Vinod Koul
  Cc: alsa-devel, Pierre-Louis Bossart, Rikard Falkeborn, linux-kernel,
	Sanyog Kale, Bard Liao

The only place sdw_slave_dev_attr_group is used is when its address is
passed to devm_device_add_group() which takes a pointer to const struct
attribute_group. Make it const to allow the compiler to put it in
read-only memory. This makes all attribute_group structs in the file
const. Done with the help of Coccinelle.

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

diff --git a/drivers/soundwire/sysfs_slave.c b/drivers/soundwire/sysfs_slave.c
index b48b6617a396..3210359cd944 100644
--- a/drivers/soundwire/sysfs_slave.c
+++ b/drivers/soundwire/sysfs_slave.c
@@ -130,7 +130,7 @@ static struct attribute *slave_dev_attrs[] = {
  * we don't use ATTRIBUTES_GROUP here since we want to add a subdirectory
  * for device-level properties
  */
-static struct attribute_group sdw_slave_dev_attr_group = {
+static const struct attribute_group sdw_slave_dev_attr_group = {
 	.attrs	= slave_dev_attrs,
 	.name = "dev-properties",
 };
-- 
2.30.0


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

* [PATCH V2] soundwire: sysfs: Constify static struct attribute_group
  2021-01-17 22:06 ` Rikard Falkeborn
@ 2021-01-17 22:16   ` Rikard Falkeborn
  -1 siblings, 0 replies; 6+ messages in thread
From: Rikard Falkeborn @ 2021-01-17 22:16 UTC (permalink / raw
  To: Vinod Koul
  Cc: Bard Liao, Pierre-Louis Bossart, Sanyog Kale, alsa-devel,
	linux-kernel, Rikard Falkeborn

The only place sdw_slave_dev_attr_group is used is when its address is
passed to devm_device_add_group() which takes a pointer to const struct
attribute_group. Make it const to allow the compiler to put it in
read-only memory. This makes all attribute_group structs in the file
const. Done with the help of Coccinelle.

Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com>
---
Changes since v 1: Fix spelling in commit message title (sorry for the noise...)

 drivers/soundwire/sysfs_slave.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/soundwire/sysfs_slave.c b/drivers/soundwire/sysfs_slave.c
index b48b6617a396..3210359cd944 100644
--- a/drivers/soundwire/sysfs_slave.c
+++ b/drivers/soundwire/sysfs_slave.c
@@ -130,7 +130,7 @@ static struct attribute *slave_dev_attrs[] = {
  * we don't use ATTRIBUTES_GROUP here since we want to add a subdirectory
  * for device-level properties
  */
-static struct attribute_group sdw_slave_dev_attr_group = {
+static const struct attribute_group sdw_slave_dev_attr_group = {
 	.attrs	= slave_dev_attrs,
 	.name = "dev-properties",
 };
-- 
2.30.0


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

* [PATCH V2] soundwire: sysfs: Constify static struct attribute_group
@ 2021-01-17 22:16   ` Rikard Falkeborn
  0 siblings, 0 replies; 6+ messages in thread
From: Rikard Falkeborn @ 2021-01-17 22:16 UTC (permalink / raw
  To: Vinod Koul
  Cc: alsa-devel, Pierre-Louis Bossart, Rikard Falkeborn, linux-kernel,
	Sanyog Kale, Bard Liao

The only place sdw_slave_dev_attr_group is used is when its address is
passed to devm_device_add_group() which takes a pointer to const struct
attribute_group. Make it const to allow the compiler to put it in
read-only memory. This makes all attribute_group structs in the file
const. Done with the help of Coccinelle.

Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com>
---
Changes since v 1: Fix spelling in commit message title (sorry for the noise...)

 drivers/soundwire/sysfs_slave.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/soundwire/sysfs_slave.c b/drivers/soundwire/sysfs_slave.c
index b48b6617a396..3210359cd944 100644
--- a/drivers/soundwire/sysfs_slave.c
+++ b/drivers/soundwire/sysfs_slave.c
@@ -130,7 +130,7 @@ static struct attribute *slave_dev_attrs[] = {
  * we don't use ATTRIBUTES_GROUP here since we want to add a subdirectory
  * for device-level properties
  */
-static struct attribute_group sdw_slave_dev_attr_group = {
+static const struct attribute_group sdw_slave_dev_attr_group = {
 	.attrs	= slave_dev_attrs,
 	.name = "dev-properties",
 };
-- 
2.30.0


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

* Re: [PATCH V2] soundwire: sysfs: Constify static struct attribute_group
  2021-01-17 22:16   ` Rikard Falkeborn
@ 2021-01-19 14:53     ` Vinod Koul
  -1 siblings, 0 replies; 6+ messages in thread
From: Vinod Koul @ 2021-01-19 14:53 UTC (permalink / raw
  To: Rikard Falkeborn
  Cc: Sanyog Kale, Bard Liao, Pierre-Louis Bossart, alsa-devel,
	linux-kernel

On 17-01-21, 23:16, Rikard Falkeborn wrote:
> The only place sdw_slave_dev_attr_group is used is when its address is
> passed to devm_device_add_group() which takes a pointer to const struct
> attribute_group. Make it const to allow the compiler to put it in
> read-only memory. This makes all attribute_group structs in the file
> const. Done with the help of Coccinelle.

Applied, thanks

-- 
~Vinod

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

* Re: [PATCH V2] soundwire: sysfs: Constify static struct attribute_group
@ 2021-01-19 14:53     ` Vinod Koul
  0 siblings, 0 replies; 6+ messages in thread
From: Vinod Koul @ 2021-01-19 14:53 UTC (permalink / raw
  To: Rikard Falkeborn
  Cc: Bard Liao, Pierre-Louis Bossart, Sanyog Kale, alsa-devel,
	linux-kernel

On 17-01-21, 23:16, Rikard Falkeborn wrote:
> The only place sdw_slave_dev_attr_group is used is when its address is
> passed to devm_device_add_group() which takes a pointer to const struct
> attribute_group. Make it const to allow the compiler to put it in
> read-only memory. This makes all attribute_group structs in the file
> const. Done with the help of Coccinelle.

Applied, thanks

-- 
~Vinod

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

end of thread, other threads:[~2021-01-19 15:15 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-01-17 22:06 [PATCH] soundwire: sysfs: Constiyf static struct attribute_group Rikard Falkeborn
2021-01-17 22:06 ` Rikard Falkeborn
2021-01-17 22:16 ` [PATCH V2] soundwire: sysfs: Constify " Rikard Falkeborn
2021-01-17 22:16   ` Rikard Falkeborn
2021-01-19 14:53   ` Vinod Koul
2021-01-19 14:53     ` Vinod Koul

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.