Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1716363 > unrolled thread

[PATCH 0/6] drivers: make device_attribute const

Started byBhumika Goyal <bhumirks@gmail.com>
First post2017-08-21 13:50 +0200
Last post2017-08-21 15:00 +0200
Articles 9 — 3 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH 0/6] drivers:  make device_attribute const Bhumika Goyal <bhumirks@gmail.com> - 2017-08-21 13:50 +0200
    [PATCH 2/6] nbd: make device_attribute const Bhumika Goyal <bhumirks@gmail.com> - 2017-08-21 13:50 +0200
    [PATCH 3/6] hid: make device_attribute const Bhumika Goyal <bhumirks@gmail.com> - 2017-08-21 13:50 +0200
    [PATCH 4/6] qlogic:  make device_attribute const Bhumika Goyal <bhumirks@gmail.com> - 2017-08-21 13:50 +0200
      Re: [PATCH 4/6] qlogic: make device_attribute const David Miller <davem@davemloft.net> - 2017-08-21 19:30 +0200
        Re: [PATCH 4/6] qlogic: make device_attribute const Bhumika Goyal <bhumirks@gmail.com> - 2017-08-21 19:30 +0200
    Re: [PATCH 0/6] drivers: make device_attribute const "Rafael J. Wysocki" <rafael@kernel.org> - 2017-08-21 14:30 +0200
      Re: [PATCH 0/6] drivers: make device_attribute const Bhumika Goyal <bhumirks@gmail.com> - 2017-08-21 15:00 +0200
    Re: [PATCH 0/6] drivers: make device_attribute const Bhumika Goyal <bhumirks@gmail.com> - 2017-08-21 15:00 +0200

#1716363 — [PATCH 0/6] drivers: make device_attribute const

FromBhumika Goyal <bhumirks@gmail.com>
Date2017-08-21 13:50 +0200
Subject[PATCH 0/6] drivers: make device_attribute const
Message-ID<ugTnr-3Rl-5@gated-at.bofh.it>
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

[toc] | [next] | [standalone]


#1716364 — [PATCH 2/6] nbd: make device_attribute const

FromBhumika Goyal <bhumirks@gmail.com>
Date2017-08-21 13:50 +0200
Subject[PATCH 2/6] nbd: make device_attribute const
Message-ID<ugTns-3Rl-21@gated-at.bofh.it>
In reply to#1716363
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@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

[toc] | [prev] | [next] | [standalone]


#1716365 — [PATCH 3/6] hid: make device_attribute const

FromBhumika Goyal <bhumirks@gmail.com>
Date2017-08-21 13:50 +0200
Subject[PATCH 3/6] hid: make device_attribute const
Message-ID<ugTns-3Rl-33@gated-at.bofh.it>
In reply to#1716363
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

[toc] | [prev] | [next] | [standalone]


#1716367 — [PATCH 4/6] qlogic: make device_attribute const

FromBhumika Goyal <bhumirks@gmail.com>
Date2017-08-21 13:50 +0200
Subject[PATCH 4/6] qlogic: make device_attribute const
Message-ID<ugTnt-3Rl-39@gated-at.bofh.it>
In reply to#1716363
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

[toc] | [prev] | [next] | [standalone]


#1716735 — Re: [PATCH 4/6] qlogic: make device_attribute const

FromDavid Miller <davem@davemloft.net>
Date2017-08-21 19:30 +0200
SubjectRe: [PATCH 4/6] qlogic: make device_attribute const
Message-ID<ugYGt-7g4-1@gated-at.bofh.it>
In reply to#1716367
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.

[toc] | [prev] | [next] | [standalone]


#1716740 — Re: [PATCH 4/6] qlogic: make device_attribute const

FromBhumika Goyal <bhumirks@gmail.com>
Date2017-08-21 19:30 +0200
SubjectRe: [PATCH 4/6] qlogic: make device_attribute const
Message-ID<ugYGu-7g4-15@gated-at.bofh.it>
In reply to#1716735
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.

[toc] | [prev] | [next] | [standalone]


#1716396 — Re: [PATCH 0/6] drivers: make device_attribute const

From"Rafael J. Wysocki" <rafael@kernel.org>
Date2017-08-21 14:30 +0200
SubjectRe: [PATCH 0/6] drivers: make device_attribute const
Message-ID<ugU0a-4jm-23@gated-at.bofh.it>
In reply to#1716363
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

[toc] | [prev] | [next] | [standalone]


#1716422 — Re: [PATCH 0/6] drivers: make device_attribute const

FromBhumika Goyal <bhumirks@gmail.com>
Date2017-08-21 15:00 +0200
SubjectRe: [PATCH 0/6] drivers: make device_attribute const
Message-ID<ugUtb-4t7-1@gated-at.bofh.it>
In reply to#1716396
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

[toc] | [prev] | [next] | [standalone]


#1716424 — Re: [PATCH 0/6] drivers: make device_attribute const

FromBhumika Goyal <bhumirks@gmail.com>
Date2017-08-21 15:00 +0200
SubjectRe: [PATCH 0/6] drivers: make device_attribute const
Message-ID<ugUtb-4t7-13@gated-at.bofh.it>
In reply to#1716363
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
>

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web