summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephan Gerhold <stephan@gerhold.net>2023-06-15 18:50:40 +0200
committerBjorn Andersson <andersson@kernel.org>2023-07-14 07:18:56 +0200
commit4dbb9e2322a3a9c912ce796c20c27045ae8dae22 (patch)
tree033d5b7ee8203c7662f6c5bb8e2dcf2e943b5830
parentdt-bindings: remoteproc: Add Qualcomm RPM processor/subsystem (diff)
downloadlinux-4dbb9e2322a3a9c912ce796c20c27045ae8dae22.tar.xz
linux-4dbb9e2322a3a9c912ce796c20c27045ae8dae22.zip
soc: qcom: smem: Add qcom_smem_is_available()
Avoid having to look up a dummy item from SMEM to detect if it is already available or if we need to defer probing. Reviewed-by: Konrad Dybcio <konrad.dybcio@linaro.org> Signed-off-by: Stephan Gerhold <stephan@gerhold.net> Link: https://lore.kernel.org/r/20230531-rpm-rproc-v3-7-a07dcdefd918@gerhold.net Signed-off-by: Bjorn Andersson <andersson@kernel.org>
-rw-r--r--drivers/soc/qcom/smem.c11
-rw-r--r--include/linux/soc/qcom/smem.h1
2 files changed, 12 insertions, 0 deletions
diff --git a/drivers/soc/qcom/smem.c b/drivers/soc/qcom/smem.c
index 776096b2e965..aa4a199efefb 100644
--- a/drivers/soc/qcom/smem.c
+++ b/drivers/soc/qcom/smem.c
@@ -359,6 +359,17 @@ static struct qcom_smem *__smem;
/* Timeout (ms) for the trylock of remote spinlocks */
#define HWSPINLOCK_TIMEOUT 1000
+/**
+ * qcom_smem_is_available() - Check if SMEM is available
+ *
+ * Return: true if SMEM is available, false otherwise.
+ */
+bool qcom_smem_is_available(void)
+{
+ return !!__smem;
+}
+EXPORT_SYMBOL(qcom_smem_is_available);
+
static int qcom_smem_alloc_private(struct qcom_smem *smem,
struct smem_partition *part,
unsigned item,
diff --git a/include/linux/soc/qcom/smem.h b/include/linux/soc/qcom/smem.h
index 223db6a9c733..a36a3b9d4929 100644
--- a/include/linux/soc/qcom/smem.h
+++ b/include/linux/soc/qcom/smem.h
@@ -4,6 +4,7 @@
#define QCOM_SMEM_HOST_ANY -1
+bool qcom_smem_is_available(void);
int qcom_smem_alloc(unsigned host, unsigned item, size_t size);
void *qcom_smem_get(unsigned host, unsigned item, size_t *size);