lkml.org 
[lkml]   [2012]   [Aug]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Subject[PATCH 0/13] use clk_prepare_enable and clk_disable_unprepare
Date
Clk_prepare_enable and clk_disable_unprepare combine clk_prepare and
clk_enable, and clk_disable and clk_unprepare. They make the code more
concise, and ensure that clk_unprepare is called when clk_enable fails.

The transformation is made using the following semantic patch
(http://coccinelle.lip6.fr/). This semantic patch is not really safe, in
that it doesn't check for clk_disable's that are relying on the removed
clk_unprepare's. These cases have been adjusted by hand.

// <smpl>
@@
expression e;
@@

- clk_prepare(e);
- clk_enable(e);
+ clk_prepare_enable(e);

@@
expression e;
identifier r;
statement S;
@@

- r = clk_prepare(e); if (r) S
- clk_enable(e);
+ r = clk_prepare_enable(e); if (r) S

@@
expression e;
expression r;
@@

- clk_prepare(e);
r =
- clk_enable
+ clk_prepare_enable
(e);
if (r) { ...
- clk_unprepare(e); // unsafe!
...
return ...;
}

@@
expression e;
expression r;
@@

- clk_prepare(e);
r =
- clk_enable
+ clk_prepare_enable
(e);

@@
expression e;
statement S;
@@

- if (clk_prepare(e)) S
- clk_enable(e);
+ if (clk_prepare_enable(e)) S

@@
expression e;
@@

- clk_prepare(e);
if (
- clk_enable(e)
+ clk_prepare_enable(e)
) { ...
- clk_unprepare(e); // unsafe!
...
return ...;
}

@@
expression e;
statement S;
@@

- clk_prepare(e);
if (
- clk_enable(e)
+ clk_prepare_enable(e)
) S

@@
expression e,r2;
identifier r1;
statement S;
@@

- r1 = clk_prepare(e); if (r1) S
r2 =
- clk_enable
+ clk_prepare_enable
(e);
if (r2) { ...
- clk_unprepare(e); // unsafe!
...
return ...;
}

@@
expression e,r2;
identifier r1;
statement S;
@@

- r1 = clk_prepare(e); if (r1) S
r2 =
- clk_enable
+ clk_prepare_enable
(e);

@@
expression e;
statement S1;
@@

- if (clk_prepare(e)) S1
if (
- clk_enable
+ clk_prepare_enable
(e)) { ...
- clk_unprepare(e); // unsafe!
...
return ...;
}

@@
expression e;
statement S1,S2;
@@

- if (clk_prepare(e)) S1
if (
- clk_enable
+ clk_prepare_enable
(e)) S2

@@
expression e;
@@

- clk_disable(e);
- clk_unprepare(e);
+ clk_disable_unprepare(e);
// </smpl>



\
 
 \ /
  Last update: 2012-08-26 18:41    [W:0.277 / U:0.324 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site