Message ID | 1477769829-22230-9-git-send-email-Julia.Lawall@lip6.fr (mailing list archive) |
---|---|
State | Accepted |
Commit | 8a7aef2cb3dafd2e8560750f4e5ad2cc2d9b1d17 |
Headers | show |
Julia Lawall <Julia.Lawall@lip6.fr> writes: > diff --git a/arch/powerpc/kernel/iommu.c b/arch/powerpc/kernel/iommu.c > index 5f202a5..32f18b5 100644 > --- a/arch/powerpc/kernel/iommu.c > +++ b/arch/powerpc/kernel/iommu.c > @@ -127,8 +127,7 @@ static ssize_t fail_iommu_store(struct device *dev, > return count; > } > > -static DEVICE_ATTR(fail_iommu, S_IRUGO|S_IWUSR, fail_iommu_show, > - fail_iommu_store); > +static DEVICE_ATTR_RW(fail_iommu); Acked-by: Michael Ellerman <mpe@ellerman.id.au> (powerpc) cheers
On Sat, 2016-10-29 at 19:37:02 UTC, Julia Lawall wrote: > 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> > Acked-by: Michael Ellerman <mpe@ellerman.id.au> (powerpc) Applied to powerpc next, thanks. https://git.kernel.org/powerpc/c/8a7aef2cb3dafd2e8560750f4e5ad2 cheers
diff --git a/arch/powerpc/kernel/iommu.c b/arch/powerpc/kernel/iommu.c index 5f202a5..32f18b5 100644 --- a/arch/powerpc/kernel/iommu.c +++ b/arch/powerpc/kernel/iommu.c @@ -127,8 +127,7 @@ static ssize_t fail_iommu_store(struct device *dev, return count; } -static DEVICE_ATTR(fail_iommu, S_IRUGO|S_IWUSR, fail_iommu_show, - fail_iommu_store); +static DEVICE_ATTR_RW(fail_iommu); static int fail_iommu_bus_notify(struct notifier_block *nb, unsigned long action, void *data)
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> --- arch/powerpc/kernel/iommu.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)