netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/6] drivers:  make device_attribute const
@ 2017-08-21 11:43 Bhumika Goyal
  2017-08-21 11:43 ` [PATCH 1/6] ACPI: " Bhumika Goyal
                   ` (7 more replies)
  0 siblings, 8 replies; 18+ messages in thread
From: Bhumika Goyal @ 2017-08-21 11:43 UTC (permalink / raw)
  To: julia.lawall, rjw, lenb, jbacik, jikos, benjamin.tissoires,
	manish.chopra, rahul.verma, Dept-GELinuxNICDev, harish.patil,
	cascardo, don, dvhart, andy, sre, linux-acpi, linux-kernel,
	linux-block, nbd-general, linux-input, netdev,
	platform-driver-x86, linux-pm
  Cc: Bhumika Goyal

Make these const. Done using Coccinelle.

@match disable optional_qualifier@
identifier s;
@@
static struct device_attribute s = {...};

@ref@
position p;
identifier match.s;
@@
s@p

@good1@
identifier match.s;
expression e1;
position ref.p;
@@
device_remove_file(e1,&s@p,...)

@good2@
identifier match.s;
expression e1;
position ref.p;
@@
device_create_file(e1,&s@p,...)


@bad depends on  !good1 && !good2@
position ref.p;
identifier match.s;
@@
s@p

@depends on forall !bad disable optional_qualifier@
identifier match.s;
@@
static
+ const
struct device_attribute s;

Bhumika Goyal (6):
  ACPI: make device_attribute const
  nbd: make device_attribute const
  hid: make device_attribute const
  qlogic:  make device_attribute const
  platform/x86: make device_attribute const
  power: supply: make device_attribute const

 drivers/acpi/battery.c                               | 2 +-
 drivers/acpi/sbs.c                                   | 2 +-
 drivers/block/nbd.c                                  | 2 +-
 drivers/hid/hid-core.c                               | 2 +-
 drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c | 4 ++--
 drivers/net/ethernet/qlogic/qlcnic/qlcnic_sysfs.c    | 6 +++---
 drivers/platform/x86/classmate-laptop.c              | 6 +++---
 drivers/platform/x86/intel-rst.c                     | 4 ++--
 drivers/power/supply/olpc_battery.c                  | 2 +-
 9 files changed, 15 insertions(+), 15 deletions(-)

-- 
1.9.1

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

* [PATCH 1/6] ACPI: make device_attribute const
  2017-08-21 11:43 [PATCH 0/6] drivers: make device_attribute const Bhumika Goyal
@ 2017-08-21 11:43 ` Bhumika Goyal
  2017-08-28 20:56   ` Rafael J. Wysocki
       [not found] ` <1503315792-14837-1-git-send-email-bhumirks-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
                   ` (6 subsequent siblings)
  7 siblings, 1 reply; 18+ messages in thread
From: Bhumika Goyal @ 2017-08-21 11:43 UTC (permalink / raw)
  To: julia.lawall, rjw, lenb, jbacik, jikos, benjamin.tissoires,
	manish.chopra, rahul.verma, Dept-GELinuxNICDev, harish.patil,
	cascardo, don, dvhart, andy, sre, linux-acpi, linux-kernel,
	linux-block, nbd-general, linux-input, netdev,
	platform-driver-x86, linux-pm
  Cc: Bhumika Goyal

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/acpi/battery.c | 2 +-
 drivers/acpi/sbs.c     | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c
index 1cbb88d..13e7b56 100644
--- a/drivers/acpi/battery.c
+++ b/drivers/acpi/battery.c
@@ -620,7 +620,7 @@ static ssize_t acpi_battery_alarm_store(struct device *dev,
 	return count;
 }
 
-static struct device_attribute alarm_attr = {
+static const struct device_attribute alarm_attr = {
 	.attr = {.name = "alarm", .mode = 0644},
 	.show = acpi_battery_alarm_show,
 	.store = acpi_battery_alarm_store,
diff --git a/drivers/acpi/sbs.c b/drivers/acpi/sbs.c
index a184637..a2428e9 100644
--- a/drivers/acpi/sbs.c
+++ b/drivers/acpi/sbs.c
@@ -474,7 +474,7 @@ static ssize_t acpi_battery_alarm_store(struct device *dev,
 	return count;
 }
 
-static struct device_attribute alarm_attr = {
+static const struct device_attribute alarm_attr = {
 	.attr = {.name = "alarm", .mode = 0644},
 	.show = acpi_battery_alarm_show,
 	.store = acpi_battery_alarm_store,
-- 
1.9.1

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

* [PATCH 2/6] nbd: make device_attribute const
       [not found] ` <1503315792-14837-1-git-send-email-bhumirks-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2017-08-21 11:43   ` Bhumika Goyal
  2017-08-28 21:21     ` Jens Axboe
  0 siblings, 1 reply; 18+ messages in thread
From: Bhumika Goyal @ 2017-08-21 11:43 UTC (permalink / raw)
  To: julia.lawall-L2FTfq7BK8M, rjw-LthD3rsA81gm4RdzfppkhA,
	lenb-DgEjT+Ai2ygdnm+yROfE0A, jbacik-b10kYP2dOMg,
	jikos-DgEjT+Ai2ygdnm+yROfE0A,
	benjamin.tissoires-H+wXaHxf7aLQT0dZR+AlfA,
	manish.chopra-YGCgFSpz5w/QT0dZR+AlfA,
	rahul.verma-YGCgFSpz5w/QT0dZR+AlfA,
	Dept-GELinuxNICDev-YGCgFSpz5w/QT0dZR+AlfA,
	harish.patil-YGCgFSpz5w/QT0dZR+AlfA,
	cascardo-DmMZpsCg3uxeGPcbtGPokg, don-rBL4DdiBytkIdKJ7tpkyPg,
	dvhart-wEGCiKHe2LqWVfeAwA7xHQ, andy-wEGCiKHe2LqWVfeAwA7xHQ,
	sre-DgEjT+Ai2ygdnm+yROfE0A, linux-acpi-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-block-u79uwXL29TY76Z2rM5mHXA,
	nbd-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f,
	linux-input-u79uwXL29TY76Z2rM5mHXA,
	netdev-u79uwXL29TY76Z2rM5mHXA,
	platform-driver-x86-u79uwXL29TY76Z2rM5mHXA,
	linux-pm-u79uwXL29TY76Z2rM5mHXA
  Cc: Bhumika Goyal

Make this const as is is 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-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
---
 drivers/block/nbd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c
index 5bdf923..49d7763 100644
--- a/drivers/block/nbd.c
+++ b/drivers/block/nbd.c
@@ -165,7 +165,7 @@ static ssize_t pid_show(struct device *dev,
 	return sprintf(buf, "%d\n", task_pid_nr(nbd->task_recv));
 }
 
-static struct device_attribute pid_attr = {
+static const struct device_attribute pid_attr = {
 	.attr = { .name = "pid", .mode = S_IRUGO},
 	.show = pid_show,
 };
-- 
1.9.1


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot

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

* [PATCH 3/6] hid: make device_attribute const
  2017-08-21 11:43 [PATCH 0/6] drivers: make device_attribute const Bhumika Goyal
  2017-08-21 11:43 ` [PATCH 1/6] ACPI: " Bhumika Goyal
       [not found] ` <1503315792-14837-1-git-send-email-bhumirks-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2017-08-21 11:43 ` Bhumika Goyal
  2017-09-06  8:57   ` Jiri Kosina
  2017-08-21 11:43 ` [PATCH 4/6] qlogic: " Bhumika Goyal
                   ` (4 subsequent siblings)
  7 siblings, 1 reply; 18+ messages in thread
From: Bhumika Goyal @ 2017-08-21 11:43 UTC (permalink / raw)
  To: julia.lawall, rjw, lenb, jbacik, jikos, benjamin.tissoires,
	manish.chopra, rahul.verma, Dept-GELinuxNICDev, harish.patil,
	cascardo, don, dvhart, andy, sre, linux-acpi, linux-kernel,
	linux-block, nbd-general, linux-input, netdev,
	platform-driver-x86, linux-pm
  Cc: Bhumika Goyal

Make this const as it is 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/hid/hid-core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
index 9bc9116..24e929c 100644
--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
@@ -1662,7 +1662,7 @@ static bool hid_hiddev(struct hid_device *hdev)
 	.size = HID_MAX_DESCRIPTOR_SIZE,
 };
 
-static struct device_attribute dev_attr_country = {
+static const struct device_attribute dev_attr_country = {
 	.attr = { .name = "country", .mode = 0444 },
 	.show = show_country,
 };
-- 
1.9.1

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

* [PATCH 4/6] qlogic:  make device_attribute const
  2017-08-21 11:43 [PATCH 0/6] drivers: make device_attribute const Bhumika Goyal
                   ` (2 preceding siblings ...)
  2017-08-21 11:43 ` [PATCH 3/6] hid: " Bhumika Goyal
@ 2017-08-21 11:43 ` Bhumika Goyal
  2017-08-21 17:25   ` David Miller
  2017-08-21 11:43 ` [PATCH 5/6] platform/x86: " Bhumika Goyal
                   ` (3 subsequent siblings)
  7 siblings, 1 reply; 18+ messages in thread
From: Bhumika Goyal @ 2017-08-21 11:43 UTC (permalink / raw)
  To: julia.lawall, rjw, lenb, jbacik, jikos, benjamin.tissoires,
	manish.chopra, rahul.verma, Dept-GELinuxNICDev, harish.patil,
	cascardo, don, dvhart, andy, sre, linux-acpi, linux-kernel,
	linux-block, nbd-general, linux-input, netdev,
	platform-driver-x86, linux-pm
  Cc: Bhumika Goyal

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/net/ethernet/qlogic/netxen/netxen_nic_main.c | 4 ++--
 drivers/net/ethernet/qlogic/qlcnic/qlcnic_sysfs.c    | 6 +++---
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c b/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c
index 827de83..f2e8de6 100644
--- a/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c
+++ b/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c
@@ -2828,7 +2828,7 @@ static void netxen_nic_poll_controller(struct net_device *netdev)
 	return sprintf(buf, "%d\n", bridged_mode);
 }
 
-static struct device_attribute dev_attr_bridged_mode = {
+static const struct device_attribute dev_attr_bridged_mode = {
        .attr = {.name = "bridged_mode", .mode = (S_IRUGO | S_IWUSR)},
        .show = netxen_show_bridged_mode,
        .store = netxen_store_bridged_mode,
@@ -2860,7 +2860,7 @@ static void netxen_nic_poll_controller(struct net_device *netdev)
 			!!(adapter->flags & NETXEN_NIC_DIAG_ENABLED));
 }
 
-static struct device_attribute dev_attr_diag_mode = {
+static const struct device_attribute dev_attr_diag_mode = {
 	.attr = {.name = "diag_mode", .mode = (S_IRUGO | S_IWUSR)},
 	.show = netxen_show_diag_mode,
 	.store = netxen_store_diag_mode,
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sysfs.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sysfs.c
index 82fcb83..287d89d 100644
--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sysfs.c
+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sysfs.c
@@ -1174,19 +1174,19 @@ static ssize_t qlcnic_83xx_sysfs_flash_write_handler(struct file *filp,
 	return size;
 }
 
-static struct device_attribute dev_attr_bridged_mode = {
+static const struct device_attribute dev_attr_bridged_mode = {
        .attr = {.name = "bridged_mode", .mode = (S_IRUGO | S_IWUSR)},
        .show = qlcnic_show_bridged_mode,
        .store = qlcnic_store_bridged_mode,
 };
 
-static struct device_attribute dev_attr_diag_mode = {
+static const struct device_attribute dev_attr_diag_mode = {
 	.attr = {.name = "diag_mode", .mode = (S_IRUGO | S_IWUSR)},
 	.show = qlcnic_show_diag_mode,
 	.store = qlcnic_store_diag_mode,
 };
 
-static struct device_attribute dev_attr_beacon = {
+static const struct device_attribute dev_attr_beacon = {
 	.attr = {.name = "beacon", .mode = (S_IRUGO | S_IWUSR)},
 	.show = qlcnic_show_beacon,
 	.store = qlcnic_store_beacon,
-- 
1.9.1

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

* [PATCH 5/6] platform/x86: make device_attribute const
  2017-08-21 11:43 [PATCH 0/6] drivers: make device_attribute const Bhumika Goyal
                   ` (3 preceding siblings ...)
  2017-08-21 11:43 ` [PATCH 4/6] qlogic: " Bhumika Goyal
@ 2017-08-21 11:43 ` Bhumika Goyal
  2017-08-21 13:22   ` Thadeu Lima de Souza Cascardo
  2017-08-30 19:18   ` Andy Shevchenko
  2017-08-21 11:43 ` [PATCH 6/6] power: supply: " Bhumika Goyal
                   ` (2 subsequent siblings)
  7 siblings, 2 replies; 18+ messages in thread
From: Bhumika Goyal @ 2017-08-21 11:43 UTC (permalink / raw)
  To: julia.lawall, rjw, lenb, jbacik, jikos, benjamin.tissoires,
	manish.chopra, rahul.verma, Dept-GELinuxNICDev, harish.patil,
	cascardo, don, dvhart, andy, sre, linux-acpi, linux-kernel,
	linux-block, nbd-general, linux-input, netdev,
	platform-driver-x86, linux-pm
  Cc: Bhumika Goyal

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

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

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

* [PATCH 6/6] power: supply: make device_attribute const
  2017-08-21 11:43 [PATCH 0/6] drivers: make device_attribute const Bhumika Goyal
                   ` (4 preceding siblings ...)
  2017-08-21 11:43 ` [PATCH 5/6] platform/x86: " Bhumika Goyal
@ 2017-08-21 11:43 ` Bhumika Goyal
  2017-08-29  8:44   ` Sebastian Reichel
  2017-08-21 12:28 ` [PATCH 0/6] drivers: " Rafael J. Wysocki
  2017-08-21 12:55 ` Bhumika Goyal
  7 siblings, 1 reply; 18+ messages in thread
From: Bhumika Goyal @ 2017-08-21 11:43 UTC (permalink / raw)
  To: julia.lawall, rjw, lenb, jbacik, jikos, benjamin.tissoires,
	manish.chopra, rahul.verma, Dept-GELinuxNICDev, harish.patil,
	cascardo, don, dvhart, andy, sre, linux-acpi, linux-kernel,
	linux-block, nbd-general, linux-input, netdev,
	platform-driver-x86, linux-pm
  Cc: Bhumika Goyal

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/power/supply/olpc_battery.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/power/supply/olpc_battery.c b/drivers/power/supply/olpc_battery.c
index fc20ca3..3bc2eea 100644
--- a/drivers/power/supply/olpc_battery.c
+++ b/drivers/power/supply/olpc_battery.c
@@ -559,7 +559,7 @@ static ssize_t olpc_bat_error_read(struct device *dev,
 	return sprintf(buf, "%d\n", ec_byte);
 }
 
-static struct device_attribute olpc_bat_error = {
+static const struct device_attribute olpc_bat_error = {
 	.attr = {
 		.name = "error",
 		.mode = S_IRUGO,
-- 
1.9.1

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

* Re: [PATCH 0/6] drivers: make device_attribute const
  2017-08-21 11:43 [PATCH 0/6] drivers: make device_attribute const Bhumika Goyal
                   ` (5 preceding siblings ...)
  2017-08-21 11:43 ` [PATCH 6/6] power: supply: " Bhumika Goyal
@ 2017-08-21 12:28 ` Rafael J. Wysocki
  2017-08-21 12:57   ` Bhumika Goyal
  2017-08-21 12:55 ` Bhumika Goyal
  7 siblings, 1 reply; 18+ messages in thread
From: Rafael J. Wysocki @ 2017-08-21 12:28 UTC (permalink / raw)
  To: Bhumika Goyal
  Cc: Julia Lawall, Rafael J. Wysocki, Len Brown, jbacik, Jiri Kosina,
	Benjamin Tissoires, manish.chopra, rahul.verma,
	Dept-GELinuxNICDev, harish.patil, cascardo, don, Darren Hart,
	andy, Sebastian Reichel, ACPI Devel Maling List,
	Linux Kernel Mailing List, linux-block, nbd-general, linux-input,
	netdev, Platform Driver, Linux PM

On Mon, Aug 21, 2017 at 1:43 PM, Bhumika Goyal <bhumirks@gmail.com> wrote:
> Make these const. Done using Coccinelle.
>
> @match disable optional_qualifier@
> identifier s;
> @@
> static struct device_attribute s = {...};
>
> @ref@
> position p;
> identifier match.s;
> @@
> s@p
>
> @good1@
> identifier match.s;
> expression e1;
> position ref.p;
> @@
> device_remove_file(e1,&s@p,...)
>
> @good2@
> identifier match.s;
> expression e1;
> position ref.p;
> @@
> device_create_file(e1,&s@p,...)
>
>
> @bad depends on  !good1 && !good2@
> position ref.p;
> identifier match.s;
> @@
> s@p
>
> @depends on forall !bad disable optional_qualifier@
> identifier match.s;
> @@
> static
> + const
> struct device_attribute s;
>
> Bhumika Goyal (6):
>   ACPI: make device_attribute const
>   nbd: make device_attribute const
>   hid: make device_attribute const
>   qlogic:  make device_attribute const
>   platform/x86: make device_attribute const
>   power: supply: make device_attribute const

It would be better to send these patches separately, because they
touch code maintained by different people and I guess no one will take
the whole series.

I'll take care of the ACPI one, but the rest needs to go in via their
proper trees.

Thanks,
Rafael

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

* Re: [PATCH 0/6] drivers: make device_attribute const
  2017-08-21 11:43 [PATCH 0/6] drivers: make device_attribute const Bhumika Goyal
                   ` (6 preceding siblings ...)
  2017-08-21 12:28 ` [PATCH 0/6] drivers: " Rafael J. Wysocki
@ 2017-08-21 12:55 ` Bhumika Goyal
  7 siblings, 0 replies; 18+ messages in thread
From: Bhumika Goyal @ 2017-08-21 12:55 UTC (permalink / raw)
  To: Julia Lawall, rjw, Len Brown, jbacik, jikos, benjamin.tissoires,
	manish.chopra, rahul.verma, Dept-GELinuxNICDev, harish.patil,
	cascardo, don, dvhart, Andy Shevchenko, sre, linux-acpi,
	linux-kernel, linux-block, nbd-general, linux-input, netdev,
	Platform Driver, linux-pm
  Cc: Bhumika Goyal

On Mon, Aug 21, 2017 at 5:13 PM, Bhumika Goyal <bhumirks@gmail.com> wrote:
> Make these const. Done using Coccinelle.
>
> @match disable optional_qualifier@
> identifier s;
> @@
> static struct device_attribute s = {...};
>
> @ref@
> position p;
> identifier match.s;
> @@
> s@p
>
> @good1@
> identifier match.s;
> expression e1;
> position ref.p;
> @@
> device_remove_file(e1,&s@p,...)
>
> @good2@
> identifier match.s;
> expression e1;
> position ref.p;
> @@
> device_create_file(e1,&s@p,...)
>
>
> @bad depends on  !good1 && !good2@
> position ref.p;
> identifier match.s;
> @@
> s@p
>
> @depends on forall !bad disable optional_qualifier@
> identifier match.s;
> @@
> static
> + const
> struct device_attribute s;
>
> Bhumika Goyal (6):
>   ACPI: make device_attribute const
>   nbd: make device_attribute const
>   hid: make device_attribute const
>   qlogic:  make device_attribute const
>   platform/x86: make device_attribute const
>   power: supply: make device_attribute const
>

Hello all,

The patches are all independent, so please take what seems relevant.

Thanks,
Bhumika

>  drivers/acpi/battery.c                               | 2 +-
>  drivers/acpi/sbs.c                                   | 2 +-
>  drivers/block/nbd.c                                  | 2 +-
>  drivers/hid/hid-core.c                               | 2 +-
>  drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c | 4 ++--
>  drivers/net/ethernet/qlogic/qlcnic/qlcnic_sysfs.c    | 6 +++---
>  drivers/platform/x86/classmate-laptop.c              | 6 +++---
>  drivers/platform/x86/intel-rst.c                     | 4 ++--
>  drivers/power/supply/olpc_battery.c                  | 2 +-
>  9 files changed, 15 insertions(+), 15 deletions(-)
>
> --
> 1.9.1
>

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

* Re: [PATCH 0/6] drivers: make device_attribute const
  2017-08-21 12:28 ` [PATCH 0/6] drivers: " Rafael J. Wysocki
@ 2017-08-21 12:57   ` Bhumika Goyal
  0 siblings, 0 replies; 18+ messages in thread
From: Bhumika Goyal @ 2017-08-21 12:57 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: Julia Lawall, Rafael J. Wysocki, Len Brown, jbacik, Jiri Kosina,
	Benjamin Tissoires, manish.chopra, rahul.verma,
	Dept-GELinuxNICDev, harish.patil, cascardo, don, Darren Hart,
	Andy Shevchenko, Sebastian Reichel, ACPI Devel Maling List,
	Linux Kernel Mailing List, linux-block, nbd-general, linux-input,
	netdev, Platform Driver, Linux PM

On Mon, Aug 21, 2017 at 5:58 PM, Rafael J. Wysocki <rafael@kernel.org> wrote:
> On Mon, Aug 21, 2017 at 1:43 PM, Bhumika Goyal <bhumirks@gmail.com> wrote:
>> Make these const. Done using Coccinelle.
>>
>> @match disable optional_qualifier@
>> identifier s;
>> @@
>> static struct device_attribute s = {...};
>>
>> @ref@
>> position p;
>> identifier match.s;
>> @@
>> s@p
>>
>> @good1@
>> identifier match.s;
>> expression e1;
>> position ref.p;
>> @@
>> device_remove_file(e1,&s@p,...)
>>
>> @good2@
>> identifier match.s;
>> expression e1;
>> position ref.p;
>> @@
>> device_create_file(e1,&s@p,...)
>>
>>
>> @bad depends on  !good1 && !good2@
>> position ref.p;
>> identifier match.s;
>> @@
>> s@p
>>
>> @depends on forall !bad disable optional_qualifier@
>> identifier match.s;
>> @@
>> static
>> + const
>> struct device_attribute s;
>>
>> Bhumika Goyal (6):
>>   ACPI: make device_attribute const
>>   nbd: make device_attribute const
>>   hid: make device_attribute const
>>   qlogic:  make device_attribute const
>>   platform/x86: make device_attribute const
>>   power: supply: make device_attribute const
>
> It would be better to send these patches separately, because they
> touch code maintained by different people and I guess no one will take
> the whole series.
>
> I'll take care of the ACPI one, but the rest needs to go in via their
> proper trees.
>

Thanks for the note. From now onwards, I will send it separately
depending on the maintainers. But is possible please consider it this
time.

Thanks,
Bhumika

> Thanks,
> Rafael

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

* Re: [PATCH 5/6] platform/x86: make device_attribute const
  2017-08-21 11:43 ` [PATCH 5/6] platform/x86: " Bhumika Goyal
@ 2017-08-21 13:22   ` Thadeu Lima de Souza Cascardo
  2017-08-30 19:18   ` Andy Shevchenko
  1 sibling, 0 replies; 18+ messages in thread
From: Thadeu Lima de Souza Cascardo @ 2017-08-21 13:22 UTC (permalink / raw)
  To: Bhumika Goyal
  Cc: julia.lawall, rjw, lenb, jbacik, jikos, benjamin.tissoires,
	manish.chopra, rahul.verma, Dept-GELinuxNICDev, harish.patil,
	don, dvhart, andy, sre, linux-acpi, linux-kernel, linux-block,
	nbd-general, linux-input, netdev, platform-driver-x86, linux-pm

For classmate-laptop.c

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

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

* Re: [PATCH 4/6] qlogic: make device_attribute const
  2017-08-21 11:43 ` [PATCH 4/6] qlogic: " Bhumika Goyal
@ 2017-08-21 17:25   ` David Miller
  2017-08-21 17:26     ` Bhumika Goyal
  0 siblings, 1 reply; 18+ messages in thread
From: David Miller @ 2017-08-21 17:25 UTC (permalink / raw)
  To: bhumirks
  Cc: julia.lawall, rjw, lenb, jbacik, jikos, benjamin.tissoires,
	manish.chopra, rahul.verma, Dept-GELinuxNICDev, harish.patil,
	cascardo, don, dvhart, andy, sre, linux-acpi, linux-kernel,
	linux-block, nbd-general, linux-input, netdev,
	platform-driver-x86, linux-pm

From: Bhumika Goyal <bhumirks@gmail.com>
Date: Mon, 21 Aug 2017 17:13:10 +0530

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

Applied.

But I would seriously suggest that when you have to cross subsystems
like this, just send the patches individually to the respective
maintainers rather than trying to make a "series" out of it.

Thanks.

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

* Re: [PATCH 4/6] qlogic: make device_attribute const
  2017-08-21 17:25   ` David Miller
@ 2017-08-21 17:26     ` Bhumika Goyal
  0 siblings, 0 replies; 18+ messages in thread
From: Bhumika Goyal @ 2017-08-21 17:26 UTC (permalink / raw)
  To: David Miller
  Cc: Julia Lawall, Rafael J. Wysocki, Len Brown, jbacik, Jiri Kosina,
	Benjamin Tissoires, manish.chopra, rahul.verma,
	Dept-GELinuxNICDev, harish.patil, cascardo, don, Darren Hart,
	Andy Shevchenko, Sebastian Reichel, ACPI Devel Maling List,
	Linux Kernel Mailing List, linux-block, nbd-general, linux-input,
	netdev, Platform Driver, Linux PM

On Mon, Aug 21, 2017 at 10:55 PM, David Miller <davem@davemloft.net> wrote:
> From: Bhumika Goyal <bhumirks@gmail.com>
> Date: Mon, 21 Aug 2017 17:13:10 +0530
>
>> 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>
>
> Applied.
>
> But I would seriously suggest that when you have to cross subsystems
> like this, just send the patches individually to the respective
> maintainers rather than trying to make a "series" out of it.
>

Yes, noted. Thanks for the pointer.

Thanks,
Bhumika

> Thanks.

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

* Re: [PATCH 1/6] ACPI: make device_attribute const
  2017-08-21 11:43 ` [PATCH 1/6] ACPI: " Bhumika Goyal
@ 2017-08-28 20:56   ` Rafael J. Wysocki
  0 siblings, 0 replies; 18+ messages in thread
From: Rafael J. Wysocki @ 2017-08-28 20:56 UTC (permalink / raw)
  To: Bhumika Goyal
  Cc: julia.lawall, lenb, jbacik, jikos, benjamin.tissoires,
	manish.chopra, rahul.verma, Dept-GELinuxNICDev, harish.patil,
	cascardo, don, dvhart, andy, sre, linux-acpi, linux-kernel,
	linux-block, nbd-general, linux-input, netdev,
	platform-driver-x86, linux-pm

On Monday, August 21, 2017 1:43:07 PM CEST Bhumika Goyal 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
> 
> Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
> ---
>  drivers/acpi/battery.c | 2 +-
>  drivers/acpi/sbs.c     | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c
> index 1cbb88d..13e7b56 100644
> --- a/drivers/acpi/battery.c
> +++ b/drivers/acpi/battery.c
> @@ -620,7 +620,7 @@ static ssize_t acpi_battery_alarm_store(struct device *dev,
>  	return count;
>  }
>  
> -static struct device_attribute alarm_attr = {
> +static const struct device_attribute alarm_attr = {
>  	.attr = {.name = "alarm", .mode = 0644},
>  	.show = acpi_battery_alarm_show,
>  	.store = acpi_battery_alarm_store,
> diff --git a/drivers/acpi/sbs.c b/drivers/acpi/sbs.c
> index a184637..a2428e9 100644
> --- a/drivers/acpi/sbs.c
> +++ b/drivers/acpi/sbs.c
> @@ -474,7 +474,7 @@ static ssize_t acpi_battery_alarm_store(struct device *dev,
>  	return count;
>  }
>  
> -static struct device_attribute alarm_attr = {
> +static const struct device_attribute alarm_attr = {
>  	.attr = {.name = "alarm", .mode = 0644},
>  	.show = acpi_battery_alarm_show,
>  	.store = acpi_battery_alarm_store,
> 

Applied, thanks!



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

* Re: [PATCH 2/6] nbd: make device_attribute const
  2017-08-21 11:43   ` [PATCH 2/6] nbd: " Bhumika Goyal
@ 2017-08-28 21:21     ` Jens Axboe
  0 siblings, 0 replies; 18+ messages in thread
From: Jens Axboe @ 2017-08-28 21:21 UTC (permalink / raw)
  To: Bhumika Goyal, julia.lawall, rjw, lenb, jbacik, jikos,
	benjamin.tissoires, manish.chopra, rahul.verma,
	Dept-GELinuxNICDev, harish.patil, cascardo, don, dvhart, andy,
	sre, linux-acpi, linux-kernel, linux-block, nbd-general,
	linux-input, netdev, platform-driver-x86, linux-pm

On 08/21/2017 05:43 AM, Bhumika Goyal wrote:
> Make this const as is is 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

Added for 4.14, thanks.

-- 
Jens Axboe

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

* Re: [PATCH 6/6] power: supply: make device_attribute const
  2017-08-21 11:43 ` [PATCH 6/6] power: supply: " Bhumika Goyal
@ 2017-08-29  8:44   ` Sebastian Reichel
  0 siblings, 0 replies; 18+ messages in thread
From: Sebastian Reichel @ 2017-08-29  8:44 UTC (permalink / raw)
  To: Bhumika Goyal
  Cc: julia.lawall, rjw, lenb, jbacik, jikos, benjamin.tissoires,
	manish.chopra, rahul.verma, Dept-GELinuxNICDev, harish.patil,
	cascardo, don, dvhart, andy, linux-acpi, linux-kernel,
	linux-block, nbd-general, linux-input, netdev,
	platform-driver-x86, linux-pm

[-- Attachment #1: Type: text/plain, Size: 1013 bytes --]

Hi,

On Mon, Aug 21, 2017 at 05:13:12PM +0530, Bhumika Goyal 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.
> 
> Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
> ---

Thanks, queued.

-- Sebastian

>  drivers/power/supply/olpc_battery.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/power/supply/olpc_battery.c b/drivers/power/supply/olpc_battery.c
> index fc20ca3..3bc2eea 100644
> --- a/drivers/power/supply/olpc_battery.c
> +++ b/drivers/power/supply/olpc_battery.c
> @@ -559,7 +559,7 @@ static ssize_t olpc_bat_error_read(struct device *dev,
>  	return sprintf(buf, "%d\n", ec_byte);
>  }
>  
> -static struct device_attribute olpc_bat_error = {
> +static const struct device_attribute olpc_bat_error = {
>  	.attr = {
>  		.name = "error",
>  		.mode = S_IRUGO,
> -- 
> 1.9.1
> 

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: [PATCH 5/6] platform/x86: make device_attribute const
  2017-08-21 11:43 ` [PATCH 5/6] platform/x86: " Bhumika Goyal
  2017-08-21 13:22   ` Thadeu Lima de Souza Cascardo
@ 2017-08-30 19:18   ` Andy Shevchenko
  1 sibling, 0 replies; 18+ messages in thread
From: Andy Shevchenko @ 2017-08-30 19:18 UTC (permalink / raw)
  To: Bhumika Goyal
  Cc: Julia Lawall, Rafael J. Wysocki, Len Brown, Josef Bacik,
	Jiri Kosina, Benjamin Tissoires, manish.chopra, rahul.verma,
	Dept-GELinuxNICDev, harish.patil, cascardo, don, dvhart,
	Andy Shevchenko, Sebastian Reichel, linux-acpi, linux-kernel,
	linux-block, nbd-general, linux-input, netdev, Platform Driver

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
>



-- 
With Best Regards,
Andy Shevchenko

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

* Re: [PATCH 3/6] hid: make device_attribute const
  2017-08-21 11:43 ` [PATCH 3/6] hid: " Bhumika Goyal
@ 2017-09-06  8:57   ` Jiri Kosina
  0 siblings, 0 replies; 18+ messages in thread
From: Jiri Kosina @ 2017-09-06  8:57 UTC (permalink / raw)
  To: Bhumika Goyal
  Cc: julia.lawall, rjw, lenb, jbacik, benjamin.tissoires,
	manish.chopra, rahul.verma, Dept-GELinuxNICDev, harish.patil,
	cascardo, don, dvhart, andy, sre, linux-acpi, linux-kernel,
	linux-block, nbd-general, linux-input, netdev,
	platform-driver-x86, linux-pm

On Mon, 21 Aug 2017, Bhumika Goyal wrote:

> Make this const as it is 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/hid/hid-core.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
> index 9bc9116..24e929c 100644
> --- a/drivers/hid/hid-core.c
> +++ b/drivers/hid/hid-core.c
> @@ -1662,7 +1662,7 @@ static bool hid_hiddev(struct hid_device *hdev)
>  	.size = HID_MAX_DESCRIPTOR_SIZE,
>  };
>  
> -static struct device_attribute dev_attr_country = {
> +static const struct device_attribute dev_attr_country = {
>  	.attr = { .name = "country", .mode = 0444 },
>  	.show = show_country,

Applied, thanks.

-- 
Jiri Kosina
SUSE Labs


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

end of thread, other threads:[~2017-09-06  8:57 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-21 11:43 [PATCH 0/6] drivers: make device_attribute const Bhumika Goyal
2017-08-21 11:43 ` [PATCH 1/6] ACPI: " Bhumika Goyal
2017-08-28 20:56   ` Rafael J. Wysocki
     [not found] ` <1503315792-14837-1-git-send-email-bhumirks-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-08-21 11:43   ` [PATCH 2/6] nbd: " Bhumika Goyal
2017-08-28 21:21     ` Jens Axboe
2017-08-21 11:43 ` [PATCH 3/6] hid: " Bhumika Goyal
2017-09-06  8:57   ` Jiri Kosina
2017-08-21 11:43 ` [PATCH 4/6] qlogic: " Bhumika Goyal
2017-08-21 17:25   ` David Miller
2017-08-21 17:26     ` Bhumika Goyal
2017-08-21 11:43 ` [PATCH 5/6] platform/x86: " Bhumika Goyal
2017-08-21 13:22   ` Thadeu Lima de Souza Cascardo
2017-08-30 19:18   ` Andy Shevchenko
2017-08-21 11:43 ` [PATCH 6/6] power: supply: " Bhumika Goyal
2017-08-29  8:44   ` Sebastian Reichel
2017-08-21 12:28 ` [PATCH 0/6] drivers: " Rafael J. Wysocki
2017-08-21 12:57   ` Bhumika Goyal
2017-08-21 12:55 ` Bhumika Goyal

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