Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1511882 > unrolled thread
| Started by | Julia Lawall <Julia.Lawall@lip6.fr> |
|---|---|
| First post | 2016-10-29 22:00 +0200 |
| Last post | 2016-10-30 16:10 +0100 |
| Articles | 10 — 4 participants |
Back to article view | Back to linux.kernel
[PATCH 00/15] use permission-specific DEVICE_ATTR variants Julia Lawall <Julia.Lawall@lip6.fr> - 2016-10-29 22:00 +0200
[PATCH 01/15] wusbcore: dev-sysfs: use permission-specific DEVICE_ATTR variants Julia Lawall <Julia.Lawall@lip6.fr> - 2016-10-29 22:00 +0200
[PATCH 12/15] ptp: use permission-specific DEVICE_ATTR variants Julia Lawall <Julia.Lawall@lip6.fr> - 2016-10-29 22:00 +0200
Re: [PATCH 12/15] ptp: use permission-specific DEVICE_ATTR variants Richard Cochran <richardcochran@gmail.com> - 2016-10-31 10:40 +0100
Re: [PATCH 12/15] ptp: use permission-specific DEVICE_ATTR variants David Miller <davem@davemloft.net> - 2016-10-31 20:40 +0100
[PATCH 07/15] thermal: hwmon: use permission-specific DEVICE_ATTR variants Julia Lawall <Julia.Lawall@lip6.fr> - 2016-10-29 22:00 +0200
[PATCH 14/15] tty: nozomi: use permission-specific DEVICE_ATTR variants Julia Lawall <Julia.Lawall@lip6.fr> - 2016-10-29 22:00 +0200
[PATCH 13/15] PCI/ASPM: use permission-specific DEVICE_ATTR variants Julia Lawall <Julia.Lawall@lip6.fr> - 2016-10-29 22:00 +0200
[PATCH 03/15] wm8350_power: use permission-specific DEVICE_ATTR variants Julia Lawall <Julia.Lawall@lip6.fr> - 2016-10-29 22:00 +0200
Re: [PATCH 03/15] wm8350_power: use permission-specific DEVICE_ATTR variants Charles Keepax <ckeepax@opensource.wolfsonmicro.com> - 2016-10-30 16:10 +0100
| From | Julia Lawall <Julia.Lawall@lip6.fr> |
|---|---|
| Date | 2016-10-29 22:00 +0200 |
| Subject | [PATCH 00/15] use permission-specific DEVICE_ATTR variants |
| Message-ID | <sxHXj-2qm-3@gated-at.bofh.it> |
Use DEVICE_ATTR_RO etc. for read only attributes etc. This simplifies the source code, improves readbility, and reduces the chance of inconsistencies. The complete semantic patch is as follows: (http://coccinelle.lip6.fr/) // <smpl> @ro@ declarer name DEVICE_ATTR; identifier x,x_show; @@ DEVICE_ATTR(x, \(0444\|S_IRUGO\), x_show, NULL); @wo@ declarer name DEVICE_ATTR; identifier x,x_store; @@ DEVICE_ATTR(x, \(0200\|S_IWUSR\), NULL, x_store); @rw@ declarer name DEVICE_ATTR; identifier x,x_show,x_store; @@ DEVICE_ATTR(x, \(0644\|S_IRUGO|S_IWUSR\), x_show, x_store); @script:ocaml@ x << ro.x; x_show << ro.x_show; @@ if not (x^"_show" = x_show) then Coccilib.include_match false @script:ocaml@ x << wo.x; x_store << wo.x_store; @@ if not (x^"_store" = x_store) then Coccilib.include_match false @script:ocaml@ x << rw.x; x_show << rw.x_show; x_store << rw.x_store; @@ if not (x^"_show" = x_show && x^"_store" = x_store) then Coccilib.include_match false @@ declarer name DEVICE_ATTR_RO; identifier ro.x,ro.x_show; @@ - DEVICE_ATTR(x, \(0444\|S_IRUGO\), x_show, NULL); + DEVICE_ATTR_RO(x); @@ declarer name DEVICE_ATTR_WO; identifier wo.x,wo.x_store; @@ - DEVICE_ATTR(x, \(0200\|S_IWUSR\), NULL, x_store); + DEVICE_ATTR_WO(x); @@ declarer name DEVICE_ATTR_RW; identifier rw.x,rw.x_show,rw.x_store; @@ - DEVICE_ATTR(x, \(0644\|S_IRUGO|S_IWUSR\), x_show, x_store); + DEVICE_ATTR_RW(x); // </smpl> --- arch/mips/txx9/generic/7segled.c | 4 ++-- arch/powerpc/kernel/iommu.c | 3 +-- arch/tile/kernel/sysfs.c | 14 +++++++------- drivers/atm/solos-pci.c | 2 +- drivers/pci/pcie/aspm.c | 4 ++-- drivers/power/supply/wm8350_power.c | 2 +- drivers/ptp/ptp_sysfs.c | 2 +- drivers/thermal/int340x_thermal/int3400_thermal.c | 2 +- drivers/thermal/thermal_hwmon.c | 2 +- drivers/tty/nozomi.c | 4 ++-- drivers/usb/wusbcore/dev-sysfs.c | 6 +++--- drivers/usb/wusbcore/wusbhc.c | 13 +++++-------- drivers/video/fbdev/wm8505fb.c | 2 +- sound/soc/omap/mcbsp.c | 4 ++-- sound/soc/soc-dapm.c | 2 +- 15 files changed, 31 insertions(+), 35 deletions(-)
[toc] | [next] | [standalone]
| From | Julia Lawall <Julia.Lawall@lip6.fr> |
|---|---|
| Date | 2016-10-29 22:00 +0200 |
| Subject | [PATCH 01/15] wusbcore: dev-sysfs: use permission-specific DEVICE_ATTR variants |
| Message-ID | <sxHXj-2qm-27@gated-at.bofh.it> |
| In reply to | #1511882 |
Use DEVICE_ATTR_WO for write ony attributes and DEVICE_ATTR_RO for read
only attributes. This simplifies the source code, improves readbility,
and reduces the chance of inconsistencies.
The semantic patch for the RO case is as follows:
(http://coccinelle.lip6.fr/)
// <smpl>
@ro@
declarer name DEVICE_ATTR;
identifier x,x_show;
@@
DEVICE_ATTR(x, \(0444\|S_IRUGO\), x_show, NULL);
@script:ocaml@
x << ro.x;
x_show << ro.x_show;
@@
if not (x^"_show" = x_show) then Coccilib.include_match false
@@
declarer name DEVICE_ATTR_RO;
identifier ro.x,ro.x_show;
@@
- DEVICE_ATTR(x, \(0444\|S_IRUGO\), x_show, NULL);
+ DEVICE_ATTR_RO(x);
// </smpl>
Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
---
drivers/usb/wusbcore/dev-sysfs.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/usb/wusbcore/dev-sysfs.c b/drivers/usb/wusbcore/dev-sysfs.c
index 415b140..d4de56b 100644
--- a/drivers/usb/wusbcore/dev-sysfs.c
+++ b/drivers/usb/wusbcore/dev-sysfs.c
@@ -53,7 +53,7 @@ static ssize_t wusb_disconnect_store(struct device *dev,
wusbhc_put(wusbhc);
return size;
}
-static DEVICE_ATTR(wusb_disconnect, 0200, NULL, wusb_disconnect_store);
+static DEVICE_ATTR_WO(wusb_disconnect);
static ssize_t wusb_cdid_show(struct device *dev,
struct device_attribute *attr, char *buf)
@@ -69,7 +69,7 @@ static ssize_t wusb_cdid_show(struct device *dev,
wusb_dev_put(wusb_dev);
return result + 1;
}
-static DEVICE_ATTR(wusb_cdid, 0444, wusb_cdid_show, NULL);
+static DEVICE_ATTR_RO(wusb_cdid);
static ssize_t wusb_ck_store(struct device *dev,
struct device_attribute *attr,
@@ -105,7 +105,7 @@ static ssize_t wusb_ck_store(struct device *dev,
wusbhc_put(wusbhc);
return result < 0 ? result : size;
}
-static DEVICE_ATTR(wusb_ck, 0200, NULL, wusb_ck_store);
+static DEVICE_ATTR_WO(wusb_ck);
static struct attribute *wusb_dev_attrs[] = {
&dev_attr_wusb_disconnect.attr,
[toc] | [prev] | [next] | [standalone]
| From | Julia Lawall <Julia.Lawall@lip6.fr> |
|---|---|
| Date | 2016-10-29 22:00 +0200 |
| Subject | [PATCH 12/15] ptp: use permission-specific DEVICE_ATTR variants |
| Message-ID | <sxHXk-2qm-31@gated-at.bofh.it> |
| In reply to | #1511882 |
Use DEVICE_ATTR_RO for read only attributes. This simplifies the source code, improves readbility, and reduces the chance of inconsistencies. The semantic patch that makes this change is as follows: (http://coccinelle.lip6.fr/) // <smpl> @ro@ declarer name DEVICE_ATTR; identifier x,x_show; @@ DEVICE_ATTR(x, \(0444\|S_IRUGO\), x_show, NULL); @script:ocaml@ x << ro.x; x_show << ro.x_show; @@ if not (x^"_show" = x_show) then Coccilib.include_match false @@ declarer name DEVICE_ATTR_RO; identifier ro.x,ro.x_show; @@ - DEVICE_ATTR(x, \(0444\|S_IRUGO\), x_show, NULL); + DEVICE_ATTR_RO(x); // </smpl> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr> --- drivers/ptp/ptp_sysfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/ptp/ptp_sysfs.c b/drivers/ptp/ptp_sysfs.c index 302e626..53d4395 100644 --- a/drivers/ptp/ptp_sysfs.c +++ b/drivers/ptp/ptp_sysfs.c @@ -28,7 +28,7 @@ static ssize_t clock_name_show(struct device *dev, struct ptp_clock *ptp = dev_get_drvdata(dev); return snprintf(page, PAGE_SIZE-1, "%s\n", ptp->info->name); } -static DEVICE_ATTR(clock_name, 0444, clock_name_show, NULL); +static DEVICE_ATTR_RO(clock_name); #define PTP_SHOW_INT(name, var) \ static ssize_t var##_show(struct device *dev, \
[toc] | [prev] | [next] | [standalone]
| From | Richard Cochran <richardcochran@gmail.com> |
|---|---|
| Date | 2016-10-31 10:40 +0100 |
| Subject | Re: [PATCH 12/15] ptp: use permission-specific DEVICE_ATTR variants |
| Message-ID | <syhep-us-5@gated-at.bofh.it> |
| In reply to | #1511884 |
On Sat, Oct 29, 2016 at 09:37:06PM +0200, Julia Lawall wrote: > Use DEVICE_ATTR_RO for read only attributes. This simplifies the > source code, improves readbility, and reduces the chance of > inconsistencies. Acked-by: Richard Cochran <richardcochran@gmail.com>
[toc] | [prev] | [next] | [standalone]
| From | David Miller <davem@davemloft.net> |
|---|---|
| Date | 2016-10-31 20:40 +0100 |
| Subject | Re: [PATCH 12/15] ptp: use permission-specific DEVICE_ATTR variants |
| Message-ID | <syqB3-6Fs-9@gated-at.bofh.it> |
| In reply to | #1511884 |
From: Julia Lawall <Julia.Lawall@lip6.fr> Date: Sat, 29 Oct 2016 21:37:06 +0200 > Use DEVICE_ATTR_RO for read only attributes. This simplifies the > source code, improves readbility, and reduces the chance of > inconsistencies. > > The semantic patch that makes this change is as follows: > (http://coccinelle.lip6.fr/) ... > Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr> Also applied to net-next, thank you.
[toc] | [prev] | [next] | [standalone]
| From | Julia Lawall <Julia.Lawall@lip6.fr> |
|---|---|
| Date | 2016-10-29 22:00 +0200 |
| Subject | [PATCH 07/15] thermal: hwmon: use permission-specific DEVICE_ATTR variants |
| Message-ID | <sxHXk-2qm-33@gated-at.bofh.it> |
| In reply to | #1511882 |
Use DEVICE_ATTR_RO for read only attributes. This simplifies the
source code, improves readbility, and reduces the chance of
inconsistencies.
The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)
// <smpl>
@ro@
declarer name DEVICE_ATTR;
identifier x,x_show;
@@
DEVICE_ATTR(x, \(0444\|S_IRUGO\), x_show, NULL);
@script:ocaml@
x << ro.x;
x_show << ro.x_show;
@@
if not (x^"_show" = x_show) then Coccilib.include_match false
@@
declarer name DEVICE_ATTR_RO;
identifier ro.x,ro.x_show;
@@
- DEVICE_ATTR(x, \(0444\|S_IRUGO\), x_show, NULL);
+ DEVICE_ATTR_RO(x);
// </smpl>
Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
---
drivers/thermal/thermal_hwmon.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/thermal/thermal_hwmon.c b/drivers/thermal/thermal_hwmon.c
index c41c774..8c45de6 100644
--- a/drivers/thermal/thermal_hwmon.c
+++ b/drivers/thermal/thermal_hwmon.c
@@ -64,7 +64,7 @@ struct thermal_hwmon_temp {
struct thermal_hwmon_device *hwmon = dev_get_drvdata(dev);
return sprintf(buf, "%s\n", hwmon->type);
}
-static DEVICE_ATTR(name, 0444, name_show, NULL);
+static DEVICE_ATTR_RO(name);
static ssize_t
temp_input_show(struct device *dev, struct device_attribute *attr, char *buf)
[toc] | [prev] | [next] | [standalone]
| From | Julia Lawall <Julia.Lawall@lip6.fr> |
|---|---|
| Date | 2016-10-29 22:00 +0200 |
| Subject | [PATCH 14/15] tty: nozomi: use permission-specific DEVICE_ATTR variants |
| Message-ID | <sxHXk-2qm-35@gated-at.bofh.it> |
| In reply to | #1511882 |
Use DEVICE_ATTR_RO for read only attributes. This simplifies the
source code, improves readbility, and reduces the chance of
inconsistencies.
The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)
// <smpl>
@ro@
declarer name DEVICE_ATTR;
identifier x,x_show;
@@
DEVICE_ATTR(x, \(0444\|S_IRUGO\), x_show, NULL);
@script:ocaml@
x << ro.x;
x_show << ro.x_show;
@@
if not (x^"_show" = x_show) then Coccilib.include_match false
@@
declarer name DEVICE_ATTR_RO;
identifier ro.x,ro.x_show;
@@
- DEVICE_ATTR(x, \(0444\|S_IRUGO\), x_show, NULL);
+ DEVICE_ATTR_RO(x);
// </smpl>
Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
---
drivers/tty/nozomi.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/tty/nozomi.c b/drivers/tty/nozomi.c
index d6fd0e8..e2020a6 100644
--- a/drivers/tty/nozomi.c
+++ b/drivers/tty/nozomi.c
@@ -1320,7 +1320,7 @@ static ssize_t card_type_show(struct device *dev, struct device_attribute *attr,
return sprintf(buf, "%d\n", dc->card_type);
}
-static DEVICE_ATTR(card_type, S_IRUGO, card_type_show, NULL);
+static DEVICE_ATTR_RO(card_type);
static ssize_t open_ttys_show(struct device *dev, struct device_attribute *attr,
char *buf)
@@ -1329,7 +1329,7 @@ static ssize_t open_ttys_show(struct device *dev, struct device_attribute *attr,
return sprintf(buf, "%u\n", dc->open_ttys);
}
-static DEVICE_ATTR(open_ttys, S_IRUGO, open_ttys_show, NULL);
+static DEVICE_ATTR_RO(open_ttys);
static void make_sysfs_files(struct nozomi *dc)
{
[toc] | [prev] | [next] | [standalone]
| From | Julia Lawall <Julia.Lawall@lip6.fr> |
|---|---|
| Date | 2016-10-29 22:00 +0200 |
| Subject | [PATCH 13/15] PCI/ASPM: use permission-specific DEVICE_ATTR variants |
| Message-ID | <sxHXk-2qm-37@gated-at.bofh.it> |
| In reply to | #1511882 |
Use DEVICE_ATTR_RW for read-write attributes. This simplifies the source code, improves readbility, and reduces the chance of inconsistencies. The semantic patch that makes this change is as follows: (http://coccinelle.lip6.fr/) // <smpl> @rw@ declarer name DEVICE_ATTR; identifier x,x_show,x_store; @@ DEVICE_ATTR(x, \(0644\|S_IRUGO|S_IWUSR\), x_show, x_store); @script:ocaml@ x << rw.x; x_show << rw.x_show; x_store << rw.x_store; @@ if not (x^"_show" = x_show && x^"_store" = x_store) then Coccilib.include_match false @@ declarer name DEVICE_ATTR_RW; identifier rw.x,rw.x_show,rw.x_store; @@ - DEVICE_ATTR(x, \(0644\|S_IRUGO|S_IWUSR\), x_show, x_store); + DEVICE_ATTR_RW(x); // </smpl> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr> --- drivers/pci/pcie/aspm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/pci/pcie/aspm.c b/drivers/pci/pcie/aspm.c index 0ec649d..3b14d9e 100644 --- a/drivers/pci/pcie/aspm.c +++ b/drivers/pci/pcie/aspm.c @@ -886,8 +886,8 @@ static ssize_t clk_ctl_store(struct device *dev, return n; } -static DEVICE_ATTR(link_state, 0644, link_state_show, link_state_store); -static DEVICE_ATTR(clk_ctl, 0644, clk_ctl_show, clk_ctl_store); +static DEVICE_ATTR_RW(link_state); +static DEVICE_ATTR_RW(clk_ctl); static char power_group[] = "power"; void pcie_aspm_create_sysfs_dev_files(struct pci_dev *pdev)
[toc] | [prev] | [next] | [standalone]
| From | Julia Lawall <Julia.Lawall@lip6.fr> |
|---|---|
| Date | 2016-10-29 22:00 +0200 |
| Subject | [PATCH 03/15] wm8350_power: use permission-specific DEVICE_ATTR variants |
| Message-ID | <sxHXk-2qm-39@gated-at.bofh.it> |
| In reply to | #1511882 |
Use DEVICE_ATTR_RO for read only attributes. This simplifies the source
code, improves readbility, and reduces the chance of inconsistencies.
The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)
// <smpl>
@ro@
declarer name DEVICE_ATTR;
identifier x,x_show;
@@
DEVICE_ATTR(x, \(0444\|S_IRUGO\), x_show, NULL);
@script:ocaml@
x << ro.x;
x_show << ro.x_show;
@@
if not (x^"_show" = x_show) then Coccilib.include_match false
@@
declarer name DEVICE_ATTR_RO;
identifier ro.x,ro.x_show;
@@
- DEVICE_ATTR(x, \(0444\|S_IRUGO\), x_show, NULL);
+ DEVICE_ATTR_RO(x);
// </smpl>
Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
---
drivers/power/supply/wm8350_power.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/power/supply/wm8350_power.c b/drivers/power/supply/wm8350_power.c
index 5c58806..a2740cf 100644
--- a/drivers/power/supply/wm8350_power.c
+++ b/drivers/power/supply/wm8350_power.c
@@ -182,7 +182,7 @@ static ssize_t charger_state_show(struct device *dev,
return sprintf(buf, "%s\n", charge);
}
-static DEVICE_ATTR(charger_state, 0444, charger_state_show, NULL);
+static DEVICE_ATTR_RO(charger_state);
static irqreturn_t wm8350_charger_handler(int irq, void *data)
{
[toc] | [prev] | [next] | [standalone]
| From | Charles Keepax <ckeepax@opensource.wolfsonmicro.com> |
|---|---|
| Date | 2016-10-30 16:10 +0100 |
| Subject | Re: [PATCH 03/15] wm8350_power: use permission-specific DEVICE_ATTR variants |
| Message-ID | <sxZUd-6he-11@gated-at.bofh.it> |
| In reply to | #1511888 |
On Sat, Oct 29, 2016 at 09:36:57PM +0200, Julia Lawall wrote: > Use DEVICE_ATTR_RO for read only attributes. This simplifies the source > code, improves readbility, and reduces the chance of inconsistencies. > > The semantic patch that makes this change is as follows: > (http://coccinelle.lip6.fr/) > > // <smpl> > @ro@ > declarer name DEVICE_ATTR; > identifier x,x_show; > @@ > > DEVICE_ATTR(x, \(0444\|S_IRUGO\), x_show, NULL); > > @script:ocaml@ > x << ro.x; > x_show << ro.x_show; > @@ > > if not (x^"_show" = x_show) then Coccilib.include_match false > > @@ > declarer name DEVICE_ATTR_RO; > identifier ro.x,ro.x_show; > @@ > > - DEVICE_ATTR(x, \(0444\|S_IRUGO\), x_show, NULL); > + DEVICE_ATTR_RO(x); > // </smpl> > > Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr> > > --- Acked-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com> Thanks, Charles
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web