Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b7ac2cf1 authored by Pierre Ossman's avatar Pierre Ossman
Browse files

mmc_test: Revert "mmc_test: test oversized sg lists"



This reverts commit 48b5352e. Oversized
sg lists are not allowed anymore, and the core even checks for them in
debug mode, so this test is entirely incorrect.

Signed-off-by: default avatarPierre Ossman <drzeus@drzeus.cx>
parent 980167b7
Loading
Loading
Loading
Loading
+3 −82
Original line number Diff line number Diff line
@@ -388,16 +388,14 @@ static int mmc_test_transfer(struct mmc_test_card *test,
	int ret, i;
	unsigned long flags;

	BUG_ON(blocks * blksz > BUFFER_SIZE);

	if (write) {
		for (i = 0;i < blocks * blksz;i++)
			test->scratch[i] = i;
	} else {
		memset(test->scratch, 0, blocks * blksz);
		memset(test->scratch, 0, BUFFER_SIZE);
	}
	local_irq_save(flags);
	sg_copy_from_buffer(sg, sg_len, test->scratch, blocks * blksz);
	sg_copy_from_buffer(sg, sg_len, test->scratch, BUFFER_SIZE);
	local_irq_restore(flags);

	ret = mmc_test_set_blksize(test, blksz);
@@ -444,7 +442,7 @@ static int mmc_test_transfer(struct mmc_test_card *test,
		}
	} else {
		local_irq_save(flags);
		sg_copy_to_buffer(sg, sg_len, test->scratch, blocks * blksz);
		sg_copy_to_buffer(sg, sg_len, test->scratch, BUFFER_SIZE);
		local_irq_restore(flags);
		for (i = 0;i < blocks * blksz;i++) {
			if (test->scratch[i] != (u8)i)
@@ -805,69 +803,6 @@ static int mmc_test_multi_xfersize_read(struct mmc_test_card *test)
	return 0;
}

static int mmc_test_bigsg_write(struct mmc_test_card *test)
{
	int ret;
	unsigned int size;
	struct scatterlist sg;

	if (test->card->host->max_blk_count == 1)
		return RESULT_UNSUP_HOST;

	size = PAGE_SIZE * 2;
	size = min(size, test->card->host->max_req_size);
	size = min(size, test->card->host->max_seg_size);
	size = min(size, test->card->host->max_blk_count * 512);

	memset(test->buffer, 0, BUFFER_SIZE);

	if (size < 1024)
		return RESULT_UNSUP_HOST;

	sg_init_table(&sg, 1);
	sg_init_one(&sg, test->buffer, BUFFER_SIZE);

	ret = mmc_test_transfer(test, &sg, 1, 0, size/512, 512, 1);
	if (ret)
		return ret;

	return 0;
}

static int mmc_test_bigsg_read(struct mmc_test_card *test)
{
	int ret, i;
	unsigned int size;
	struct scatterlist sg;

	if (test->card->host->max_blk_count == 1)
		return RESULT_UNSUP_HOST;

	size = PAGE_SIZE * 2;
	size = min(size, test->card->host->max_req_size);
	size = min(size, test->card->host->max_seg_size);
	size = min(size, test->card->host->max_blk_count * 512);

	if (size < 1024)
		return RESULT_UNSUP_HOST;

	memset(test->buffer, 0xCD, BUFFER_SIZE);

	sg_init_table(&sg, 1);
	sg_init_one(&sg, test->buffer, BUFFER_SIZE);
	ret = mmc_test_transfer(test, &sg, 1, 0, size/512, 512, 0);
	if (ret)
		return ret;

	/* mmc_test_transfer() doesn't check for read overflows */
	for (i = size;i < BUFFER_SIZE;i++) {
		if (test->buffer[i] != 0xCD)
			return RESULT_FAIL;
	}

	return 0;
}

#ifdef CONFIG_HIGHMEM

static int mmc_test_write_high(struct mmc_test_card *test)
@@ -1071,20 +1006,6 @@ static const struct mmc_test_case mmc_test_cases[] = {
		.run = mmc_test_multi_xfersize_read,
	},

	{
		.name = "Over-sized SG list write",
		.prepare = mmc_test_prepare_write,
		.run = mmc_test_bigsg_write,
		.cleanup = mmc_test_cleanup,
	},

	{
		.name = "Over-sized SG list read",
		.prepare = mmc_test_prepare_read,
		.run = mmc_test_bigsg_read,
		.cleanup = mmc_test_cleanup,
	},

#ifdef CONFIG_HIGHMEM

	{