Patchwork [5/6] platform/x86: make device_attribute const

login
register
mail settings
Submitter Bhumika Goyal
Date Aug. 21, 2017, 11:43 a.m.
Message ID <1503315792-14837-6-git-send-email-bhumirks@gmail.com>
Download mbox | patch
Permalink /patch/9912249/
State New
Headers show

Comments

Bhumika Goyal - Aug. 21, 2017, 11:43 a.m.
Make these const as they are only passed as an argument to the
function device_create_file and device_remove_file and the corresponding
arguments are of type const.
Done using Coccinelle

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
---
 drivers/platform/x86/classmate-laptop.c | 6 +++---
 drivers/platform/x86/intel-rst.c        | 4 ++--
 2 files changed, 5 insertions(+), 5 deletions(-)
Thadeu Lima de Souza Cascardo - Aug. 21, 2017, 1:22 p.m.
For classmate-laptop.c

Acked-by: Thadeu Lima de Souza Cascardo <cascardo@holoscopio.com>

--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Andy Shevchenko - Aug. 30, 2017, 7:18 p.m.
On Mon, Aug 21, 2017 at 2:43 PM, Bhumika Goyal <bhumirks@gmail.com> wrote:
> Make these const as they are only passed as an argument to the
> function device_create_file and device_remove_file and the corresponding
> arguments are of type const.
> Done using Coccinelle
>

Split on per driver basis.

> Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
> ---
>  drivers/platform/x86/classmate-laptop.c | 6 +++---
>  drivers/platform/x86/intel-rst.c        | 4 ++--
>  2 files changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/platform/x86/classmate-laptop.c b/drivers/platform/x86/classmate-laptop.c
> index 55cf10b..d3715e2 100644
> --- a/drivers/platform/x86/classmate-laptop.c
> +++ b/drivers/platform/x86/classmate-laptop.c
> @@ -254,7 +254,7 @@ static ssize_t cmpc_accel_sensitivity_store_v4(struct device *dev,
>         return strnlen(buf, count);
>  }
>
> -static struct device_attribute cmpc_accel_sensitivity_attr_v4 = {
> +static const struct device_attribute cmpc_accel_sensitivity_attr_v4 = {
>         .attr = { .name = "sensitivity", .mode = 0660 },
>         .show = cmpc_accel_sensitivity_show_v4,
>         .store = cmpc_accel_sensitivity_store_v4
> @@ -303,7 +303,7 @@ static ssize_t cmpc_accel_g_select_store_v4(struct device *dev,
>         return strnlen(buf, count);
>  }
>
> -static struct device_attribute cmpc_accel_g_select_attr_v4 = {
> +static const struct device_attribute cmpc_accel_g_select_attr_v4 = {
>         .attr = { .name = "g_select", .mode = 0660 },
>         .show = cmpc_accel_g_select_show_v4,
>         .store = cmpc_accel_g_select_store_v4
> @@ -599,7 +599,7 @@ static ssize_t cmpc_accel_sensitivity_store(struct device *dev,
>         return strnlen(buf, count);
>  }
>
> -static struct device_attribute cmpc_accel_sensitivity_attr = {
> +static const struct device_attribute cmpc_accel_sensitivity_attr = {
>         .attr = { .name = "sensitivity", .mode = 0660 },
>         .show = cmpc_accel_sensitivity_show,
>         .store = cmpc_accel_sensitivity_store
> diff --git a/drivers/platform/x86/intel-rst.c b/drivers/platform/x86/intel-rst.c
> index 7344d84..760a9bf 100644
> --- a/drivers/platform/x86/intel-rst.c
> +++ b/drivers/platform/x86/intel-rst.c
> @@ -65,7 +65,7 @@ static ssize_t irst_store_wakeup_events(struct device *dev,
>         return count;
>  }
>
> -static struct device_attribute irst_wakeup_attr = {
> +static const struct device_attribute irst_wakeup_attr = {
>         .attr = { .name = "wakeup_events", .mode = 0600 },
>         .show = irst_show_wakeup_events,
>         .store = irst_store_wakeup_events
> @@ -111,7 +111,7 @@ static ssize_t irst_store_wakeup_time(struct device *dev,
>         return count;
>  }
>
> -static struct device_attribute irst_timeout_attr = {
> +static const struct device_attribute irst_timeout_attr = {
>         .attr = { .name = "wakeup_time", .mode = 0600 },
>         .show = irst_show_wakeup_time,
>         .store = irst_store_wakeup_time
> --
> 1.9.1
>

Patch

diff --git a/drivers/platform/x86/classmate-laptop.c b/drivers/platform/x86/classmate-laptop.c
index 55cf10b..d3715e2 100644
--- a/drivers/platform/x86/classmate-laptop.c
+++ b/drivers/platform/x86/classmate-laptop.c
@@ -254,7 +254,7 @@  static ssize_t cmpc_accel_sensitivity_store_v4(struct device *dev,
 	return strnlen(buf, count);
 }
 
-static struct device_attribute cmpc_accel_sensitivity_attr_v4 = {
+static const struct device_attribute cmpc_accel_sensitivity_attr_v4 = {
 	.attr = { .name = "sensitivity", .mode = 0660 },
 	.show = cmpc_accel_sensitivity_show_v4,
 	.store = cmpc_accel_sensitivity_store_v4
@@ -303,7 +303,7 @@  static ssize_t cmpc_accel_g_select_store_v4(struct device *dev,
 	return strnlen(buf, count);
 }
 
-static struct device_attribute cmpc_accel_g_select_attr_v4 = {
+static const struct device_attribute cmpc_accel_g_select_attr_v4 = {
 	.attr = { .name = "g_select", .mode = 0660 },
 	.show = cmpc_accel_g_select_show_v4,
 	.store = cmpc_accel_g_select_store_v4
@@ -599,7 +599,7 @@  static ssize_t cmpc_accel_sensitivity_store(struct device *dev,
 	return strnlen(buf, count);
 }
 
-static struct device_attribute cmpc_accel_sensitivity_attr = {
+static const struct device_attribute cmpc_accel_sensitivity_attr = {
 	.attr = { .name = "sensitivity", .mode = 0660 },
 	.show = cmpc_accel_sensitivity_show,
 	.store = cmpc_accel_sensitivity_store
diff --git a/drivers/platform/x86/intel-rst.c b/drivers/platform/x86/intel-rst.c
index 7344d84..760a9bf 100644
--- a/drivers/platform/x86/intel-rst.c
+++ b/drivers/platform/x86/intel-rst.c
@@ -65,7 +65,7 @@  static ssize_t irst_store_wakeup_events(struct device *dev,
 	return count;
 }
 
-static struct device_attribute irst_wakeup_attr = {
+static const struct device_attribute irst_wakeup_attr = {
 	.attr = { .name = "wakeup_events", .mode = 0600 },
 	.show = irst_show_wakeup_events,
 	.store = irst_store_wakeup_events
@@ -111,7 +111,7 @@  static ssize_t irst_store_wakeup_time(struct device *dev,
 	return count;
 }
 
-static struct device_attribute irst_timeout_attr = {
+static const struct device_attribute irst_timeout_attr = {
 	.attr = { .name = "wakeup_time", .mode = 0600 },
 	.show = irst_show_wakeup_time,
 	.store = irst_store_wakeup_time