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

Commit e0da1721 authored by Ludovic Barre's avatar Ludovic Barre Committed by Ulf Hansson
Browse files

mmc: mmci: add validate_data callback



This patch adds validate_data callback at mmci_host_ops
to check specific constraints of variant.
Move mmci_validate_data function to regroup mmci_host_ops interfaces.

Signed-off-by: default avatarLudovic Barre <ludovic.barre@st.com>
Signed-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
parent cfccc6ac
Loading
Loading
Loading
Loading
+21 −18
Original line number Diff line number Diff line
@@ -239,24 +239,6 @@ static int mmci_card_busy(struct mmc_host *mmc)
	return busy;
}

/*
 * Validate mmc prerequisites
 */
static int mmci_validate_data(struct mmci_host *host,
			      struct mmc_data *data)
{
	if (!data)
		return 0;

	if (!is_power_of_2(data->blksz)) {
		dev_err(mmc_dev(host->mmc),
			"unsupported block size (%d bytes)\n", data->blksz);
		return -EINVAL;
	}

	return 0;
}

static void mmci_reg_delay(struct mmci_host *host)
{
	/*
@@ -392,6 +374,27 @@ void mmci_dma_setup(struct mmci_host *host)
	host->use_dma = true;
}

/*
 * Validate mmc prerequisites
 */
static int mmci_validate_data(struct mmci_host *host,
			      struct mmc_data *data)
{
	if (!data)
		return 0;

	if (!is_power_of_2(data->blksz)) {
		dev_err(mmc_dev(host->mmc),
			"unsupported block size (%d bytes)\n", data->blksz);
		return -EINVAL;
	}

	if (host->ops && host->ops->validate_data)
		return host->ops->validate_data(host, data);

	return 0;
}

int mmci_prep_data(struct mmci_host *host, struct mmc_data *data, bool next)
{
	int err;
+1 −0
Original line number Diff line number Diff line
@@ -273,6 +273,7 @@ struct variant_data {

/* mmci variant callbacks */
struct mmci_host_ops {
	int (*validate_data)(struct mmci_host *host, struct mmc_data *data);
	int (*prep_data)(struct mmci_host *host, struct mmc_data *data,
			 bool next);
	void (*unprep_data)(struct mmci_host *host, struct mmc_data *data,