firmware: arm_scmi: rename scmi_xfer_{init,get,put}
Just after the initial patches were queued, Jonathan Cameron mentioned that scmi_one_xfer_{get_put} were not very clear and suggested to use scmi_xfer_{alloc,free}. While I agree to some extent, the reason not to have alloc/free as these are preallocated buffers and these functions just returns a reference to free slot in that preallocated array. However it was agreed to drop "_one" as it's implicit that we are always dealing with one slot anyways. This patch updates the name accordingly dropping "_one" in both {get,put} functions. Also scmi_one_xfer_init is renamed as scmi_xfer_get_init to reflect the fact that it gets the free slots and then initialise it. Reported-by: Jonathan Cameron <jonathan.cameron@huawei.com> Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
This commit is contained in:
Родитель
7859e08c1b
Коммит
14e297b3b8
|
@ -37,7 +37,7 @@ static int scmi_base_attributes_get(const struct scmi_handle *handle)
|
||||||
struct scmi_msg_resp_base_attributes *attr_info;
|
struct scmi_msg_resp_base_attributes *attr_info;
|
||||||
struct scmi_revision_info *rev = handle->version;
|
struct scmi_revision_info *rev = handle->version;
|
||||||
|
|
||||||
ret = scmi_one_xfer_init(handle, PROTOCOL_ATTRIBUTES,
|
ret = scmi_xfer_get_init(handle, PROTOCOL_ATTRIBUTES,
|
||||||
SCMI_PROTOCOL_BASE, 0, sizeof(*attr_info), &t);
|
SCMI_PROTOCOL_BASE, 0, sizeof(*attr_info), &t);
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -49,7 +49,7 @@ static int scmi_base_attributes_get(const struct scmi_handle *handle)
|
||||||
rev->num_agents = attr_info->num_agents;
|
rev->num_agents = attr_info->num_agents;
|
||||||
}
|
}
|
||||||
|
|
||||||
scmi_one_xfer_put(handle, t);
|
scmi_xfer_put(handle, t);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -81,7 +81,7 @@ scmi_base_vendor_id_get(const struct scmi_handle *handle, bool sub_vendor)
|
||||||
size = ARRAY_SIZE(rev->vendor_id);
|
size = ARRAY_SIZE(rev->vendor_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = scmi_one_xfer_init(handle, cmd, SCMI_PROTOCOL_BASE, 0, size, &t);
|
ret = scmi_xfer_get_init(handle, cmd, SCMI_PROTOCOL_BASE, 0, size, &t);
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
|
@ -89,7 +89,8 @@ scmi_base_vendor_id_get(const struct scmi_handle *handle, bool sub_vendor)
|
||||||
if (!ret)
|
if (!ret)
|
||||||
memcpy(vendor_id, t->rx.buf, size);
|
memcpy(vendor_id, t->rx.buf, size);
|
||||||
|
|
||||||
scmi_one_xfer_put(handle, t);
|
scmi_xfer_put(handle, t);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -110,7 +111,7 @@ scmi_base_implementation_version_get(const struct scmi_handle *handle)
|
||||||
struct scmi_xfer *t;
|
struct scmi_xfer *t;
|
||||||
struct scmi_revision_info *rev = handle->version;
|
struct scmi_revision_info *rev = handle->version;
|
||||||
|
|
||||||
ret = scmi_one_xfer_init(handle, BASE_DISCOVER_IMPLEMENT_VERSION,
|
ret = scmi_xfer_get_init(handle, BASE_DISCOVER_IMPLEMENT_VERSION,
|
||||||
SCMI_PROTOCOL_BASE, 0, sizeof(*impl_ver), &t);
|
SCMI_PROTOCOL_BASE, 0, sizeof(*impl_ver), &t);
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -121,7 +122,8 @@ scmi_base_implementation_version_get(const struct scmi_handle *handle)
|
||||||
rev->impl_ver = le32_to_cpu(*impl_ver);
|
rev->impl_ver = le32_to_cpu(*impl_ver);
|
||||||
}
|
}
|
||||||
|
|
||||||
scmi_one_xfer_put(handle, t);
|
scmi_xfer_put(handle, t);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -144,7 +146,7 @@ static int scmi_base_implementation_list_get(const struct scmi_handle *handle,
|
||||||
u32 tot_num_ret = 0, loop_num_ret;
|
u32 tot_num_ret = 0, loop_num_ret;
|
||||||
struct device *dev = handle->dev;
|
struct device *dev = handle->dev;
|
||||||
|
|
||||||
ret = scmi_one_xfer_init(handle, BASE_DISCOVER_LIST_PROTOCOLS,
|
ret = scmi_xfer_get_init(handle, BASE_DISCOVER_LIST_PROTOCOLS,
|
||||||
SCMI_PROTOCOL_BASE, sizeof(*num_skip), 0, &t);
|
SCMI_PROTOCOL_BASE, sizeof(*num_skip), 0, &t);
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -173,7 +175,7 @@ static int scmi_base_implementation_list_get(const struct scmi_handle *handle,
|
||||||
tot_num_ret += loop_num_ret;
|
tot_num_ret += loop_num_ret;
|
||||||
} while (loop_num_ret);
|
} while (loop_num_ret);
|
||||||
|
|
||||||
scmi_one_xfer_put(handle, t);
|
scmi_xfer_put(handle, t);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -196,7 +198,7 @@ static int scmi_base_discover_agent_get(const struct scmi_handle *handle,
|
||||||
int ret;
|
int ret;
|
||||||
struct scmi_xfer *t;
|
struct scmi_xfer *t;
|
||||||
|
|
||||||
ret = scmi_one_xfer_init(handle, BASE_DISCOVER_AGENT,
|
ret = scmi_xfer_get_init(handle, BASE_DISCOVER_AGENT,
|
||||||
SCMI_PROTOCOL_BASE, sizeof(__le32),
|
SCMI_PROTOCOL_BASE, sizeof(__le32),
|
||||||
SCMI_MAX_STR_SIZE, &t);
|
SCMI_MAX_STR_SIZE, &t);
|
||||||
if (ret)
|
if (ret)
|
||||||
|
@ -208,7 +210,8 @@ static int scmi_base_discover_agent_get(const struct scmi_handle *handle,
|
||||||
if (!ret)
|
if (!ret)
|
||||||
memcpy(name, t->rx.buf, SCMI_MAX_STR_SIZE);
|
memcpy(name, t->rx.buf, SCMI_MAX_STR_SIZE);
|
||||||
|
|
||||||
scmi_one_xfer_put(handle, t);
|
scmi_xfer_put(handle, t);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -77,7 +77,7 @@ static int scmi_clock_protocol_attributes_get(const struct scmi_handle *handle,
|
||||||
struct scmi_xfer *t;
|
struct scmi_xfer *t;
|
||||||
struct scmi_msg_resp_clock_protocol_attributes *attr;
|
struct scmi_msg_resp_clock_protocol_attributes *attr;
|
||||||
|
|
||||||
ret = scmi_one_xfer_init(handle, PROTOCOL_ATTRIBUTES,
|
ret = scmi_xfer_get_init(handle, PROTOCOL_ATTRIBUTES,
|
||||||
SCMI_PROTOCOL_CLOCK, 0, sizeof(*attr), &t);
|
SCMI_PROTOCOL_CLOCK, 0, sizeof(*attr), &t);
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -90,7 +90,7 @@ static int scmi_clock_protocol_attributes_get(const struct scmi_handle *handle,
|
||||||
ci->max_async_req = attr->max_async_req;
|
ci->max_async_req = attr->max_async_req;
|
||||||
}
|
}
|
||||||
|
|
||||||
scmi_one_xfer_put(handle, t);
|
scmi_xfer_put(handle, t);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -101,7 +101,7 @@ static int scmi_clock_attributes_get(const struct scmi_handle *handle,
|
||||||
struct scmi_xfer *t;
|
struct scmi_xfer *t;
|
||||||
struct scmi_msg_resp_clock_attributes *attr;
|
struct scmi_msg_resp_clock_attributes *attr;
|
||||||
|
|
||||||
ret = scmi_one_xfer_init(handle, CLOCK_ATTRIBUTES, SCMI_PROTOCOL_CLOCK,
|
ret = scmi_xfer_get_init(handle, CLOCK_ATTRIBUTES, SCMI_PROTOCOL_CLOCK,
|
||||||
sizeof(clk_id), sizeof(*attr), &t);
|
sizeof(clk_id), sizeof(*attr), &t);
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -115,7 +115,7 @@ static int scmi_clock_attributes_get(const struct scmi_handle *handle,
|
||||||
else
|
else
|
||||||
clk->name[0] = '\0';
|
clk->name[0] = '\0';
|
||||||
|
|
||||||
scmi_one_xfer_put(handle, t);
|
scmi_xfer_put(handle, t);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -132,7 +132,7 @@ scmi_clock_describe_rates_get(const struct scmi_handle *handle, u32 clk_id,
|
||||||
struct scmi_msg_clock_describe_rates *clk_desc;
|
struct scmi_msg_clock_describe_rates *clk_desc;
|
||||||
struct scmi_msg_resp_clock_describe_rates *rlist;
|
struct scmi_msg_resp_clock_describe_rates *rlist;
|
||||||
|
|
||||||
ret = scmi_one_xfer_init(handle, CLOCK_DESCRIBE_RATES,
|
ret = scmi_xfer_get_init(handle, CLOCK_DESCRIBE_RATES,
|
||||||
SCMI_PROTOCOL_CLOCK, sizeof(*clk_desc), 0, &t);
|
SCMI_PROTOCOL_CLOCK, sizeof(*clk_desc), 0, &t);
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -186,7 +186,7 @@ scmi_clock_describe_rates_get(const struct scmi_handle *handle, u32 clk_id,
|
||||||
clk->list.num_rates = tot_rate_cnt;
|
clk->list.num_rates = tot_rate_cnt;
|
||||||
|
|
||||||
err:
|
err:
|
||||||
scmi_one_xfer_put(handle, t);
|
scmi_xfer_put(handle, t);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -196,7 +196,7 @@ scmi_clock_rate_get(const struct scmi_handle *handle, u32 clk_id, u64 *value)
|
||||||
int ret;
|
int ret;
|
||||||
struct scmi_xfer *t;
|
struct scmi_xfer *t;
|
||||||
|
|
||||||
ret = scmi_one_xfer_init(handle, CLOCK_RATE_GET, SCMI_PROTOCOL_CLOCK,
|
ret = scmi_xfer_get_init(handle, CLOCK_RATE_GET, SCMI_PROTOCOL_CLOCK,
|
||||||
sizeof(__le32), sizeof(u64), &t);
|
sizeof(__le32), sizeof(u64), &t);
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -211,7 +211,7 @@ scmi_clock_rate_get(const struct scmi_handle *handle, u32 clk_id, u64 *value)
|
||||||
*value |= (u64)le32_to_cpu(*(pval + 1)) << 32;
|
*value |= (u64)le32_to_cpu(*(pval + 1)) << 32;
|
||||||
}
|
}
|
||||||
|
|
||||||
scmi_one_xfer_put(handle, t);
|
scmi_xfer_put(handle, t);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -222,7 +222,7 @@ static int scmi_clock_rate_set(const struct scmi_handle *handle, u32 clk_id,
|
||||||
struct scmi_xfer *t;
|
struct scmi_xfer *t;
|
||||||
struct scmi_clock_set_rate *cfg;
|
struct scmi_clock_set_rate *cfg;
|
||||||
|
|
||||||
ret = scmi_one_xfer_init(handle, CLOCK_RATE_SET, SCMI_PROTOCOL_CLOCK,
|
ret = scmi_xfer_get_init(handle, CLOCK_RATE_SET, SCMI_PROTOCOL_CLOCK,
|
||||||
sizeof(*cfg), 0, &t);
|
sizeof(*cfg), 0, &t);
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -235,7 +235,7 @@ static int scmi_clock_rate_set(const struct scmi_handle *handle, u32 clk_id,
|
||||||
|
|
||||||
ret = scmi_do_xfer(handle, t);
|
ret = scmi_do_xfer(handle, t);
|
||||||
|
|
||||||
scmi_one_xfer_put(handle, t);
|
scmi_xfer_put(handle, t);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -246,7 +246,7 @@ scmi_clock_config_set(const struct scmi_handle *handle, u32 clk_id, u32 config)
|
||||||
struct scmi_xfer *t;
|
struct scmi_xfer *t;
|
||||||
struct scmi_clock_set_config *cfg;
|
struct scmi_clock_set_config *cfg;
|
||||||
|
|
||||||
ret = scmi_one_xfer_init(handle, CLOCK_CONFIG_SET, SCMI_PROTOCOL_CLOCK,
|
ret = scmi_xfer_get_init(handle, CLOCK_CONFIG_SET, SCMI_PROTOCOL_CLOCK,
|
||||||
sizeof(*cfg), 0, &t);
|
sizeof(*cfg), 0, &t);
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -257,7 +257,7 @@ scmi_clock_config_set(const struct scmi_handle *handle, u32 clk_id, u32 config)
|
||||||
|
|
||||||
ret = scmi_do_xfer(handle, t);
|
ret = scmi_do_xfer(handle, t);
|
||||||
|
|
||||||
scmi_one_xfer_put(handle, t);
|
scmi_xfer_put(handle, t);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -95,9 +95,9 @@ struct scmi_xfer {
|
||||||
struct completion done;
|
struct completion done;
|
||||||
};
|
};
|
||||||
|
|
||||||
void scmi_one_xfer_put(const struct scmi_handle *h, struct scmi_xfer *xfer);
|
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(const struct scmi_handle *h, struct scmi_xfer *xfer);
|
||||||
int scmi_one_xfer_init(const struct scmi_handle *h, u8 msg_id, u8 prot_id,
|
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);
|
size_t tx_size, size_t rx_size, struct scmi_xfer **p);
|
||||||
int scmi_handle_put(const struct scmi_handle *handle);
|
int scmi_handle_put(const struct scmi_handle *handle);
|
||||||
struct scmi_handle *scmi_handle_get(struct device *dev);
|
struct scmi_handle *scmi_handle_get(struct device *dev);
|
||||||
|
|
|
@ -295,7 +295,7 @@ static void scmi_tx_prepare(struct mbox_client *cl, void *m)
|
||||||
*
|
*
|
||||||
* Return: 0 if all went fine, else corresponding error.
|
* Return: 0 if all went fine, else corresponding error.
|
||||||
*/
|
*/
|
||||||
static struct scmi_xfer *scmi_one_xfer_get(const struct scmi_handle *handle)
|
static struct scmi_xfer *scmi_xfer_get(const struct scmi_handle *handle)
|
||||||
{
|
{
|
||||||
u16 xfer_id;
|
u16 xfer_id;
|
||||||
struct scmi_xfer *xfer;
|
struct scmi_xfer *xfer;
|
||||||
|
@ -324,14 +324,14 @@ static struct scmi_xfer *scmi_one_xfer_get(const struct scmi_handle *handle)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* scmi_one_xfer_put() - Release a message
|
* scmi_xfer_put() - Release a message
|
||||||
*
|
*
|
||||||
* @handle: Pointer to SCMI entity handle
|
* @handle: Pointer to SCMI entity handle
|
||||||
* @xfer: message that was reserved by scmi_xfer_get
|
* @xfer: message that was reserved by scmi_xfer_get
|
||||||
*
|
*
|
||||||
* This holds a spinlock to maintain integrity of internal data structures.
|
* This holds a spinlock to maintain integrity of internal data structures.
|
||||||
*/
|
*/
|
||||||
void scmi_one_xfer_put(const struct scmi_handle *handle, struct scmi_xfer *xfer)
|
void scmi_xfer_put(const struct scmi_handle *handle, struct scmi_xfer *xfer)
|
||||||
{
|
{
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
struct scmi_info *info = handle_to_scmi_info(handle);
|
struct scmi_info *info = handle_to_scmi_info(handle);
|
||||||
|
@ -436,7 +436,7 @@ int scmi_do_xfer(const struct scmi_handle *handle, struct scmi_xfer *xfer)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* scmi_one_xfer_init() - Allocate and initialise one message
|
* scmi_xfer_get_init() - Allocate and initialise one message
|
||||||
*
|
*
|
||||||
* @handle: Pointer to SCMI entity handle
|
* @handle: Pointer to SCMI entity handle
|
||||||
* @msg_id: Message identifier
|
* @msg_id: Message identifier
|
||||||
|
@ -445,13 +445,13 @@ int scmi_do_xfer(const struct scmi_handle *handle, struct scmi_xfer *xfer)
|
||||||
* @rx_size: receive message size
|
* @rx_size: receive message size
|
||||||
* @p: pointer to the allocated and initialised message
|
* @p: pointer to the allocated and initialised message
|
||||||
*
|
*
|
||||||
* This function allocates the message using @scmi_one_xfer_get and
|
* This function allocates the message using @scmi_xfer_get and
|
||||||
* initialise the header.
|
* initialise the header.
|
||||||
*
|
*
|
||||||
* Return: 0 if all went fine with @p pointing to message, else
|
* Return: 0 if all went fine with @p pointing to message, else
|
||||||
* corresponding error.
|
* corresponding error.
|
||||||
*/
|
*/
|
||||||
int scmi_one_xfer_init(const struct scmi_handle *handle, u8 msg_id, u8 prot_id,
|
int scmi_xfer_get_init(const struct scmi_handle *handle, u8 msg_id, u8 prot_id,
|
||||||
size_t tx_size, size_t rx_size, struct scmi_xfer **p)
|
size_t tx_size, size_t rx_size, struct scmi_xfer **p)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
@ -464,7 +464,7 @@ int scmi_one_xfer_init(const struct scmi_handle *handle, u8 msg_id, u8 prot_id,
|
||||||
tx_size > info->desc->max_msg_size)
|
tx_size > info->desc->max_msg_size)
|
||||||
return -ERANGE;
|
return -ERANGE;
|
||||||
|
|
||||||
xfer = scmi_one_xfer_get(handle);
|
xfer = scmi_xfer_get(handle);
|
||||||
if (IS_ERR(xfer)) {
|
if (IS_ERR(xfer)) {
|
||||||
ret = PTR_ERR(xfer);
|
ret = PTR_ERR(xfer);
|
||||||
dev_err(dev, "failed to get free message slot(%d)\n", ret);
|
dev_err(dev, "failed to get free message slot(%d)\n", ret);
|
||||||
|
@ -500,7 +500,7 @@ int scmi_version_get(const struct scmi_handle *handle, u8 protocol,
|
||||||
__le32 *rev_info;
|
__le32 *rev_info;
|
||||||
struct scmi_xfer *t;
|
struct scmi_xfer *t;
|
||||||
|
|
||||||
ret = scmi_one_xfer_init(handle, PROTOCOL_VERSION, protocol, 0,
|
ret = scmi_xfer_get_init(handle, PROTOCOL_VERSION, protocol, 0,
|
||||||
sizeof(*version), &t);
|
sizeof(*version), &t);
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -511,7 +511,7 @@ int scmi_version_get(const struct scmi_handle *handle, u8 protocol,
|
||||||
*version = le32_to_cpu(*rev_info);
|
*version = le32_to_cpu(*rev_info);
|
||||||
}
|
}
|
||||||
|
|
||||||
scmi_one_xfer_put(handle, t);
|
scmi_xfer_put(handle, t);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -539,7 +539,7 @@ scmi_is_protocol_implemented(const struct scmi_handle *handle, u8 prot_id)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* scmi_handle_get() - Get the SCMI handle for a device
|
* scmi_handle_get() - Get the SCMI handle for a device
|
||||||
*
|
*
|
||||||
* @dev: pointer to device for which we want SCMI handle
|
* @dev: pointer to device for which we want SCMI handle
|
||||||
*
|
*
|
||||||
|
|
|
@ -115,7 +115,7 @@ static int scmi_perf_attributes_get(const struct scmi_handle *handle,
|
||||||
struct scmi_xfer *t;
|
struct scmi_xfer *t;
|
||||||
struct scmi_msg_resp_perf_attributes *attr;
|
struct scmi_msg_resp_perf_attributes *attr;
|
||||||
|
|
||||||
ret = scmi_one_xfer_init(handle, PROTOCOL_ATTRIBUTES,
|
ret = scmi_xfer_get_init(handle, PROTOCOL_ATTRIBUTES,
|
||||||
SCMI_PROTOCOL_PERF, 0, sizeof(*attr), &t);
|
SCMI_PROTOCOL_PERF, 0, sizeof(*attr), &t);
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -133,7 +133,7 @@ static int scmi_perf_attributes_get(const struct scmi_handle *handle,
|
||||||
pi->stats_size = le32_to_cpu(attr->stats_size);
|
pi->stats_size = le32_to_cpu(attr->stats_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
scmi_one_xfer_put(handle, t);
|
scmi_xfer_put(handle, t);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -145,7 +145,7 @@ scmi_perf_domain_attributes_get(const struct scmi_handle *handle, u32 domain,
|
||||||
struct scmi_xfer *t;
|
struct scmi_xfer *t;
|
||||||
struct scmi_msg_resp_perf_domain_attributes *attr;
|
struct scmi_msg_resp_perf_domain_attributes *attr;
|
||||||
|
|
||||||
ret = scmi_one_xfer_init(handle, PERF_DOMAIN_ATTRIBUTES,
|
ret = scmi_xfer_get_init(handle, PERF_DOMAIN_ATTRIBUTES,
|
||||||
SCMI_PROTOCOL_PERF, sizeof(domain),
|
SCMI_PROTOCOL_PERF, sizeof(domain),
|
||||||
sizeof(*attr), &t);
|
sizeof(*attr), &t);
|
||||||
if (ret)
|
if (ret)
|
||||||
|
@ -171,7 +171,7 @@ scmi_perf_domain_attributes_get(const struct scmi_handle *handle, u32 domain,
|
||||||
memcpy(dom_info->name, attr->name, SCMI_MAX_STR_SIZE);
|
memcpy(dom_info->name, attr->name, SCMI_MAX_STR_SIZE);
|
||||||
}
|
}
|
||||||
|
|
||||||
scmi_one_xfer_put(handle, t);
|
scmi_xfer_put(handle, t);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -194,7 +194,7 @@ scmi_perf_describe_levels_get(const struct scmi_handle *handle, u32 domain,
|
||||||
struct scmi_msg_perf_describe_levels *dom_info;
|
struct scmi_msg_perf_describe_levels *dom_info;
|
||||||
struct scmi_msg_resp_perf_describe_levels *level_info;
|
struct scmi_msg_resp_perf_describe_levels *level_info;
|
||||||
|
|
||||||
ret = scmi_one_xfer_init(handle, PERF_DESCRIBE_LEVELS,
|
ret = scmi_xfer_get_init(handle, PERF_DESCRIBE_LEVELS,
|
||||||
SCMI_PROTOCOL_PERF, sizeof(*dom_info), 0, &t);
|
SCMI_PROTOCOL_PERF, sizeof(*dom_info), 0, &t);
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -237,7 +237,7 @@ scmi_perf_describe_levels_get(const struct scmi_handle *handle, u32 domain,
|
||||||
} while (num_returned && num_remaining);
|
} while (num_returned && num_remaining);
|
||||||
|
|
||||||
perf_dom->opp_count = tot_opp_cnt;
|
perf_dom->opp_count = tot_opp_cnt;
|
||||||
scmi_one_xfer_put(handle, t);
|
scmi_xfer_put(handle, t);
|
||||||
|
|
||||||
sort(perf_dom->opp, tot_opp_cnt, sizeof(*opp), opp_cmp_func, NULL);
|
sort(perf_dom->opp, tot_opp_cnt, sizeof(*opp), opp_cmp_func, NULL);
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -250,7 +250,7 @@ static int scmi_perf_limits_set(const struct scmi_handle *handle, u32 domain,
|
||||||
struct scmi_xfer *t;
|
struct scmi_xfer *t;
|
||||||
struct scmi_perf_set_limits *limits;
|
struct scmi_perf_set_limits *limits;
|
||||||
|
|
||||||
ret = scmi_one_xfer_init(handle, PERF_LIMITS_SET, SCMI_PROTOCOL_PERF,
|
ret = scmi_xfer_get_init(handle, PERF_LIMITS_SET, SCMI_PROTOCOL_PERF,
|
||||||
sizeof(*limits), 0, &t);
|
sizeof(*limits), 0, &t);
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -262,7 +262,7 @@ static int scmi_perf_limits_set(const struct scmi_handle *handle, u32 domain,
|
||||||
|
|
||||||
ret = scmi_do_xfer(handle, t);
|
ret = scmi_do_xfer(handle, t);
|
||||||
|
|
||||||
scmi_one_xfer_put(handle, t);
|
scmi_xfer_put(handle, t);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -273,7 +273,7 @@ static int scmi_perf_limits_get(const struct scmi_handle *handle, u32 domain,
|
||||||
struct scmi_xfer *t;
|
struct scmi_xfer *t;
|
||||||
struct scmi_perf_get_limits *limits;
|
struct scmi_perf_get_limits *limits;
|
||||||
|
|
||||||
ret = scmi_one_xfer_init(handle, PERF_LIMITS_GET, SCMI_PROTOCOL_PERF,
|
ret = scmi_xfer_get_init(handle, PERF_LIMITS_GET, SCMI_PROTOCOL_PERF,
|
||||||
sizeof(__le32), 0, &t);
|
sizeof(__le32), 0, &t);
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -288,7 +288,7 @@ static int scmi_perf_limits_get(const struct scmi_handle *handle, u32 domain,
|
||||||
*min_perf = le32_to_cpu(limits->min_level);
|
*min_perf = le32_to_cpu(limits->min_level);
|
||||||
}
|
}
|
||||||
|
|
||||||
scmi_one_xfer_put(handle, t);
|
scmi_xfer_put(handle, t);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -299,7 +299,7 @@ static int scmi_perf_level_set(const struct scmi_handle *handle, u32 domain,
|
||||||
struct scmi_xfer *t;
|
struct scmi_xfer *t;
|
||||||
struct scmi_perf_set_level *lvl;
|
struct scmi_perf_set_level *lvl;
|
||||||
|
|
||||||
ret = scmi_one_xfer_init(handle, PERF_LEVEL_SET, SCMI_PROTOCOL_PERF,
|
ret = scmi_xfer_get_init(handle, PERF_LEVEL_SET, SCMI_PROTOCOL_PERF,
|
||||||
sizeof(*lvl), 0, &t);
|
sizeof(*lvl), 0, &t);
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -311,7 +311,7 @@ static int scmi_perf_level_set(const struct scmi_handle *handle, u32 domain,
|
||||||
|
|
||||||
ret = scmi_do_xfer(handle, t);
|
ret = scmi_do_xfer(handle, t);
|
||||||
|
|
||||||
scmi_one_xfer_put(handle, t);
|
scmi_xfer_put(handle, t);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -321,7 +321,7 @@ static int scmi_perf_level_get(const struct scmi_handle *handle, u32 domain,
|
||||||
int ret;
|
int ret;
|
||||||
struct scmi_xfer *t;
|
struct scmi_xfer *t;
|
||||||
|
|
||||||
ret = scmi_one_xfer_init(handle, PERF_LEVEL_GET, SCMI_PROTOCOL_PERF,
|
ret = scmi_xfer_get_init(handle, PERF_LEVEL_GET, SCMI_PROTOCOL_PERF,
|
||||||
sizeof(u32), sizeof(u32), &t);
|
sizeof(u32), sizeof(u32), &t);
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -333,7 +333,7 @@ static int scmi_perf_level_get(const struct scmi_handle *handle, u32 domain,
|
||||||
if (!ret)
|
if (!ret)
|
||||||
*level = le32_to_cpu(*(__le32 *)t->rx.buf);
|
*level = le32_to_cpu(*(__le32 *)t->rx.buf);
|
||||||
|
|
||||||
scmi_one_xfer_put(handle, t);
|
scmi_xfer_put(handle, t);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -63,7 +63,7 @@ static int scmi_power_attributes_get(const struct scmi_handle *handle,
|
||||||
struct scmi_xfer *t;
|
struct scmi_xfer *t;
|
||||||
struct scmi_msg_resp_power_attributes *attr;
|
struct scmi_msg_resp_power_attributes *attr;
|
||||||
|
|
||||||
ret = scmi_one_xfer_init(handle, PROTOCOL_ATTRIBUTES,
|
ret = scmi_xfer_get_init(handle, PROTOCOL_ATTRIBUTES,
|
||||||
SCMI_PROTOCOL_POWER, 0, sizeof(*attr), &t);
|
SCMI_PROTOCOL_POWER, 0, sizeof(*attr), &t);
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -78,7 +78,7 @@ static int scmi_power_attributes_get(const struct scmi_handle *handle,
|
||||||
pi->stats_size = le32_to_cpu(attr->stats_size);
|
pi->stats_size = le32_to_cpu(attr->stats_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
scmi_one_xfer_put(handle, t);
|
scmi_xfer_put(handle, t);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -90,7 +90,7 @@ scmi_power_domain_attributes_get(const struct scmi_handle *handle, u32 domain,
|
||||||
struct scmi_xfer *t;
|
struct scmi_xfer *t;
|
||||||
struct scmi_msg_resp_power_domain_attributes *attr;
|
struct scmi_msg_resp_power_domain_attributes *attr;
|
||||||
|
|
||||||
ret = scmi_one_xfer_init(handle, POWER_DOMAIN_ATTRIBUTES,
|
ret = scmi_xfer_get_init(handle, POWER_DOMAIN_ATTRIBUTES,
|
||||||
SCMI_PROTOCOL_POWER, sizeof(domain),
|
SCMI_PROTOCOL_POWER, sizeof(domain),
|
||||||
sizeof(*attr), &t);
|
sizeof(*attr), &t);
|
||||||
if (ret)
|
if (ret)
|
||||||
|
@ -109,7 +109,7 @@ scmi_power_domain_attributes_get(const struct scmi_handle *handle, u32 domain,
|
||||||
memcpy(dom_info->name, attr->name, SCMI_MAX_STR_SIZE);
|
memcpy(dom_info->name, attr->name, SCMI_MAX_STR_SIZE);
|
||||||
}
|
}
|
||||||
|
|
||||||
scmi_one_xfer_put(handle, t);
|
scmi_xfer_put(handle, t);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -120,7 +120,7 @@ scmi_power_state_set(const struct scmi_handle *handle, u32 domain, u32 state)
|
||||||
struct scmi_xfer *t;
|
struct scmi_xfer *t;
|
||||||
struct scmi_power_set_state *st;
|
struct scmi_power_set_state *st;
|
||||||
|
|
||||||
ret = scmi_one_xfer_init(handle, POWER_STATE_SET, SCMI_PROTOCOL_POWER,
|
ret = scmi_xfer_get_init(handle, POWER_STATE_SET, SCMI_PROTOCOL_POWER,
|
||||||
sizeof(*st), 0, &t);
|
sizeof(*st), 0, &t);
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -132,7 +132,7 @@ scmi_power_state_set(const struct scmi_handle *handle, u32 domain, u32 state)
|
||||||
|
|
||||||
ret = scmi_do_xfer(handle, t);
|
ret = scmi_do_xfer(handle, t);
|
||||||
|
|
||||||
scmi_one_xfer_put(handle, t);
|
scmi_xfer_put(handle, t);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -142,7 +142,7 @@ scmi_power_state_get(const struct scmi_handle *handle, u32 domain, u32 *state)
|
||||||
int ret;
|
int ret;
|
||||||
struct scmi_xfer *t;
|
struct scmi_xfer *t;
|
||||||
|
|
||||||
ret = scmi_one_xfer_init(handle, POWER_STATE_GET, SCMI_PROTOCOL_POWER,
|
ret = scmi_xfer_get_init(handle, POWER_STATE_GET, SCMI_PROTOCOL_POWER,
|
||||||
sizeof(u32), sizeof(u32), &t);
|
sizeof(u32), sizeof(u32), &t);
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -153,7 +153,7 @@ scmi_power_state_get(const struct scmi_handle *handle, u32 domain, u32 *state)
|
||||||
if (!ret)
|
if (!ret)
|
||||||
*state = le32_to_cpu(*(__le32 *)t->rx.buf);
|
*state = le32_to_cpu(*(__le32 *)t->rx.buf);
|
||||||
|
|
||||||
scmi_one_xfer_put(handle, t);
|
scmi_xfer_put(handle, t);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -79,7 +79,7 @@ static int scmi_sensor_attributes_get(const struct scmi_handle *handle,
|
||||||
struct scmi_xfer *t;
|
struct scmi_xfer *t;
|
||||||
struct scmi_msg_resp_sensor_attributes *attr;
|
struct scmi_msg_resp_sensor_attributes *attr;
|
||||||
|
|
||||||
ret = scmi_one_xfer_init(handle, PROTOCOL_ATTRIBUTES,
|
ret = scmi_xfer_get_init(handle, PROTOCOL_ATTRIBUTES,
|
||||||
SCMI_PROTOCOL_SENSOR, 0, sizeof(*attr), &t);
|
SCMI_PROTOCOL_SENSOR, 0, sizeof(*attr), &t);
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -95,7 +95,7 @@ static int scmi_sensor_attributes_get(const struct scmi_handle *handle,
|
||||||
si->reg_size = le32_to_cpu(attr->reg_size);
|
si->reg_size = le32_to_cpu(attr->reg_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
scmi_one_xfer_put(handle, t);
|
scmi_xfer_put(handle, t);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -108,7 +108,7 @@ static int scmi_sensor_description_get(const struct scmi_handle *handle,
|
||||||
struct scmi_xfer *t;
|
struct scmi_xfer *t;
|
||||||
struct scmi_msg_resp_sensor_description *buf;
|
struct scmi_msg_resp_sensor_description *buf;
|
||||||
|
|
||||||
ret = scmi_one_xfer_init(handle, SENSOR_DESCRIPTION_GET,
|
ret = scmi_xfer_get_init(handle, SENSOR_DESCRIPTION_GET,
|
||||||
SCMI_PROTOCOL_SENSOR, sizeof(__le32), 0, &t);
|
SCMI_PROTOCOL_SENSOR, sizeof(__le32), 0, &t);
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -150,7 +150,7 @@ static int scmi_sensor_description_get(const struct scmi_handle *handle,
|
||||||
*/
|
*/
|
||||||
} while (num_returned && num_remaining);
|
} while (num_returned && num_remaining);
|
||||||
|
|
||||||
scmi_one_xfer_put(handle, t);
|
scmi_xfer_put(handle, t);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -162,7 +162,7 @@ scmi_sensor_configuration_set(const struct scmi_handle *handle, u32 sensor_id)
|
||||||
struct scmi_xfer *t;
|
struct scmi_xfer *t;
|
||||||
struct scmi_msg_set_sensor_config *cfg;
|
struct scmi_msg_set_sensor_config *cfg;
|
||||||
|
|
||||||
ret = scmi_one_xfer_init(handle, SENSOR_CONFIG_SET,
|
ret = scmi_xfer_get_init(handle, SENSOR_CONFIG_SET,
|
||||||
SCMI_PROTOCOL_SENSOR, sizeof(*cfg), 0, &t);
|
SCMI_PROTOCOL_SENSOR, sizeof(*cfg), 0, &t);
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -173,7 +173,7 @@ scmi_sensor_configuration_set(const struct scmi_handle *handle, u32 sensor_id)
|
||||||
|
|
||||||
ret = scmi_do_xfer(handle, t);
|
ret = scmi_do_xfer(handle, t);
|
||||||
|
|
||||||
scmi_one_xfer_put(handle, t);
|
scmi_xfer_put(handle, t);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -185,7 +185,7 @@ static int scmi_sensor_trip_point_set(const struct scmi_handle *handle,
|
||||||
struct scmi_xfer *t;
|
struct scmi_xfer *t;
|
||||||
struct scmi_msg_set_sensor_trip_point *trip;
|
struct scmi_msg_set_sensor_trip_point *trip;
|
||||||
|
|
||||||
ret = scmi_one_xfer_init(handle, SENSOR_TRIP_POINT_SET,
|
ret = scmi_xfer_get_init(handle, SENSOR_TRIP_POINT_SET,
|
||||||
SCMI_PROTOCOL_SENSOR, sizeof(*trip), 0, &t);
|
SCMI_PROTOCOL_SENSOR, sizeof(*trip), 0, &t);
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -198,7 +198,7 @@ static int scmi_sensor_trip_point_set(const struct scmi_handle *handle,
|
||||||
|
|
||||||
ret = scmi_do_xfer(handle, t);
|
ret = scmi_do_xfer(handle, t);
|
||||||
|
|
||||||
scmi_one_xfer_put(handle, t);
|
scmi_xfer_put(handle, t);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -209,7 +209,7 @@ static int scmi_sensor_reading_get(const struct scmi_handle *handle,
|
||||||
struct scmi_xfer *t;
|
struct scmi_xfer *t;
|
||||||
struct scmi_msg_sensor_reading_get *sensor;
|
struct scmi_msg_sensor_reading_get *sensor;
|
||||||
|
|
||||||
ret = scmi_one_xfer_init(handle, SENSOR_READING_GET,
|
ret = scmi_xfer_get_init(handle, SENSOR_READING_GET,
|
||||||
SCMI_PROTOCOL_SENSOR, sizeof(*sensor),
|
SCMI_PROTOCOL_SENSOR, sizeof(*sensor),
|
||||||
sizeof(u64), &t);
|
sizeof(u64), &t);
|
||||||
if (ret)
|
if (ret)
|
||||||
|
@ -227,7 +227,7 @@ static int scmi_sensor_reading_get(const struct scmi_handle *handle,
|
||||||
*value |= (u64)le32_to_cpu(*(pval + 1)) << 32;
|
*value |= (u64)le32_to_cpu(*(pval + 1)) << 32;
|
||||||
}
|
}
|
||||||
|
|
||||||
scmi_one_xfer_put(handle, t);
|
scmi_xfer_put(handle, t);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче