On Thu, Oct 20, 2016 at 10:57 AM, Chris Wilson <chris at chris-wilson.co.uk> 
wrote:
> On Thu, Oct 20, 2016 at 10:39:47AM -0400, Sean Paul wrote:
>> On Thu, Oct 20, 2016 at 2:47 AM, Chris Wilson <chris at chris-wilson.co.uk> 
>> wrote:
>> > I plan to usurp the short name of struct fence for a core kernel struct,
>> > and so I need to rename the specialised fence/timeline for DMA
>> > operations to make room.
>> >
>> > A consensus was reached in
>> > https://lists.freedesktop.org/archives/dri-devel/2016-July/113083.html
>> > that making clear this fence applies to DMA operations was a good thing.
>> > Since then the patch has grown a bit as usage increases (and we wanted
>> > to wait until after the sw_sync destage), so hopefully it remains a good
>> > thing!
>> >
>> > I've pushed the patch to
>> >
>> > https://cgit.freedesktop.org/~ickle/linux-2.6/commit/?h=dma-fence&id=a4a27d87e4fccefb9f9d55f9c73ccab8f2ade3cc
>> >
>> > as I suspect it might be too large for the list.
>> >
>> > Highlights of the change:
>> >
>> >         struct fence -> struct dma_fence (and all fence*() to dma_fence*())
>> >         struct fence_array -> struct dma_fence_array
>> >
>> >         107 files changed, 1174 insertions(+), 1136 deletions(-)
>> >
>> > Mostly generated with the provided cocci spatch, but even with
>> > --include-headers it seemed to miss some headers, and I never quite
>> > worked out the substition commands for macros, so there is some grep and
>> > replace.
>>
>> For the curious (like me), here's the diff between ickle's HEAD and
>> what the cocci script outputs:
>>
>> http://hastebin.com/udizixoyed.go
>
> Hmm, looks like I had a few changes for dma-fence-array that didn't make
> it back into the changelog. And still missed most of the trace_*(), as
> only one was used outside.
>
> Most recently used spatch:
> https://people.freedesktop.org/~ickle/fence.spatch

Thanks. I also notice you get more coverage if you break the struct
renames out into their own rules (instead of the | operation). For
instance, look at drivers/dma-buf/dma-buf.c

dma_buf_poll_cb takes both fence and fence_cb. With your current
spatch, it requires 2 passes to change both arguments. However if you
split them into their own rules, it takes one pass:

@@

@@
- struct fence
+ struct dma_fence
@@

@@
- struct fence_ops
+ struct dma_fence_ops
@@

@@
- struct fence_cb
+ struct dma_fence_cb
@@

@@
- struct fence_array
+ struct dma_fence_array
@@

@@
- enum fence_flag_bits
+ enum dma_fence_flag_bits

@@

@@

Disclaimer: I am *not* a cocci expert

Sean


> -Chris
>
> --
> Chris Wilson, Intel Open Source Technology Centre

Reply via email to