#define pr_fmt(fmt) …
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/list.h>
#include <linux/random.h>
#include <linux/string.h>
#include <linux/bitops.h>
#include <linux/slab.h>
#include <linux/mtd/nand-ecc-sw-hamming.h>
#include "mtd_test.h"
#if IS_ENABLED(CONFIG_MTD_RAW_NAND)
struct nand_ecc_test { … };
#ifdef __LITTLE_ENDIAN
#define __change_bit_le(nr, addr) …
#elif defined(__BIG_ENDIAN)
#define __change_bit_le …
#else
#error "Unknown byte order"
#endif
static void single_bit_error_data(void *error_data, void *correct_data,
size_t size)
{ … }
static void double_bit_error_data(void *error_data, void *correct_data,
size_t size)
{ … }
static unsigned int random_ecc_bit(size_t size)
{ … }
static void single_bit_error_ecc(void *error_ecc, void *correct_ecc,
size_t size)
{ … }
static void double_bit_error_ecc(void *error_ecc, void *correct_ecc,
size_t size)
{ … }
static void no_bit_error(void *error_data, void *error_ecc,
void *correct_data, void *correct_ecc, const size_t size)
{ … }
static int no_bit_error_verify(void *error_data, void *error_ecc,
void *correct_data, const size_t size)
{ … }
static void single_bit_error_in_data(void *error_data, void *error_ecc,
void *correct_data, void *correct_ecc, const size_t size)
{ … }
static void single_bit_error_in_ecc(void *error_data, void *error_ecc,
void *correct_data, void *correct_ecc, const size_t size)
{ … }
static int single_bit_error_correct(void *error_data, void *error_ecc,
void *correct_data, const size_t size)
{ … }
static void double_bit_error_in_data(void *error_data, void *error_ecc,
void *correct_data, void *correct_ecc, const size_t size)
{ … }
static void single_bit_error_in_data_and_ecc(void *error_data, void *error_ecc,
void *correct_data, void *correct_ecc, const size_t size)
{ … }
static void double_bit_error_in_ecc(void *error_data, void *error_ecc,
void *correct_data, void *correct_ecc, const size_t size)
{ … }
static int double_bit_error_detect(void *error_data, void *error_ecc,
void *correct_data, const size_t size)
{ … }
static const struct nand_ecc_test nand_ecc_test[] = …;
static void dump_data_ecc(void *error_data, void *error_ecc, void *correct_data,
void *correct_ecc, const size_t size)
{ … }
static int nand_ecc_test_run(const size_t size)
{ … }
#else
static int nand_ecc_test_run(const size_t size)
{
return 0;
}
#endif
static int __init ecc_test_init(void)
{ … }
static void __exit ecc_test_exit(void)
{ … }
module_init(ecc_test_init);
module_exit(ecc_test_exit);
MODULE_DESCRIPTION(…) …;
MODULE_AUTHOR(…) …;
MODULE_LICENSE(…) …;