# Re: \[cocci\] \[PATCH\] HID: fix semantic patch and improve its performance

- From: Markus Elfring \<hidden\>
- Date: 2026-08-27 12:09:02 
- List: linux-input
- Page: https://ratatoskr.run/linux-input/2026/08/17469385
- Thread: https://ratatoskr.run/linux-input/2026/08/17469209/t.md

```text
>> …
>>> +++ b/scripts/coccinelle/hid/ff_race.cocci
>> …
>>> -@r@
>>> +@r exists@
>>>  identifier probe_fn;
>>> -expression hdev, flags;
>>> +identifier hdev;
>>
>> May the following SmPL code variant be applied?
>>
>>  identifier hdev, probe_fn;
> 
> Yes, but it doesn't matter.

Can it occasionally matter to avoid the duplication of such an SmPL key word?

Can SmPL variable declarations become a bit shorter?


>>> +expression flags;
>>>  position p1, p2;
>>>  @@
>>>
>>>  probe_fn(struct hid_device *hdev, ...) {
>>> -  <...
>>> +  ... when any
>>>    hid_hw_start@p1(hdev, flags)
>>>    ...
>>> -  \(input_ff_create\|input_ff_create_memless\)@p2(...)
>>> -  ...>
>>> +  \(input_ff_create@p2\|input_ff_create_memless@p2\)(...)
>>
>> How do you think about to use the following SmPL code variation?
>>
>> (input_ff_create@p2
>> |input_ff_create_memless@p2
>> )(...)
> 
> I find this completely unreadable.
I find this view surprising.

There are special views involved for the layout of such SmPL disjunctions.

Regards,
Markus
```
