Commit 9162afa2 authored by Cristian Marussi's avatar Cristian Marussi Committed by Sudeep Holla
Browse files

firmware: arm_scmi: Cleanup unused core transfer helper wrappers

Remove unused core scmi_xfer wrappers now that we have migrated all
protocols to the new interface based on protocol handles.

Link: https://lore.kernel.org/r/20210316124903.35011-34-cristian.marussi@arm.com


Tested-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
Signed-off-by: default avatarCristian Marussi <cristian.marussi@arm.com>
Signed-off-by: default avatarSudeep Holla <sudeep.holla@arm.com>
parent 51fe1b15
Loading
Loading
Loading
Loading
+0 −15
Original line number Diff line number Diff line
@@ -143,15 +143,6 @@ struct scmi_xfer {
	struct completion *async_done;
};

void scmi_xfer_put(const struct scmi_handle *h, struct scmi_xfer *xfer);
int scmi_do_xfer(const struct scmi_handle *h, struct scmi_xfer *xfer);
int scmi_do_xfer_with_response(const struct scmi_handle *h,
			       struct scmi_xfer *xfer);
int scmi_xfer_get_init(const struct scmi_handle *h, u8 msg_id, u8 prot_id,
		       size_t tx_size, size_t rx_size, struct scmi_xfer **p);
void scmi_reset_rx_to_maxsz(const struct scmi_handle *handle,
			    struct scmi_xfer *xfer);

struct scmi_xfer_ops;

/**
@@ -181,11 +172,6 @@ struct scmi_protocol_handle {
	void *(*get_priv)(const struct scmi_protocol_handle *ph);
};

const struct scmi_protocol_handle *
scmi_map_protocol_handle(const struct scmi_handle *handle, u8 prot_id);

struct scmi_handle *scmi_map_scmi_handle(const struct scmi_protocol_handle *ph);

/**
 * struct scmi_xfer_ops  - References to the core SCMI xfer operations.
 * @version_get: Get this version protocol.
@@ -220,7 +206,6 @@ scmi_revision_area_get(const struct scmi_protocol_handle *ph);
int scmi_handle_put(const struct scmi_handle *handle);
struct scmi_handle *scmi_handle_get(struct device *dev);
void scmi_set_handle(struct scmi_device *scmi_dev);
int scmi_version_get(const struct scmi_handle *h, u8 protocol, u32 *version);
void scmi_setup_protocol_implemented(const struct scmi_protocol_handle *ph,
				     u8 *prot_imp);

+0 −91
Original line number Diff line number Diff line
@@ -349,28 +349,6 @@ void scmi_rx_callback(struct scmi_chan_info *cinfo, u32 msg_hdr)
	}
}

/* Transient code wrapper to ease API migration */
const struct scmi_protocol_handle *
scmi_map_protocol_handle(const struct scmi_handle *handle, u8 prot_id)
{
	struct scmi_info *info = handle_to_scmi_info(handle);
	const struct scmi_protocol_instance *pi;

	mutex_lock(&info->protocols_mtx);
	pi = idr_find(&info->protocols, prot_id);
	mutex_unlock(&info->protocols_mtx);

	return pi ? &pi->ph : NULL;
}

/* Transient code wrapper to ease API migration */
struct scmi_handle *scmi_map_scmi_handle(const struct scmi_protocol_handle *ph)
{
	const struct scmi_protocol_instance *pi = ph_to_pi(ph);

	return (struct scmi_handle *)pi->handle;
}

/**
 * xfer_put() - Release a transmit message
 *
@@ -386,17 +364,6 @@ static void xfer_put(const struct scmi_protocol_handle *ph,
	__scmi_xfer_put(&info->tx_minfo, xfer);
}

void scmi_xfer_put(const struct scmi_handle *h, struct scmi_xfer *xfer)
{
	const struct scmi_protocol_handle *ph;

	ph = scmi_map_protocol_handle(h, xfer->hdr.protocol_id);
	if (!ph)
		return;

	return xfer_put(ph, xfer);
}

#define SCMI_MAX_POLL_TO_NS	(100 * NSEC_PER_USEC)

static bool scmi_xfer_done_no_timeout(struct scmi_chan_info *cinfo,
@@ -480,17 +447,6 @@ static int do_xfer(const struct scmi_protocol_handle *ph,
	return ret;
}

int scmi_do_xfer(const struct scmi_handle *h, struct scmi_xfer *xfer)
{
	const struct scmi_protocol_handle *ph;

	ph = scmi_map_protocol_handle(h, xfer->hdr.protocol_id);
	if (!ph)
		return -EINVAL;

	return do_xfer(ph, xfer);
}

static void reset_rx_to_maxsz(const struct scmi_protocol_handle *ph,
			      struct scmi_xfer *xfer)
{
@@ -500,18 +456,6 @@ static void reset_rx_to_maxsz(const struct scmi_protocol_handle *ph,
	xfer->rx.len = info->desc->max_msg_size;
}

void scmi_reset_rx_to_maxsz(const struct scmi_handle *handle,
			    struct scmi_xfer *xfer)
{
	const struct scmi_protocol_handle *ph;

	ph = scmi_map_protocol_handle(handle, xfer->hdr.protocol_id);
	if (!ph)
		return;

	return reset_rx_to_maxsz(ph, xfer);
}

#define SCMI_MAX_RESPONSE_TIMEOUT	(2 * MSEC_PER_SEC)

/**
@@ -543,18 +487,6 @@ static int do_xfer_with_response(const struct scmi_protocol_handle *ph,
	return ret;
}

int scmi_do_xfer_with_response(const struct scmi_handle *h,
			       struct scmi_xfer *xfer)
{
	const struct scmi_protocol_handle *ph;

	ph = scmi_map_protocol_handle(h, xfer->hdr.protocol_id);
	if (!ph)
		return -EINVAL;

	return do_xfer_with_response(ph, xfer);
}

/**
 * xfer_get_init() - Allocate and initialise one message for transmit
 *
@@ -604,18 +536,6 @@ static int xfer_get_init(const struct scmi_protocol_handle *ph,
	return 0;
}

int scmi_xfer_get_init(const struct scmi_handle *h, u8 msg_id, u8 prot_id,
		       size_t tx_size, size_t rx_size, struct scmi_xfer **p)
{
	const struct scmi_protocol_handle *ph;

	ph = scmi_map_protocol_handle(h, prot_id);
	if (!ph)
		return -EINVAL;

	return xfer_get_init(ph, msg_id, tx_size, rx_size, p);
}

/**
 * version_get() - command to get the revision of the SCMI entity
 *
@@ -646,17 +566,6 @@ static int version_get(const struct scmi_protocol_handle *ph, u32 *version)
	return ret;
}

int scmi_version_get(const struct scmi_handle *h, u8 protocol, u32 *version)
{
	const struct scmi_protocol_handle *ph;

	ph = scmi_map_protocol_handle(h, protocol);
	if (!ph)
		return -EINVAL;

	return version_get(ph, version);
}

/**
 * scmi_set_protocol_priv  - Set protocol specific data at init time
 *