From f70575805708cabdedea7498aaa3f710fde4d920 Mon Sep 17 00:00:00 2001 From: hc <hc@nodka.com> Date: Wed, 31 Jan 2024 03:29:01 +0000 Subject: [PATCH] add lvds1024*800 --- kernel/drivers/mtd/tests/torturetest.c | 39 +++++++++++++++++++++++++-------------- 1 files changed, 25 insertions(+), 14 deletions(-) diff --git a/kernel/drivers/mtd/tests/torturetest.c b/kernel/drivers/mtd/tests/torturetest.c index 93c2729..51256a4 100644 --- a/kernel/drivers/mtd/tests/torturetest.c +++ b/kernel/drivers/mtd/tests/torturetest.c @@ -1,20 +1,8 @@ +// SPDX-License-Identifier: GPL-2.0-only /* * Copyright (C) 2006-2008 Artem Bityutskiy * Copyright (C) 2006-2008 Jarkko Lavinen * Copyright (C) 2006-2008 Adrian Hunter - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 as published by - * the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; see the file COPYING. If not, write to the Free Software - * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * * Authors: Artem Bityutskiy, Jarkko Lavinen, Adria Hunter * @@ -31,6 +19,7 @@ #include <linux/moduleparam.h> #include <linux/err.h> #include <linux/mtd/mtd.h> +#include <linux/random.h> #include <linux/slab.h> #include <linux/sched.h> #include "mtd_test.h" @@ -66,8 +55,14 @@ MODULE_PARM_DESC(cycles_count, "how many erase cycles to do " "(infinite by default)"); +static int random_pattern; +module_param(random_pattern, int, S_IRUGO); +MODULE_PARM_DESC(random_pattern, "if choose random pattern to program"); + static struct mtd_info *mtd; +/* This buffer contains random pattern */ +static unsigned char *patt_random; /* This buffer contains 0x555555...0xAAAAAA... pattern */ static unsigned char *patt_5A5; /* This buffer contains 0xAAAAAA...0x555555... pattern */ @@ -222,9 +217,13 @@ } err = -ENOMEM; + patt_random = kmalloc(mtd->erasesize, GFP_KERNEL); + if (!patt_random) + goto out_mtd; + patt_5A5 = kmalloc(mtd->erasesize, GFP_KERNEL); if (!patt_5A5) - goto out_mtd; + goto out_patt_random; patt_A5A = kmalloc(mtd->erasesize, GFP_KERNEL); if (!patt_A5A) @@ -255,6 +254,8 @@ memset(patt_A5A + i * pgsize, 0x55, pgsize); } } + + prandom_bytes(patt_random, mtd->erasesize); err = mtdtest_scan_for_bad_eraseblocks(mtd, bad_ebs, eb, ebcnt); if (err) @@ -295,6 +296,8 @@ patt = patt_5A5; else patt = patt_A5A; + if (random_pattern) + patt = patt_random; err = write_pattern(i, patt); if (err) goto out; @@ -313,8 +316,14 @@ patt = patt_5A5; else patt = patt_A5A; + if (random_pattern) + patt = patt_random; err = check_eraseblock(i, patt); if (err) { + if (random_pattern) { + pr_info("verify failed for random pattern\n"); + goto out; + } pr_info("verify failed for %s" " pattern\n", ((eb + erase_cycles) & 1) ? @@ -357,6 +366,8 @@ kfree(patt_A5A); out_patt_5A5: kfree(patt_5A5); +out_patt_random: + kfree(patt_random); out_mtd: put_mtd_device(mtd); if (err) -- Gitblit v1.6.2