>> Will similar software updates become more challenging for the initially
>> described handling of designated initialisers for known data structures?
>
> This is in the spirit of the solution I already proposed.

How do you think about the following SmPL transformation approach?

@replacement@
constant text;
expression value;
identifier my_name;
type driver_type;
@@
 static driver_type my_name =
 {
 .driver =
 {
-.name = text,
+.name = text,
 .of_match_table =
+                  of_match_ptr(
                                value
+                              )
 ,
 }, ...
 };


Test result:
elfring@Sonne:~/Projekte/Linux/next-patched> spatch 
~/Projekte/Coccinelle/Probe/Weigelt5.cocci sound/soc/codecs/pcm3060-i2c.c
…
@@ -43,10 +43,10 @@ MODULE_DEVICE_TABLE(of, pcm3060_of_match
 #endif /* CONFIG_OF */

 static struct i2c_driver pcm3060_i2c_driver = {
+#ifdef CONFIG_OF
        .driver = {
                .name = "pcm3060",
-#ifdef CONFIG_OF
-               .of_match_table = pcm3060_of_match,
+               .of_match_table = of_match_ptr(pcm3060_of_match),
 #endif /* CONFIG_OF */
        },
        .id_table = pcm3060_i2c_id,


I would find it questionable that the software combination
“Coccinelle 1.0.7-00206-gfdcc6d79 (OCaml 4.07.1)” suggests to move
a conditional preprocessor statement to an other source code place.

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

Reply via email to