All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/13] use clk_prepare_enable and clk_disable_unprepare
@ 2012-08-26 16:00 ` Julia Lawall
  0 siblings, 0 replies; 63+ messages in thread
From: Julia Lawall @ 2012-08-26 16:00 UTC (permalink / raw)
  To: linux-kernel; +Cc: kernel-janitors

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>


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

end of thread, other threads:[~2012-09-19  5:09 UTC | newest]

Thread overview: 63+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-08-26 16:00 [PATCH 0/13] use clk_prepare_enable and clk_disable_unprepare Julia Lawall
2012-08-26 16:00 ` Julia Lawall
2012-08-26 16:00 ` [PATCH 1/13] drivers/staging/iio/adc/spear_adc.c: " Julia Lawall
2012-08-26 16:00   ` Julia Lawall
2012-08-27  4:01   ` viresh kumar
2012-08-27  4:13     ` [PATCH 1/13] drivers/staging/iio/adc/spear_adc.c: use clk_prepare_enable and clk_disable_unprepa viresh kumar
2012-08-27 20:06     ` Jonathan Cameron
2012-08-27 20:06       ` [PATCH 1/13] drivers/staging/iio/adc/spear_adc.c: use clk_prepare_enable and clk_disable_unprepare Jonathan Cameron
2012-08-27 20:09       ` [PATCH 1/13] drivers/staging/iio/adc/spear_adc.c: use clk_prepare_enable and clk_disable_unprepa Jonathan Cameron
2012-08-27 20:09         ` [PATCH 1/13] drivers/staging/iio/adc/spear_adc.c: use clk_prepare_enable and clk_disable_unprepare Jonathan Cameron
     [not found] ` <1345996865-32082-1-git-send-email-Julia.Lawall-L2FTfq7BK8M@public.gmane.org>
2012-08-26 16:00   ` [PATCH 2/13] drivers/spi/spi-{orion,pl022}.c: " Julia Lawall
2012-08-26 16:00     ` Julia Lawall
2012-08-26 16:00     ` [PATCH 2/13] drivers/spi/spi-{orion, pl022}.c: " Julia Lawall
2012-08-26 16:00 ` [PATCH 3/13] drivers/gpio/gpio-pxa.c: " Julia Lawall
2012-08-26 16:00   ` Julia Lawall
2012-09-01  4:15   ` Linus Walleij
2012-09-01  4:15     ` Linus Walleij
2012-08-26 16:00 ` [PATCH 4/13] i2c: sirf: " Julia Lawall
2012-08-26 16:00   ` Julia Lawall
2012-08-26 16:00   ` Julia Lawall
2012-08-27  1:44   ` Barry Song
2012-08-27  1:44     ` Barry Song
2012-08-27  1:44     ` Barry Song
2012-08-27  1:44     ` Barry Song
2012-08-26 16:00 ` [PATCH 5/13] arch/arm: " Julia Lawall
2012-08-26 16:00   ` Julia Lawall
2012-08-26 16:00   ` Julia Lawall
2012-08-27  5:57   ` Pankaj Jangra
2012-08-27  5:58     ` Pankaj Jangra
2012-08-27  5:57     ` Pankaj Jangra
2012-08-26 16:00 ` [PATCH 6/13] drivers/iio/adc/at91_adc.c: " Julia Lawall
2012-08-26 16:00   ` Julia Lawall
2012-08-27 20:12   ` Jonathan Cameron
2012-08-27 20:12     ` Jonathan Cameron
2012-08-26 16:00 ` [PATCH 7/13] drivers/mmc/host/mmci.c: " Julia Lawall
2012-08-26 16:00   ` Julia Lawall
2012-08-27 12:33   ` Ulf Hansson
2012-08-27 12:33     ` Ulf Hansson
2012-08-27 12:46     ` Julia Lawall
2012-08-27 12:46       ` Julia Lawall
2012-08-27 12:55     ` Julia Lawall
2012-08-27 12:55       ` Julia Lawall
2012-09-19  5:09   ` Chris Ball
2012-09-19  5:09     ` Chris Ball
2012-08-26 16:01 ` [PATCH 8/13] i2c: mv64xxx: " Julia Lawall
2012-08-26 16:01   ` Julia Lawall
2012-08-26 16:01 ` [PATCH 9/13] drivers/tty/serial/amba-pl0{10,11}.c: " Julia Lawall
2012-08-26 16:01   ` Julia Lawall
2012-08-26 16:01 ` [PATCH 10/13] drivers/watchdog/sp805_wdt.c: " Julia Lawall
2012-08-26 16:01   ` Julia Lawall
2012-08-27  4:04   ` viresh kumar
2012-08-27  4:16     ` viresh kumar
2012-08-26 16:01 ` [PATCH 11/13] arch/arm/mach-at91/gpio.c: " Julia Lawall
2012-08-26 16:01   ` Julia Lawall
2012-08-26 16:01   ` Julia Lawall
2012-08-26 16:01 ` [PATCH 12/13] drivers/amba/bus.c: " Julia Lawall
2012-08-26 16:01   ` Julia Lawall
2012-08-26 16:01 ` [PATCH 13/13] drivers/rtc/rtc-coh901331.c: " Julia Lawall
2012-08-26 16:01   ` Julia Lawall
2012-08-26 16:01   ` Julia Lawall
2012-08-28  0:25   ` Linus Walleij
2012-08-28  0:25     ` Linus Walleij
2012-08-28  0:25     ` Linus Walleij

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.