All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
* [Cocci] Adding calls to devm_add_action_or_reset()
@ 2016-12-29 20:08 Guenter Roeck
  2016-12-29 21:41 ` Julia Lawall
  0 siblings, 1 reply; 7+ messages in thread
From: Guenter Roeck @ 2016-12-29 20:08 UTC (permalink / raw
  To: cocci

Hi Julia,

I am trying to replace explicit calls to clk_disable_unprepare()
with calls to devm_add_action_or_reset() right after the call to
clk_prepare_enable(). Unfortunately I can not get it to work.
The rule below (derived from the kzalloc -> devm_kzalloc rule)
only works on three of 20 watchdog drivers.

Can you by any chance tell what is wrong ? I am completely clueless.

A secondary issue is that the added call should be

	v = devm_add_action_or_reset(&pdev->dev, (void (*)(void *))clk_disable_unprepare, e1);

but coccinelle doesn't like that. Is that a problem with coccinelle
or a problem with the statement ?

Thanks,
Guenter

---
@platform@
identifier p, probefn, removefn;
@@
struct platform_driver p = {
  .probe = probefn,
  .remove = removefn,
};

@r depends on platform@
identifier platform.probefn;
expression e1;
expression e2;
position p;
@@
probefn(...) {
<+...
e1 = clk_prepare_enable@p(e2);
...+>
}

@rx depends on r@
identifier platform.probefn;
expression e1, e2, e3;
position r.p;
statement S;
@@
probefn(...) {
<+...
e1 = clk_prepare_enable@p(e2);
S
e3 = devm_add_action_or_reset(..., e2);
...+>
}

@prb depends on !rx@
identifier platform.probefn, pdev;
local idexpression v;
expression e1;
position r.p;
@@

probefn(struct platform_device *pdev) {
  <+...
  v = clk_prepare_enable@p(e1);
  if (
(
v
|
v < 0
)
  ) { ... }
+ v = devm_add_action_or_reset(&pdev->dev, clk_disable_unprepare, e1);
+ if (v)
+        return v;
  ...
?-clk_disable_unprepare(e1);
  ...+>
}

@rem depends on prb@
identifier platform.removefn;
expression prb.e1;
@@

removefn(...) {
  <...
?-clk_disable_unprepare(e1);
  ...>
}

@a depends on prb@
expression prb.e1, e2;
@@
e2 = e1;

@rem2 depends on a@
identifier platform.removefn;
expression a.e2;
@@
removefn(...) {
  <...
- clk_disable_unprepare(e2);
  ...>
}

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Cocci] Adding calls to devm_add_action_or_reset()
  2016-12-29 20:08 [Cocci] Adding calls to devm_add_action_or_reset() Guenter Roeck
@ 2016-12-29 21:41 ` Julia Lawall
  2016-12-29 22:01   ` Guenter Roeck
  2016-12-29 23:20   ` Guenter Roeck
  0 siblings, 2 replies; 7+ messages in thread
From: Julia Lawall @ 2016-12-29 21:41 UTC (permalink / raw
  To: cocci

I have added function type to the set of types that can appear in a cast.
The change has been pushed to github.

julia

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Cocci] Adding calls to devm_add_action_or_reset()
  2016-12-29 21:41 ` Julia Lawall
@ 2016-12-29 22:01   ` Guenter Roeck
  2016-12-29 23:20   ` Guenter Roeck
  1 sibling, 0 replies; 7+ messages in thread
From: Guenter Roeck @ 2016-12-29 22:01 UTC (permalink / raw
  To: cocci

On Thu, Dec 29, 2016 at 10:41:42PM +0100, Julia Lawall wrote:
> I have added function type to the set of types that can appear in a cast.
> The change has been pushed to github.
> 
Thanks!

Guenter

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Cocci] Adding calls to devm_add_action_or_reset()
  2016-12-29 21:41 ` Julia Lawall
  2016-12-29 22:01   ` Guenter Roeck
@ 2016-12-29 23:20   ` Guenter Roeck
  2016-12-30  6:38     ` Julia Lawall
  1 sibling, 1 reply; 7+ messages in thread
From: Guenter Roeck @ 2016-12-29 23:20 UTC (permalink / raw
  To: cocci

On Thu, Dec 29, 2016 at 10:41:42PM +0100, Julia Lawall wrote:
> I have added function type to the set of types that can appear in a cast.
> The change has been pushed to github.
> 
Pulled and working ...

I had to install the following packages on my system (Ubuntu 16.04):

	menhir libpcre-ocaml-dev libparmap-ocaml-dev libmenhir-ocaml-dev
	libfindlib-ocaml-dev

to fix various build errors. The bundled versions did not work.

Thanks again!

Guenter

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Cocci] Adding calls to devm_add_action_or_reset()
  2016-12-29 23:20   ` Guenter Roeck
@ 2016-12-30  6:38     ` Julia Lawall
  2016-12-30  7:15       ` Vaishali Thakkar
  0 siblings, 1 reply; 7+ messages in thread
From: Julia Lawall @ 2016-12-30  6:38 UTC (permalink / raw
  To: cocci



On Thu, 29 Dec 2016, Guenter Roeck wrote:

> On Thu, Dec 29, 2016 at 10:41:42PM +0100, Julia Lawall wrote:
> > I have added function type to the set of types that can appear in a cast.
> > The change has been pushed to github.
> >
> Pulled and working ...
>
> I had to install the following packages on my system (Ubuntu 16.04):
>
> 	menhir libpcre-ocaml-dev libparmap-ocaml-dev libmenhir-ocaml-dev
> 	libfindlib-ocaml-dev
>
> to fix various build errors. The bundled versions did not work.

Thanks for the report.  I got another report about libparmap-ocaml-dev
recently as well.  We will look into it.

julia

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Cocci] Adding calls to devm_add_action_or_reset()
  2016-12-30  6:38     ` Julia Lawall
@ 2016-12-30  7:15       ` Vaishali Thakkar
  2016-12-30  7:35         ` Julia Lawall
  0 siblings, 1 reply; 7+ messages in thread
From: Vaishali Thakkar @ 2016-12-30  7:15 UTC (permalink / raw
  To: cocci

On Friday 30 December 2016 12:08 PM, Julia Lawall wrote:
>
>
> On Thu, 29 Dec 2016, Guenter Roeck wrote:
>
>> On Thu, Dec 29, 2016 at 10:41:42PM +0100, Julia Lawall wrote:
>>> I have added function type to the set of types that can appear in a cast.
>>> The change has been pushed to github.
>>>
>> Pulled and working ...
>>
>> I had to install the following packages on my system (Ubuntu 16.04):
>>
>> 	menhir libpcre-ocaml-dev libparmap-ocaml-dev libmenhir-ocaml-dev
>> 	libfindlib-ocaml-dev
>>
>> to fix various build errors. The bundled versions did not work.
>
> Thanks for the report.  I got another report about libparmap-ocaml-dev
> recently as well.  We will look into it.

FYI, mine was Ubuntu 16.04 as well when I faced same issue without
libparmap-ocaml-dev.

> julia
> _______________________________________________
> Cocci mailing list
> Cocci at systeme.lip6.fr
> https://systeme.lip6.fr/mailman/listinfo/cocci
>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Cocci] Adding calls to devm_add_action_or_reset()
  2016-12-30  7:15       ` Vaishali Thakkar
@ 2016-12-30  7:35         ` Julia Lawall
  0 siblings, 0 replies; 7+ messages in thread
From: Julia Lawall @ 2016-12-30  7:35 UTC (permalink / raw
  To: cocci



On Fri, 30 Dec 2016, Vaishali Thakkar wrote:

> On Friday 30 December 2016 12:08 PM, Julia Lawall wrote:
> >
> >
> > On Thu, 29 Dec 2016, Guenter Roeck wrote:
> >
> > > On Thu, Dec 29, 2016 at 10:41:42PM +0100, Julia Lawall wrote:
> > > > I have added function type to the set of types that can appear in a
> > > > cast.
> > > > The change has been pushed to github.
> > > >
> > > Pulled and working ...
> > >
> > > I had to install the following packages on my system (Ubuntu 16.04):
> > >
> > > 	menhir libpcre-ocaml-dev libparmap-ocaml-dev libmenhir-ocaml-dev
> > > 	libfindlib-ocaml-dev
> > >
> > > to fix various build errors. The bundled versions did not work.
> >
> > Thanks for the report.  I got another report about libparmap-ocaml-dev
> > recently as well.  We will look into it.
>
> FYI, mine was Ubuntu 16.04 as well when I faced same issue without
> libparmap-ocaml-dev.

Thanks for the update.

julia

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2016-12-30  7:35 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-12-29 20:08 [Cocci] Adding calls to devm_add_action_or_reset() Guenter Roeck
2016-12-29 21:41 ` Julia Lawall
2016-12-29 22:01   ` Guenter Roeck
2016-12-29 23:20   ` Guenter Roeck
2016-12-30  6:38     ` Julia Lawall
2016-12-30  7:15       ` Vaishali Thakkar
2016-12-30  7:35         ` Julia Lawall

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.