Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1511874
| From | Julia Lawall <Julia.Lawall@lip6.fr> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH 11/15] ASoC: dapm: use permission-specific DEVICE_ATTR variants |
| Date | 2016-10-29 22:00 +0200 |
| Message-ID | <sxHXj-2qm-5@gated-at.bofh.it> (permalink) |
| References | <sxHXj-2qm-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
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>
---
sound/soc/soc-dapm.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index 3bbe32e..164b4d3 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -2297,7 +2297,7 @@ static ssize_t dapm_widget_show(struct device *dev,
return count;
}
-static DEVICE_ATTR(dapm_widget, 0444, dapm_widget_show, NULL);
+static DEVICE_ATTR_RO(dapm_widget);
struct attribute *soc_dapm_dev_attrs[] = {
&dev_attr_dapm_widget.attr,
Back to linux.kernel | Previous | Next | Find similar | Unroll thread
[PATCH 11/15] ASoC: dapm: use permission-specific DEVICE_ATTR variants Julia Lawall <Julia.Lawall@lip6.fr> - 2016-10-29 22:00 +0200
csiph-web