On Mon, 15 Aug 2016, ron minnich wrote:

> I have this struct:
> struct ahba {
> uint32_t x;
> }
>
> given this:
> struct ahba *h;
>
> I want to convert derefs of h->x to turn into mmio_read32(&h->x); 
> h->x = y;
> to
> mmio_write32(&h->x, y);

What semantic patch did you write?  It looks like it should be:

@@
struct ahba *h;
expression e;
@@

- h->x = e
+ mmio_write32(&h->x,e)

@@
struct ahba *h;
@@

- h->x
+ mmio_read32(&h->x)

The order is important.

julia
_______________________________________________
Cocci mailing list
[email protected]
https://systeme.lip6.fr/mailman/listinfo/cocci

Reply via email to