Re: [PATCH 4/6] qlogic: make device_attribute const
On Mon, Aug 21, 2017 at 10:55 PM, David Miller <da...@davemloft.net> wrote: > From: Bhumika Goyal <bhumi...@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 <bhumi...@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.
Re: [PATCH 0/6] drivers: make device_attribute const
On Mon, Aug 21, 2017 at 5:58 PM, Rafael J. Wysocki <raf...@kernel.org> wrote: > On Mon, Aug 21, 2017 at 1:43 PM, Bhumika Goyal <bhumi...@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,@p,...) >> >> @good2@ >> identifier match.s; >> expression e1; >> position ref.p; >> @@ >> device_create_file(e1,@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
Re: [PATCH 0/6] drivers: make device_attribute const
On Mon, Aug 21, 2017 at 5:13 PM, Bhumika Goyal <bhumi...@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,@p,...) > > @good2@ > identifier match.s; > expression e1; > position ref.p; > @@ > device_create_file(e1,@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 >
[PATCH 1/6] ACPI: make device_attribute const
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 <bhumi...@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
[PATCH 2/6] nbd: make device_attribute const
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 <bhumi...@gmail.com> --- 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
[PATCH 3/6] hid: make device_attribute const
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 <bhumi...@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
[PATCH 6/6] power: supply: make device_attribute const
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 <bhumi...@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
[PATCH 4/6] qlogic: make device_attribute const
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 <bhumi...@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
[PATCH 5/6] platform/x86: make device_attribute const
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 <bhumi...@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 0/6] drivers: make device_attribute const
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,@p,...) @good2@ identifier match.s; expression e1; position ref.p; @@ device_create_file(e1,@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