From patchwork Mon Sep 2 13:46:15 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Akinobu Mita X-Patchwork-Id: 271949 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from casper.infradead.org (unknown [IPv6:2001:770:15f::2]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 43C812C0084 for ; Mon, 2 Sep 2013 23:48:25 +1000 (EST) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VGUU9-0006eq-9A; Mon, 02 Sep 2013 13:48:05 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1VGUU7-0007ng-Kw; Mon, 02 Sep 2013 13:48:03 +0000 Received: from mail-pd0-x22f.google.com ([2607:f8b0:400e:c02::22f]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VGUU5-0007nA-5n for linux-mtd@lists.infradead.org; Mon, 02 Sep 2013 13:48:02 +0000 Received: by mail-pd0-f175.google.com with SMTP id q10so4743909pdj.6 for ; Mon, 02 Sep 2013 06:47:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=omVPPFe8bD5mwpYUs1MZ8VJFkyQYbRs3DMx4vet6p/4=; b=wco1bFTiSompa0R8EXXe0z7LB7qXzNUuiZGZTpNdDtin5dkReR/7p5sFzsALeQfMcy c5PTc6VgdGb0E+d3p98J+zbwfT+20Wq9HFKa2WsXNt9DFCEseIy85TMPgDgIAWzmtSV9 fFamSeS4PJCQNQZtYHeqhbgeYovlzTlW7FCIoAT06cvCpuDzQZrxqXpm8+t0rRitpJlm p3DAXvs8huKUE68u4Q4b3tGx9MMAeUmZnr3fMamxo/7KR9En4Ioh1Q2oeDrsJc2d+t0Z 3FjWeIu1ioR9ebMdtSZyuJYMuPdPv1OlENbElhRSB6gE0zbC9ZliaPaOHNAKTsiB72HG ux5w== X-Received: by 10.68.108.3 with SMTP id hg3mr25643871pbb.91.1378129659446; Mon, 02 Sep 2013 06:47:39 -0700 (PDT) Received: from localhost.localdomain (KD113145060135.ppp-bb.dion.ne.jp. [113.145.60.135]) by mx.google.com with ESMTPSA id om2sm16035747pbc.30.1969.12.31.16.00.00 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Mon, 02 Sep 2013 06:47:38 -0700 (PDT) From: Akinobu Mita To: linux-mtd@lists.infradead.org Subject: [PATCH] mtd: tests: make a separate mtd_test.ko module Date: Mon, 2 Sep 2013 22:46:15 +0900 Message-Id: <1378129575-4434-1-git-send-email-akinobu.mita@gmail.com> X-Mailer: git-send-email 1.8.3.1 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130902_094801_489281_7BB3D334 X-CRM114-Status: GOOD ( 14.56 ) X-Spam-Score: -2.0 (--) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-2.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (akinobu.mita[at]gmail.com) -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature Cc: Artem Bityutskiy , Vikram Narayanan , Akinobu Mita , Adrian Hunter , Brian Norris , David Woodhouse X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org Instead of linking a separate copy into every test module, this makes a separate mtd_test.ko module and have it exported the symbols. The mtd tests are often edited, compiled and run by hand, so it is worth avoiding the extra step of inserting another module. That is the reason why it was linked in that way in the first place. If we want to restore the previous behaviour temporarily in a custom mtd test module, we can build it by adding the following lines in Makefile, though you need to ignore the warnings like "'mtdtest_write' exported twice". obj-$(CONFIG_MTD_TESTS) += mtd_mytest.o mtd_mytest-objs := mytest.o mtd_test.o Signed-off-by: Akinobu Mita Cc: Brian Norris Cc: Vikram Narayanan Cc: Adrian Hunter Cc: Artem Bityutskiy Cc: David Woodhouse Cc: linux-mtd@lists.infradead.org --- drivers/mtd/tests/Makefile | 17 +++++++++-------- drivers/mtd/tests/mtd_test.c | 10 +++++++++- 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/drivers/mtd/tests/Makefile b/drivers/mtd/tests/Makefile index 937a829..1912c5d 100644 --- a/drivers/mtd/tests/Makefile +++ b/drivers/mtd/tests/Makefile @@ -1,3 +1,4 @@ +obj-$(CONFIG_MTD_TESTS) += mtd_test.o obj-$(CONFIG_MTD_TESTS) += mtd_oobtest.o obj-$(CONFIG_MTD_TESTS) += mtd_pagetest.o obj-$(CONFIG_MTD_TESTS) += mtd_readtest.o @@ -8,11 +9,11 @@ obj-$(CONFIG_MTD_TESTS) += mtd_torturetest.o obj-$(CONFIG_MTD_TESTS) += mtd_nandecctest.o obj-$(CONFIG_MTD_TESTS) += mtd_nandbiterrs.o -mtd_oobtest-objs := oobtest.o mtd_test.o -mtd_pagetest-objs := pagetest.o mtd_test.o -mtd_readtest-objs := readtest.o mtd_test.o -mtd_speedtest-objs := speedtest.o mtd_test.o -mtd_stresstest-objs := stresstest.o mtd_test.o -mtd_subpagetest-objs := subpagetest.o mtd_test.o -mtd_torturetest-objs := torturetest.o mtd_test.o -mtd_nandbiterrs-objs := nandbiterrs.o mtd_test.o +mtd_oobtest-objs := oobtest.o +mtd_pagetest-objs := pagetest.o +mtd_readtest-objs := readtest.o +mtd_speedtest-objs := speedtest.o +mtd_stresstest-objs := stresstest.o +mtd_subpagetest-objs := subpagetest.o +mtd_torturetest-objs := torturetest.o +mtd_nandbiterrs-objs := nandbiterrs.o diff --git a/drivers/mtd/tests/mtd_test.c b/drivers/mtd/tests/mtd_test.c index 943e510..f42922e 100644 --- a/drivers/mtd/tests/mtd_test.c +++ b/drivers/mtd/tests/mtd_test.c @@ -1,4 +1,4 @@ -#define pr_fmt(fmt) "mtd_test: " fmt +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt #include #include @@ -30,6 +30,7 @@ int mtdtest_erase_eraseblock(struct mtd_info *mtd, unsigned int ebnum) } return 0; } +EXPORT_SYMBOL_GPL(mtdtest_erase_eraseblock); static int is_block_bad(struct mtd_info *mtd, unsigned int ebnum) { @@ -63,6 +64,7 @@ int mtdtest_scan_for_bad_eraseblocks(struct mtd_info *mtd, unsigned long *bbt, return 0; } +EXPORT_SYMBOL_GPL(mtdtest_scan_for_bad_eraseblocks); int mtdtest_erase_good_eraseblocks(struct mtd_info *mtd, unsigned long *bbt, unsigned int eb, int ebcnt) @@ -79,6 +81,7 @@ int mtdtest_erase_good_eraseblocks(struct mtd_info *mtd, unsigned long *bbt, return 0; } +EXPORT_SYMBOL_GPL(mtdtest_erase_good_eraseblocks); int mtdtest_read(struct mtd_info *mtd, loff_t addr, size_t size, void *buf) { @@ -96,6 +99,7 @@ int mtdtest_read(struct mtd_info *mtd, loff_t addr, size_t size, void *buf) return err; } +EXPORT_SYMBOL_GPL(mtdtest_read); int mtdtest_write(struct mtd_info *mtd, loff_t addr, size_t size, const void *buf) @@ -111,3 +115,7 @@ int mtdtest_write(struct mtd_info *mtd, loff_t addr, size_t size, return err; } +EXPORT_SYMBOL_GPL(mtdtest_write); + +MODULE_DESCRIPTION("NAND test library"); +MODULE_LICENSE("GPL");