cocci.inria.fr archive mirror
 help / color / mirror / Atom feed
From: Guenter Roeck <linux@roeck-us.net>
To: Julia Lawall <julia.lawall@lip6.fr>
Cc: cocci@systeme.lip6.fr
Subject: Re: [Cocci] ormatting problems when introducing a function with coccinelle
Date: Sun, 7 Apr 2019 13:03:09 -0700	[thread overview]
Message-ID: <769208bc-8298-314a-4ec4-0a2cb61ae1ae@roeck-us.net> (raw)
In-Reply-To: <alpine.DEB.2.21.1904072108260.18180@hadrien>

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.

Thanks,
Guenter
_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci

  reply	other threads:[~2019-04-07 20:03 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-07 18:49 [Cocci] ormatting problems when introducing a function with coccinelle Guenter Roeck
2019-04-07 19:09 ` Julia Lawall
2019-04-07 20:03   ` Guenter Roeck [this message]
2019-04-07 20:05     ` Julia Lawall
2019-04-07 20:17       ` Guenter Roeck
2019-04-07 19:18 ` Julia Lawall
2019-04-07 20:14   ` Guenter Roeck

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=769208bc-8298-314a-4ec4-0a2cb61ae1ae@roeck-us.net \
    --to=linux@roeck-us.net \
    --cc=cocci@systeme.lip6.fr \
    --cc=julia.lawall@lip6.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).