#include <linux/delay.h>
#include <linux/kernel.h>
#include <linux/ktime.h>
#include <linux/list.h>
#include <linux/list_sort.h>
#include <linux/mod_devicetable.h>
#include <linux/module.h>
#include <linux/printk.h>
#include <linux/vmalloc.h>
#include <linux/spi/spi.h>
#include "spi-test.h"
static int simulate_only;
module_param(simulate_only, int, 0);
MODULE_PARM_DESC(…) …;
static int dump_messages;
module_param(dump_messages, int, 0);
MODULE_PARM_DESC(…) …;
static int loopback;
module_param(loopback, int, 0);
MODULE_PARM_DESC(…) …;
static int loop_req;
module_param(loop_req, int, 0);
MODULE_PARM_DESC(…) …;
static int no_cs;
module_param(no_cs, int, 0);
MODULE_PARM_DESC(…) …;
static int run_only_iter_len = …;
module_param(run_only_iter_len, int, 0);
MODULE_PARM_DESC(…) …;
static int run_only_test = …;
module_param(run_only_test, int, 0);
MODULE_PARM_DESC(…) …;
static int use_vmalloc;
module_param(use_vmalloc, int, 0644);
MODULE_PARM_DESC(…) …;
static int check_ranges = …;
module_param(check_ranges, int, 0644);
MODULE_PARM_DESC(…) …;
static unsigned int delay_ms = …;
module_param(delay_ms, uint, 0644);
MODULE_PARM_DESC(…) …;
static struct spi_test spi_tests[] = …;
static int spi_loopback_test_probe(struct spi_device *spi)
{ … }
static struct of_device_id spi_loopback_test_of_match[] = …;
module_param_string(…);
MODULE_DEVICE_TABLE(…);
static struct spi_driver spi_loopback_test_driver = …;
module_spi_driver(…) …;
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;
#define RANGE_CHECK(ptr, plen, start, slen) …
#define SPI_TEST_MAX_SIZE_PLUS …
static void spi_test_print_hex_dump(char *pre, const void *ptr, size_t len)
{ … }
static void spi_test_dump_message(struct spi_device *spi,
struct spi_message *msg,
bool dump_data)
{ … }
struct rx_ranges { … };
static int rx_ranges_cmp(void *priv, const struct list_head *a,
const struct list_head *b)
{ … }
static int spi_check_rx_ranges(struct spi_device *spi,
struct spi_message *msg,
void *rx)
{ … }
static int spi_test_check_elapsed_time(struct spi_device *spi,
struct spi_test *test)
{ … }
static int spi_test_check_loopback_result(struct spi_device *spi,
struct spi_message *msg,
void *tx, void *rx)
{ … }
static int spi_test_translate(struct spi_device *spi,
void **ptr, size_t len,
void *tx, void *rx)
{ … }
static int spi_test_fill_pattern(struct spi_device *spi,
struct spi_test *test)
{ … }
static int _spi_test_run_iter(struct spi_device *spi,
struct spi_test *test,
void *tx, void *rx)
{ … }
static int spi_test_run_iter(struct spi_device *spi,
const struct spi_test *testtemplate,
void *tx, void *rx,
size_t len,
size_t tx_off,
size_t rx_off
)
{ … }
int spi_test_execute_msg(struct spi_device *spi, struct spi_test *test,
void *tx, void *rx)
{ … }
EXPORT_SYMBOL_GPL(…);
int spi_test_run_test(struct spi_device *spi, const struct spi_test *test,
void *tx, void *rx)
{ … }
EXPORT_SYMBOL_GPL(…);
int spi_test_run_tests(struct spi_device *spi,
struct spi_test *tests)
{ … }
EXPORT_SYMBOL_GPL(…);