aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Elder <elder@linaro.org>2018-06-25 20:58:56 -0400
committerAndy Gross <andy.gross@linaro.org>2018-09-13 17:57:11 -0400
commit13a920ae7898ffa075391ba36b63251f686d38a3 (patch)
tree2144c7661e3ace4b315f0c2d6f28c9ce532694db
parent7d01934455e3f5efc0019befe1b78ebe60dd7b0c (diff)
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>
-rw-r--r--drivers/soc/qcom/smem.c15
1 files changed, 6 insertions, 9 deletions
diff --git a/drivers/soc/qcom/smem.c b/drivers/soc/qcom/smem.c
index 14c8b34f6d56..f80d040601fd 100644
--- a/drivers/soc/qcom/smem.c
+++ b/drivers/soc/qcom/smem.c
@@ -820,14 +820,14 @@ static int qcom_smem_set_global_partition(struct qcom_smem *smem)
820 return 0; 820 return 0;
821} 821}
822 822
823static int qcom_smem_enumerate_partitions(struct qcom_smem *smem, 823static int
824 unsigned int local_host) 824qcom_smem_enumerate_partitions(struct qcom_smem *smem, u16 local_host)
825{ 825{
826 struct smem_partition_header *header; 826 struct smem_partition_header *header;
827 struct smem_ptable_entry *entry; 827 struct smem_ptable_entry *entry;
828 struct smem_ptable *ptable; 828 struct smem_ptable *ptable;
829 unsigned int remote_host; 829 unsigned int remote_host;
830 u32 host0, host1; 830 u16 host0, host1;
831 int i; 831 int i;
832 832
833 ptable = qcom_smem_get_ptable(smem); 833 ptable = qcom_smem_get_ptable(smem);
@@ -851,16 +851,12 @@ static int qcom_smem_enumerate_partitions(struct qcom_smem *smem,
851 continue; 851 continue;
852 852
853 if (remote_host >= SMEM_HOST_COUNT) { 853 if (remote_host >= SMEM_HOST_COUNT) {
854 dev_err(smem->dev, 854 dev_err(smem->dev, "bad host %hu\n", remote_host);
855 "Invalid remote host %d\n",
856 remote_host);
857 return -EINVAL; 855 return -EINVAL;
858 } 856 }
859 857
860 if (smem->partitions[remote_host]) { 858 if (smem->partitions[remote_host]) {
861 dev_err(smem->dev, 859 dev_err(smem->dev, "duplicate host %hu\n", remote_host);
862 "Already found a partition for host %d\n",
863 remote_host);
864 return -EINVAL; 860 return -EINVAL;
865 } 861 }
866 862
@@ -957,6 +953,7 @@ static int qcom_smem_probe(struct platform_device *pdev)
957 return -EINVAL; 953 return -EINVAL;
958 } 954 }
959 955
956 BUILD_BUG_ON(SMEM_HOST_APPS >= SMEM_HOST_COUNT);
960 ret = qcom_smem_enumerate_partitions(smem, SMEM_HOST_APPS); 957 ret = qcom_smem_enumerate_partitions(smem, SMEM_HOST_APPS);
961 if (ret < 0 && ret != -ENOENT) 958 if (ret < 0 && ret != -ENOENT)
962 return ret; 959 return ret;