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


Groups > linux.kernel > #1511873 > unrolled thread

[PATCH 08/15] powerpc/iommu: use permission-specific DEVICE_ATTR variants

Started byJulia Lawall <Julia.Lawall@lip6.fr>
First post2016-10-29 22:00 +0200
Last post2016-10-31 07:10 +0100
Articles 2 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 08/15] powerpc/iommu: use permission-specific DEVICE_ATTR variants Julia Lawall <Julia.Lawall@lip6.fr> - 2016-10-29 22:00 +0200
    Re: [PATCH 08/15] powerpc/iommu: use permission-specific DEVICE_ATTR variants Michael Ellerman <mpe@ellerman.id.au> - 2016-10-31 07:10 +0100

#1511873 — [PATCH 08/15] powerpc/iommu: use permission-specific DEVICE_ATTR variants

FromJulia Lawall <Julia.Lawall@lip6.fr>
Date2016-10-29 22:00 +0200
Subject[PATCH 08/15] powerpc/iommu: use permission-specific DEVICE_ATTR variants
Message-ID<sxHXj-2qm-1@gated-at.bofh.it>
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(-)

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)

[toc] | [next] | [standalone]


#1512356

FromMichael Ellerman <mpe@ellerman.id.au>
Date2016-10-31 07:10 +0100
Message-ID<sydXc-6Z3-21@gated-at.bofh.it>
In reply to#1511873
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

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web