On 4/7/19 1:05 PM, Julia Lawall wrote:


On Sun, 7 Apr 2019, Guenter Roeck wrote:

Hi Julia,

On 4/7/19 12:09 PM, Julia Lawall wrote:


On Sun, 7 Apr 2019, Guenter Roeck wrote:

Hi Coccinelle experts,

I am trying to introduce a new function with coccinelle.

The semantic patch is something like

@devm depends on prb@
identifier r.initfn;
identifier fname.clkfunc;
@@
+ static void clkfunc(void *data) { clk_disable_unprepare(data); }
    initfn(...) { ... }

You can do:

+ static void clkfunc(void *data)
+{ clk_disable_unprepare(data); }
    initfn(...) { ... }

and then use the command line argument --smpl-spacing.


That kind of works,

+static void armada_clk_disable_unprepare(void *data)
+{
+       clk_disable_unprepare(data);
+}
+
  static int armada_37xx_wdt_probe(struct platform_device *pdev)

but it doesn't line wrap the calling code.

+       ret = devm_add_action_or_reset(&pdev->dev,
armada_clk_disable_unprepare, dev->clk);
+       if (ret)
+               return ret;

This isn't really much better.

I tried --max-width, but it looks like that doesn't work with --smpl-spacing.

Did you try the new version?

No, that was with the old version. The new version does the trick.

Again, thanks a lot!

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

Reply via email to