Re: [PATCH 00/66] use permission-specific DEVICE_ATTR variants

From: Guenter Roeck
Date: Thu Dec 22 2016 - 21:38:21 EST


On 12/22/2016 04:04 AM, Julia Lawall wrote:
Use DEVICE_ATTR_RO etc. for read only attributes etc. This simplifies the
source code, improves readbility, and reduces the chance of
inconsistencies. A previous version of this semantic patch transformed
only cases where the show and store functions followed particular naming
conventions. This semantic patch additionally renames functions as
needed. It can, however, fail to transform some occurrences where a single
function is used for multiple attributes. In that case, the first case is
transformed an the others are left as is.

The complete semantic patch is as follows:
(http://coccinelle.lip6.fr/)


Hi Julia,

I noticed that drivers/hwmon/gl518sm.c was not converted. Running your script
on it does not do anything. Any idea what might cause that ?

I noticed that I get a warning if I specify a debug file:

File "devattr-new.cocci", line 36, characters 5-6:
Warning 26: unused variable x.

but that seems to have no impact and is always seen. I think it is caused
by the following.

...

@script:ocaml@
x << d.x; <====
show << o.show;
store << o.store;
@@

if (not(show = "NULL") && Hashtbl.mem taken show) ||
(not(store = "NULL") && Hashtbl.mem taken store)
then Coccilib.include_match false
else (Hashtbl.add taken show (); Hashtbl.add taken store ())

...

How does one specify indentation preferences ? Also, how do I generate
an actual patch (instead of getting the output on screen) ?
Sorry for the maybe dumb questions ;-).

Thanks,
Guenter