Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3c2b0239 authored by Julia Lawall's avatar Julia Lawall Committed by Ralf Baechle
Browse files

MIPS: TXx9: 7segled: use permission-specific DEVICE_ATTR variants

Use DEVICE_ATTR_WO for write 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>
@wo@
declarer name DEVICE_ATTR;
identifier x,x_store;
@@

DEVICE_ATTR(x, \(0200\|S_IWUSR\), NULL, x_store);

@script:ocaml@
x << wo.x;
x_store << wo.x_store;
@@

if not (x^"_store" = x_store) then Coccilib.include_match false

@@
declarer name DEVICE_ATTR_WO;
identifier wo.x,wo.x_store;
@@

- DEVICE_ATTR(x, \(0200\|S_IWUSR\), NULL, x_store);
+ DEVICE_ATTR_WO(x);
// </smpl>

Signed-off-by: default avatarJulia Lawall <Julia.Lawall@lip6.fr>
Cc: kernel-janitors@vger.kernel.org
Cc: linux-mips@linux-mips.org
Cc: linux-kernel@vger.kernel.org
Patchwork: https://patchwork.linux-mips.org/patch/14463/


Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
parent ccebb88a
Loading
Loading
Loading
Loading
+2 −2
Original line number Original line Diff line number Diff line
@@ -55,8 +55,8 @@ static ssize_t raw_store(struct device *dev,
	return size;
	return size;
}
}


static DEVICE_ATTR(ascii, 0200, NULL, ascii_store);
static DEVICE_ATTR_WO(ascii);
static DEVICE_ATTR(raw, 0200, NULL, raw_store);
static DEVICE_ATTR_WO(raw);


static ssize_t map_seg7_show(struct device *dev,
static ssize_t map_seg7_show(struct device *dev,
			     struct device_attribute *attr,
			     struct device_attribute *attr,