mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Steffen Trumtrar <s.trumtrar@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Steffen Trumtrar <s.trumtrar@pengutronix.de>
Subject: [PATCH 2/3] scripts: socfpga: add coccinelle magic
Date: Wed, 18 Feb 2015 12:54:17 +0100	[thread overview]
Message-ID: <1424260458-19639-3-git-send-email-s.trumtrar@pengutronix.de> (raw)
In-Reply-To: <1424260458-19639-1-git-send-email-s.trumtrar@pengutronix.de>

Use coccinelle to cleanup the imported u-boot code some more.
This will remove:
	- debugging macros (TCL_RPT, BFM_STAGE, ALTERA_ASSERT)
	- empty if/else/for blocks resulting from macro deletion
	- some unused functions (scc_mgr_xxx)

Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de>
---
 scripts/coccinelle/misc/altera_sequencer.cocci | 93 ++++++++++++++++++++++++++
 scripts/socfpga_get_sequencer                  |  3 +
 2 files changed, 96 insertions(+)
 create mode 100644 scripts/coccinelle/misc/altera_sequencer.cocci

diff --git a/scripts/coccinelle/misc/altera_sequencer.cocci b/scripts/coccinelle/misc/altera_sequencer.cocci
new file mode 100644
index 000000000000..9fea239c0c7d
--- /dev/null
+++ b/scripts/coccinelle/misc/altera_sequencer.cocci
@@ -0,0 +1,93 @@
+@r_shadow@
+@@
+
+- ...curr_shadow_reg = 0;
+
+@r_out2_delay@
+type T;
+@@
+
+- T scc_mgr_apply_group_dq_out2_delay(...)
+- {
+- ...
+- }
+
+@r_oct_out2@
+type T;
+@@
+- T scc_mgr_apply_group_dqs_io_and_oct_out2(...)
+- {
+- ...
+- }
+
+@r_oct_out2_gradual@
+type T;
+@@
+
+- T scc_mgr_set_group_dqs_io_and_oct_out2_gradual(...)
+- {
+- ...
+- }
+
+@r_eye_diag@
+type T;
+@@
+
+- T rw_mgr_mem_calibrate_eye_diag_aid(...)
+- {
+- ...
+- }
+
+@r_full_test@
+type T;
+@@
+
+- T rw_mgr_mem_calibrate_full_test(...)
+- {
+- ...
+- }
+
+@r_user_init_cal_req@
+@@
+
+- static void user_init_cal_req (...)
+- {
+- ...
+- }
+
+@r_tcl@
+@@
+
+- TCLRPT_SET(...);
+
+@r_bfm@
+@@
+
+- BFM_STAGE(...);
+
+@r_trace@
+@@
+
+- TRACE_FUNC(...);
+
+@r_assert@
+@@
+
+- ALTERA_ASSERT(...);
+
+@r_if@
+@@
+
+- if (...) {}
+
+@r_if_else@
+@@
+
+- if (...) {
+- } else {
+- }
+
+@r_for@
+@@
+
+- for (...;...;...) {}
diff --git a/scripts/socfpga_get_sequencer b/scripts/socfpga_get_sequencer
index de12b35b5d11..5e4eb2d0c46c 100755
--- a/scripts/socfpga_get_sequencer
+++ b/scripts/socfpga_get_sequencer
@@ -46,6 +46,9 @@ copy_source() {
 
 	echo "	Automated readability fixup..."
 	indent -npro -kr -i8 -ts8 -sob -l100 -ss -ncs -cp1 -il0 $tgt
+
+	echo "  Running coccinelle cleanups..."
+	spatch -sp_file scripts/coccinelle/misc/altera_sequencer.cocci -in_place arch/arm/mach-socfpga/include/mach
 }
 
 copy_source ${ubootsrc}/board/altera/socfpga/sdram/sequencer.c arch/arm/mach-socfpga/include/mach/sequencer.c
-- 
2.1.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  parent reply	other threads:[~2015-02-18 11:54 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-18 11:54 [PATCH 0/3] Socfpga: handoff importer updates + SOCDK support Steffen Trumtrar
2015-02-18 11:54 ` [PATCH 1/3] scripts: add socfpga preloader-files importer Steffen Trumtrar
2015-02-18 23:04   ` Michael Grzeschik
2015-02-18 11:54 ` Steffen Trumtrar [this message]
2015-02-18 11:54 ` [PATCH 3/3] ARM: socfpga: add Altera SoCFPGA Development Kit support Steffen Trumtrar
2015-02-19 19:58   ` Sascha Hauer
2015-02-20  7:49     ` Steffen Trumtrar
2015-02-23  7:34       ` Sascha Hauer

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=1424260458-19639-3-git-send-email-s.trumtrar@pengutronix.de \
    --to=s.trumtrar@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /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