soc: qcom: smem: a few last cleanups
This patch contains several small cleanups: - In qcom_smem_enumerate_partitions(), change the "local_host" argument to have 16 bit unsigned type - Also in qcom_smem_enumerate_partitions(), change the type of the "host0" and "host1" local variables to be u16 - Fix error messages reporting host ids to use the right format specifier - Shorten the error messages as well, to fit on one line - Add a compile-time check to ensure the local host value passed to qcom_smem_enumerate_partitions() is in range Signed-off-by: Alex Elder <elder@linaro.org> Signed-off-by: Andy Gross <andy.gross@linaro.org>
This commit is contained in:
parent
7d01934455
commit
13a920ae78
@ -820,14 +820,14 @@ static int qcom_smem_set_global_partition(struct qcom_smem *smem)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int qcom_smem_enumerate_partitions(struct qcom_smem *smem,
|
static int
|
||||||
unsigned int local_host)
|
qcom_smem_enumerate_partitions(struct qcom_smem *smem, u16 local_host)
|
||||||
{
|
{
|
||||||
struct smem_partition_header *header;
|
struct smem_partition_header *header;
|
||||||
struct smem_ptable_entry *entry;
|
struct smem_ptable_entry *entry;
|
||||||
struct smem_ptable *ptable;
|
struct smem_ptable *ptable;
|
||||||
unsigned int remote_host;
|
unsigned int remote_host;
|
||||||
u32 host0, host1;
|
u16 host0, host1;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
ptable = qcom_smem_get_ptable(smem);
|
ptable = qcom_smem_get_ptable(smem);
|
||||||
@ -851,16 +851,12 @@ static int qcom_smem_enumerate_partitions(struct qcom_smem *smem,
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (remote_host >= SMEM_HOST_COUNT) {
|
if (remote_host >= SMEM_HOST_COUNT) {
|
||||||
dev_err(smem->dev,
|
dev_err(smem->dev, "bad host %hu\n", remote_host);
|
||||||
"Invalid remote host %d\n",
|
|
||||||
remote_host);
|
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (smem->partitions[remote_host]) {
|
if (smem->partitions[remote_host]) {
|
||||||
dev_err(smem->dev,
|
dev_err(smem->dev, "duplicate host %hu\n", remote_host);
|
||||||
"Already found a partition for host %d\n",
|
|
||||||
remote_host);
|
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -957,6 +953,7 @@ static int qcom_smem_probe(struct platform_device *pdev)
|
|||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BUILD_BUG_ON(SMEM_HOST_APPS >= SMEM_HOST_COUNT);
|
||||||
ret = qcom_smem_enumerate_partitions(smem, SMEM_HOST_APPS);
|
ret = qcom_smem_enumerate_partitions(smem, SMEM_HOST_APPS);
|
||||||
if (ret < 0 && ret != -ENOENT)
|
if (ret < 0 && ret != -ENOENT)
|
||||||
return ret;
|
return ret;
|
||||||
|
Loading…
Reference in New Issue
Block a user