diff mbox series

[net-next,2/3] soc: qcom: mdt_loader: define stubs for COMPILE_TEST

Message ID 20210106023812.2542-3-elder@linaro.org (mailing list archive)
State Superseded
Headers show
Series net: ipa: support COMPILE_TEST | expand

Commit Message

Alex Elder Jan. 6, 2021, 2:38 a.m. UTC
Define stub functions for the exposed MDT functions in case
QCOM_MDT_LOADER is not configured.  This allows users of these
functions to link correctly for COMPILE_TEST builds without
QCOM_SCM enabled.

Signed-off-by: Alex Elder <elder@linaro.org>
---
 include/linux/soc/qcom/mdt_loader.h | 35 +++++++++++++++++++++++++++++
 1 file changed, 35 insertions(+)

Comments

Bjorn Andersson Jan. 6, 2021, 6:47 p.m. UTC | #1
On Tue 05 Jan 20:38 CST 2021, Alex Elder wrote:

> Define stub functions for the exposed MDT functions in case
> QCOM_MDT_LOADER is not configured.  This allows users of these
> functions to link correctly for COMPILE_TEST builds without
> QCOM_SCM enabled.
> 

Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>

@Jakub, @Dave, as with patch 1, please take this through your tree as
well.

Regards,
Bjorn

> Signed-off-by: Alex Elder <elder@linaro.org>
> ---
>  include/linux/soc/qcom/mdt_loader.h | 35 +++++++++++++++++++++++++++++
>  1 file changed, 35 insertions(+)
> 
> diff --git a/include/linux/soc/qcom/mdt_loader.h b/include/linux/soc/qcom/mdt_loader.h
> index e600baec68253..afd47217996b0 100644
> --- a/include/linux/soc/qcom/mdt_loader.h
> +++ b/include/linux/soc/qcom/mdt_loader.h
> @@ -11,6 +11,8 @@
>  struct device;
>  struct firmware;
>  
> +#if IS_ENABLED(CONFIG_QCOM_MDT_LOADER)
> +
>  ssize_t qcom_mdt_get_size(const struct firmware *fw);
>  int qcom_mdt_load(struct device *dev, const struct firmware *fw,
>  		  const char *fw_name, int pas_id, void *mem_region,
> @@ -23,4 +25,37 @@ int qcom_mdt_load_no_init(struct device *dev, const struct firmware *fw,
>  			  phys_addr_t *reloc_base);
>  void *qcom_mdt_read_metadata(const struct firmware *fw, size_t *data_len);
>  
> +#else /* !IS_ENABLED(CONFIG_QCOM_MDT_LOADER) */
> +
> +static inline ssize_t qcom_mdt_get_size(const struct firmware *fw)
> +{
> +	return -ENODEV;
> +}
> +
> +static inline int qcom_mdt_load(struct device *dev, const struct firmware *fw,
> +				const char *fw_name, int pas_id,
> +				void *mem_region, phys_addr_t mem_phys,
> +				size_t mem_size, phys_addr_t *reloc_base)
> +{
> +	return -ENODEV;
> +}
> +
> +static inline int qcom_mdt_load_no_init(struct device *dev,
> +					const struct firmware *fw,
> +					const char *fw_name, int pas_id,
> +					void *mem_region, phys_addr_t mem_phys,
> +					size_t mem_size,
> +					phys_addr_t *reloc_base)
> +{
> +	return -ENODEV;
> +}
> +
> +static inline void *qcom_mdt_read_metadata(const struct firmware *fw,
> +					   size_t *data_len)
> +{
> +	return ERR_PTR(-ENODEV);
> +}
> +
> +#endif /* !IS_ENABLED(CONFIG_QCOM_MDT_LOADER) */
> +
>  #endif
> -- 
> 2.20.1
>
diff mbox series

Patch

diff --git a/include/linux/soc/qcom/mdt_loader.h b/include/linux/soc/qcom/mdt_loader.h
index e600baec68253..afd47217996b0 100644
--- a/include/linux/soc/qcom/mdt_loader.h
+++ b/include/linux/soc/qcom/mdt_loader.h
@@ -11,6 +11,8 @@ 
 struct device;
 struct firmware;
 
+#if IS_ENABLED(CONFIG_QCOM_MDT_LOADER)
+
 ssize_t qcom_mdt_get_size(const struct firmware *fw);
 int qcom_mdt_load(struct device *dev, const struct firmware *fw,
 		  const char *fw_name, int pas_id, void *mem_region,
@@ -23,4 +25,37 @@  int qcom_mdt_load_no_init(struct device *dev, const struct firmware *fw,
 			  phys_addr_t *reloc_base);
 void *qcom_mdt_read_metadata(const struct firmware *fw, size_t *data_len);
 
+#else /* !IS_ENABLED(CONFIG_QCOM_MDT_LOADER) */
+
+static inline ssize_t qcom_mdt_get_size(const struct firmware *fw)
+{
+	return -ENODEV;
+}
+
+static inline int qcom_mdt_load(struct device *dev, const struct firmware *fw,
+				const char *fw_name, int pas_id,
+				void *mem_region, phys_addr_t mem_phys,
+				size_t mem_size, phys_addr_t *reloc_base)
+{
+	return -ENODEV;
+}
+
+static inline int qcom_mdt_load_no_init(struct device *dev,
+					const struct firmware *fw,
+					const char *fw_name, int pas_id,
+					void *mem_region, phys_addr_t mem_phys,
+					size_t mem_size,
+					phys_addr_t *reloc_base)
+{
+	return -ENODEV;
+}
+
+static inline void *qcom_mdt_read_metadata(const struct firmware *fw,
+					   size_t *data_len)
+{
+	return ERR_PTR(-ENODEV);
+}
+
+#endif /* !IS_ENABLED(CONFIG_QCOM_MDT_LOADER) */
+
 #endif