attribute_groups are not supposed to change at runtime. All functions
working with attribute_groups provided by <linux/sysfs.h> work
with const attribute_group. So mark the non-const structs as const.
Arvind Yadav (7):
[PATCH 1/7] platform/x86: fujitsu-laptop: constify attribute_group structures.
[PATCH 2/7] platform/x86: compal-laptop: constify attribute_group structures.
[PATCH 3/7] platform/x86: samsung-laptop: constify attribute_group structures.
[PATCH 4/7] platform/x86: alienware-wmi: constify attribute_group structures.
[PATCH 5/7] platform/x86: panasonic-laptop: constify attribute_group structures.
[PATCH 6/7] platform/x86: asus-wmi: constify attribute_group structures.
[PATCH 7/7] platform/x86: toshiba_acpi: constify attribute_group structures.
drivers/platform/x86/alienware-wmi.c | 6 +++---
drivers/platform/x86/asus-wmi.c | 4 ++--
drivers/platform/x86/compal-laptop.c | 2 +-
drivers/platform/x86/fujitsu-laptop.c | 2 +-
drivers/platform/x86/panasonic-laptop.c | 2 +-
drivers/platform/x86/samsung-laptop.c | 2 +-
drivers/platform/x86/toshiba_acpi.c | 2 +-
7 files changed, 10 insertions(+), 10 deletions(-)
--
1.9.1
attribute_groups are not supposed to change at runtime. All functions
working with attribute_groups provided by <linux/sysfs.h> work
with const attribute_group. So mark the non-const structs as const.
File size before:
text data bss dec hex filename
7474 1205 24 8703 21ff drivers/platform/x86/fujitsu-laptop.o
File size After adding 'const':
text data bss dec hex filename
7538 1141 24 8703 21ff drivers/platform/x86/fujitsu-laptop.o
Signed-off-by: Arvind Yadav <[email protected]>
---
drivers/platform/x86/fujitsu-laptop.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/platform/x86/fujitsu-laptop.c b/drivers/platform/x86/fujitsu-laptop.c
index c1a8528..7973342 100644
--- a/drivers/platform/x86/fujitsu-laptop.c
+++ b/drivers/platform/x86/fujitsu-laptop.c
@@ -317,7 +317,7 @@ static ssize_t radios_show(struct device *dev, struct device_attribute *attr,
NULL
};
-static struct attribute_group fujitsu_pf_attribute_group = {
+static const struct attribute_group fujitsu_pf_attribute_group = {
.attrs = fujitsu_pf_attributes
};
--
1.9.1
attribute_groups are not supposed to change at runtime. All functions
working with attribute_groups provided by <linux/sysfs.h> work
with const attribute_group. So mark the non-const structs as const.
File size before:
text data bss dec hex filename
6932 1016 48 7996 1f3c drivers/platform/x86/alienware-wmi.o
File size After adding 'const':
text data bss dec hex filename
7060 888 48 7996 1f64 drivers/platform/x86/alienware-wmi.o
Signed-off-by: Arvind Yadav <[email protected]>
---
drivers/platform/x86/alienware-wmi.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/platform/x86/alienware-wmi.c b/drivers/platform/x86/alienware-wmi.c
index 9866fec..0831b42 100644
--- a/drivers/platform/x86/alienware-wmi.c
+++ b/drivers/platform/x86/alienware-wmi.c
@@ -604,7 +604,7 @@ static DEVICE_ATTR(source, S_IRUGO | S_IWUSR, show_hdmi_source,
NULL,
};
-static struct attribute_group hdmi_attribute_group = {
+static const struct attribute_group hdmi_attribute_group = {
.name = "hdmi",
.attrs = hdmi_attrs,
};
@@ -660,7 +660,7 @@ static ssize_t show_amplifier_status(struct device *dev,
NULL,
};
-static struct attribute_group amplifier_attribute_group = {
+static const struct attribute_group amplifier_attribute_group = {
.name = "amplifier",
.attrs = amplifier_attrs,
};
@@ -741,7 +741,7 @@ static ssize_t toggle_deepsleep(struct device *dev,
NULL,
};
-static struct attribute_group deepsleep_attribute_group = {
+static const struct attribute_group deepsleep_attribute_group = {
.name = "deepsleep",
.attrs = deepsleep_attrs,
};
--
1.9.1
attribute_groups are not supposed to change at runtime. All functions
working with attribute_groups provided by <linux/sysfs.h> work
with const attribute_group. So mark the non-const structs as const.
File size before:
text data bss dec hex filename
6781 6144 34 12959 329f drivers/platform/x86/compal-laptop.o
File size After adding 'const':
text data bss dec hex filename
6845 6080 34 12959 329f drivers/platform/x86/compal-laptop.o
Signed-off-by: Arvind Yadav <[email protected]>
---
drivers/platform/x86/compal-laptop.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/platform/x86/compal-laptop.c b/drivers/platform/x86/compal-laptop.c
index e1c2b6d..a8e4a53 100644
--- a/drivers/platform/x86/compal-laptop.c
+++ b/drivers/platform/x86/compal-laptop.c
@@ -718,7 +718,7 @@ static DEVICE_ATTR(pwm1_enable,
&dev_attr_wake_up_mouse.attr,
NULL
};
-static struct attribute_group compal_platform_attr_group = {
+static const struct attribute_group compal_platform_attr_group = {
.attrs = compal_platform_attrs
};
--
1.9.1
attribute_groups are not supposed to change at runtime. All functions
working with attribute_groups provided by <linux/sysfs.h> work
with const attribute_group. So mark the non-const structs as const.
File size before:
text data bss dec hex filename
26360 1072 24 27456 6b40 drivers/platform/x86/toshiba_acpi.o
File size After adding 'const':
text data bss dec hex filename
26424 1008 24 27456 6b40 drivers/platform/x86/toshiba_acpi.o
Signed-off-by: Arvind Yadav <[email protected]>
---
drivers/platform/x86/toshiba_acpi.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/platform/x86/toshiba_acpi.c b/drivers/platform/x86/toshiba_acpi.c
index 88f9f79..bb1dcd7 100644
--- a/drivers/platform/x86/toshiba_acpi.c
+++ b/drivers/platform/x86/toshiba_acpi.c
@@ -2419,7 +2419,7 @@ static umode_t toshiba_sysfs_is_visible(struct kobject *kobj,
return exists ? attr->mode : 0;
}
-static struct attribute_group toshiba_attr_group = {
+static const struct attribute_group toshiba_attr_group = {
.is_visible = toshiba_sysfs_is_visible,
.attrs = toshiba_attributes,
};
--
1.9.1
attribute_groups are not supposed to change at runtime. All functions
working with attribute_groups provided by <linux/sysfs.h> work
with const attribute_group. So mark the non-const structs as const.
File size before:
text data bss dec hex filename
13140 840 1 13981 369d drivers/platform/x86/asus-wmi.o
File size After adding 'const':
text data bss dec hex filename
13268 712 1 13981 368d drivers/platform/x86/asus-wmi.o
Signed-off-by: Arvind Yadav <[email protected]>
---
drivers/platform/x86/asus-wmi.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c
index 6c7d860..709e3a6 100644
--- a/drivers/platform/x86/asus-wmi.c
+++ b/drivers/platform/x86/asus-wmi.c
@@ -1433,7 +1433,7 @@ static umode_t asus_hwmon_sysfs_is_visible(struct kobject *kobj,
return ok ? attr->mode : 0;
}
-static struct attribute_group hwmon_attribute_group = {
+static const struct attribute_group hwmon_attribute_group = {
.is_visible = asus_hwmon_sysfs_is_visible,
.attrs = hwmon_attributes
};
@@ -1821,7 +1821,7 @@ static umode_t asus_sysfs_is_visible(struct kobject *kobj,
return ok ? attr->mode : 0;
}
-static struct attribute_group platform_attribute_group = {
+static const struct attribute_group platform_attribute_group = {
.is_visible = asus_sysfs_is_visible,
.attrs = platform_attributes
};
--
1.9.1
attribute_groups are not supposed to change at runtime. All functions
working with attribute_groups provided by <linux/sysfs.h> work
with const attribute_group. So mark the non-const structs as const.
File size before:
text data bss dec hex filename
8710 5452 23 14185 3769 drivers/platform/x86/samsung-laptop.o
File size After adding 'const':
text data bss dec hex filename
8774 5388 23 14185 3769 drivers/platform/x86/samsung-laptop.o
Signed-off-by: Arvind Yadav <[email protected]>
---
drivers/platform/x86/samsung-laptop.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/platform/x86/samsung-laptop.c b/drivers/platform/x86/samsung-laptop.c
index 5c4dfe4..0c703fe 100644
--- a/drivers/platform/x86/samsung-laptop.c
+++ b/drivers/platform/x86/samsung-laptop.c
@@ -1232,7 +1232,7 @@ static umode_t samsung_sysfs_is_visible(struct kobject *kobj,
return ok ? attr->mode : 0;
}
-static struct attribute_group platform_attribute_group = {
+static const struct attribute_group platform_attribute_group = {
.is_visible = samsung_sysfs_is_visible,
.attrs = platform_attributes
};
--
1.9.1
attribute_groups are not supposed to change at runtime. All functions
working with attribute_groups provided by <linux/sysfs.h> work
with const attribute_group. So mark the non-const structs as const.
File size before:
text data bss dec hex filename
2505 600 4 3109 c25 drivers/platform/x86/panasonic-laptop.o
File size After adding 'const':
text data bss dec hex filename
2569 536 4 3109 c25 drivers/platform/x86/panasonic-laptop.o
Signed-off-by: Arvind Yadav <[email protected]>
---
drivers/platform/x86/panasonic-laptop.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/platform/x86/panasonic-laptop.c b/drivers/platform/x86/panasonic-laptop.c
index 76b0a58..5c39b32 100644
--- a/drivers/platform/x86/panasonic-laptop.c
+++ b/drivers/platform/x86/panasonic-laptop.c
@@ -437,7 +437,7 @@ static ssize_t set_sticky(struct device *dev, struct device_attribute *attr,
NULL,
};
-static struct attribute_group pcc_attr_group = {
+static const struct attribute_group pcc_attr_group = {
.name = NULL, /* put in device directory */
.attrs = pcc_sysfs_entries,
};
--
1.9.1
On Tue, Jul 11, 2017 at 04:18:14PM +0530, Arvind Yadav wrote:
> attribute_groups are not supposed to change at runtime. All functions
> working with attribute_groups provided by <linux/sysfs.h> work
> with const attribute_group. So mark the non-const structs as const.
>
> File size before:
> text data bss dec hex filename
> 7474 1205 24 8703 21ff drivers/platform/x86/fujitsu-laptop.o
>
> File size After adding 'const':
> text data bss dec hex filename
> 7538 1141 24 8703 21ff drivers/platform/x86/fujitsu-laptop.o
>
> Signed-off-by: Arvind Yadav <[email protected]>
I have no objections to this patch - it seems like the sensible thing to do
in the interests of remaining consistent with the rest of the kernel.
Thanks Arvind.
Reviewed-by: Jonathan Woithe <[email protected]>
Regards
jonathan
> ---
> drivers/platform/x86/fujitsu-laptop.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/platform/x86/fujitsu-laptop.c b/drivers/platform/x86/fujitsu-laptop.c
> index c1a8528..7973342 100644
> --- a/drivers/platform/x86/fujitsu-laptop.c
> +++ b/drivers/platform/x86/fujitsu-laptop.c
> @@ -317,7 +317,7 @@ static ssize_t radios_show(struct device *dev, struct device_attribute *attr,
> NULL
> };
>
> -static struct attribute_group fujitsu_pf_attribute_group = {
> +static const struct attribute_group fujitsu_pf_attribute_group = {
> .attrs = fujitsu_pf_attributes
> };
>
> --
On Tue, Jul 11, 2017 at 04:18:13PM +0530, Arvind Yadav wrote:
> attribute_groups are not supposed to change at runtime. All functions
> working with attribute_groups provided by <linux/sysfs.h> work
> with const attribute_group. So mark the non-const structs as const.
Build tested, no warnings/errors found. Queued to testing, thanks Arvind.
>
> Arvind Yadav (7):
> [PATCH 1/7] platform/x86: fujitsu-laptop: constify attribute_group structures.
> [PATCH 2/7] platform/x86: compal-laptop: constify attribute_group structures.
> [PATCH 3/7] platform/x86: samsung-laptop: constify attribute_group structures.
> [PATCH 4/7] platform/x86: alienware-wmi: constify attribute_group structures.
> [PATCH 5/7] platform/x86: panasonic-laptop: constify attribute_group structures.
> [PATCH 6/7] platform/x86: asus-wmi: constify attribute_group structures.
> [PATCH 7/7] platform/x86: toshiba_acpi: constify attribute_group structures.
>
> drivers/platform/x86/alienware-wmi.c | 6 +++---
> drivers/platform/x86/asus-wmi.c | 4 ++--
> drivers/platform/x86/compal-laptop.c | 2 +-
> drivers/platform/x86/fujitsu-laptop.c | 2 +-
> drivers/platform/x86/panasonic-laptop.c | 2 +-
> drivers/platform/x86/samsung-laptop.c | 2 +-
> drivers/platform/x86/toshiba_acpi.c | 2 +-
> 7 files changed, 10 insertions(+), 10 deletions(-)
>
> --
> 1.9.1
>
>
--
Darren Hart
VMware Open Source Technology Center