summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorSujeev Dias <sdias@codeaurora.org>2017-05-26 12:26:46 -0700
committerSujeev Dias <sdias@codeaurora.org>2017-05-31 14:07:14 -0700
commitfb7523d08fa68f75aa15d509967598d2c95b4631 (patch)
tree8cdc8f0684af7f724c22c29a16d866160471165b /include
parenta2ab1656072a29a6a0f6e885b503fa51fd68e4e1 (diff)
mhi: core: Create dummy MHI APIs to fix compile errors
MHI is not supported by all targets, however many MHI client drivers have a common driver that include MHI APIs. Create dummy APIs such that even if MHI not present, does not cause any compile errors. CRs-Fixed: 2053159 Change-Id: I427d925a658518d230a1d14df0cf27a7b19f207e Signed-off-by: Sujeev Dias <sdias@codeaurora.org>
Diffstat (limited to 'include')
-rw-r--r--include/linux/msm_mhi.h137
1 files changed, 116 insertions, 21 deletions
diff --git a/include/linux/msm_mhi.h b/include/linux/msm_mhi.h
index c01cb1af4231..e655f7397527 100644
--- a/include/linux/msm_mhi.h
+++ b/include/linux/msm_mhi.h
@@ -168,6 +168,7 @@ enum mhi_rddm_segment {
MHI_RDDM_RD_SEGMENT,
};
+#if defined(CONFIG_MSM_MHI)
/**
* mhi_is_device_ready - Check if MHI is ready to register clients
*
@@ -187,11 +188,23 @@ bool mhi_is_device_ready(const struct device * const dev,
* @userdata: cb data for client
* @Return 0 on success
*/
-int mhi_register_device(struct mhi_device *mhi_device,
- const char *node_name,
+int mhi_register_device(struct mhi_device *mhi_device, const char *node_name,
void *user_data);
/**
+ * mhi_register_channel - Client must call this function to obtain a handle for
+ * any MHI operations
+ *
+ * @client_handle: Handle populated by MHI, opaque to client
+ * @client_info: Channel\device information provided by client to
+ * which the handle maps to.
+ *
+ * @Return errno
+ */
+int mhi_register_channel(struct mhi_client_handle **client_handle,
+ struct mhi_client_info_t *client_info);
+
+/**
* mhi_pm_control_device - power management control api
* @mhi_device: registered device structure
* @ctrl: specific command
@@ -219,19 +232,6 @@ int mhi_xfer_rddm(struct mhi_device *mhi_device, enum mhi_rddm_segment seg,
int mhi_deregister_channel(struct mhi_client_handle *client_handle);
/**
- * mhi_register_channel - Client must call this function to obtain a handle for
- * any MHI operations
- *
- * @client_handle: Handle populated by MHI, opaque to client
- * @client_info: Channel\device information provided by client to
- * which the handle maps to.
- *
- * @Return errno
- */
-int mhi_register_channel(struct mhi_client_handle **client_handle,
- struct mhi_client_info_t *client_info);
-
-/**
* mhi_open_channel - Client must call this function to open a channel
*
* @client_handle: Handle populated by MHI, opaque to client
@@ -258,8 +258,8 @@ int mhi_open_channel(struct mhi_client_handle *client_handle);
*
* @Return errno
*/
-int mhi_queue_xfer(struct mhi_client_handle *client_handle,
- void *buf, size_t buf_len, enum MHI_FLAGS mhi_flags);
+int mhi_queue_xfer(struct mhi_client_handle *client_handle, void *buf,
+ size_t buf_len, enum MHI_FLAGS mhi_flags);
/**
* mhi_close_channel - Client can request channel to be closed and handle freed
@@ -300,7 +300,7 @@ int mhi_get_free_desc(struct mhi_client_handle *client_handle);
* @Return non negative on success
*/
int mhi_poll_inbound(struct mhi_client_handle *client_handle,
- struct mhi_result *result);
+ struct mhi_result *result);
/**
* mhi_get_max_desc - Get the maximum number of descriptors
@@ -311,12 +311,107 @@ int mhi_poll_inbound(struct mhi_client_handle *client_handle,
*/
int mhi_get_max_desc(struct mhi_client_handle *client_handle);
-/* RmNET Reserved APIs, This APIs are reserved for use by the linux network
-* stack only. Use by other clients will introduce system wide issues
-*/
+/* following APIs meant to be used by rmnet interface only */
int mhi_set_lpm(struct mhi_client_handle *client_handle, bool enable_lpm);
int mhi_get_epid(struct mhi_client_handle *mhi_handle);
struct mhi_result *mhi_poll(struct mhi_client_handle *client_handle);
void mhi_mask_irq(struct mhi_client_handle *client_handle);
void mhi_unmask_irq(struct mhi_client_handle *client_handle);
+
+#else
+static inline bool mhi_is_device_ready(const struct device * const dev,
+ const char *node_name)
+{
+ return false;
+};
+
+static inline int mhi_register_device(struct mhi_device *mhi_device,
+ const char *node_name, void *user_data)
+{
+ return -EINVAL;
+};
+
+static inline int mhi_register_channel(struct mhi_client_handle **client_handle,
+ struct mhi_client_info_t *client_info)
+{
+ return -EINVAL;
+};
+
+static inline int mhi_pm_control_device(struct mhi_device *mhi_device,
+ enum mhi_dev_ctrl ctrl)
+{
+ return -EINVAL;
+};
+
+static inline int mhi_xfer_rddm(struct mhi_device *mhi_device,
+ enum mhi_rddm_segment seg,
+ struct scatterlist **sg_list)
+{
+ return -EINVAL;
+};
+
+static inline int mhi_deregister_channel(struct mhi_client_handle
+ *client_handle)
+{
+ return -EINVAL;
+};
+
+static inline int mhi_open_channel(struct mhi_client_handle *client_handle)
+{
+ return -EINVAL;
+};
+
+static inline int mhi_queue_xfer(struct mhi_client_handle *client_handle,
+ void *buf, size_t buf_len,
+ enum MHI_FLAGS mhi_flags)
+{
+ return -EINVAL;
+};
+
+static inline void mhi_close_channel(struct mhi_client_handle *client_handle)
+{
+};
+
+static inline int mhi_get_free_desc(struct mhi_client_handle *client_handle)
+{
+ return -EINVAL;
+};
+
+static inline int mhi_poll_inbound(struct mhi_client_handle *client_handle,
+ struct mhi_result *result)
+{
+ return -EINVAL;
+};
+
+static inline int mhi_get_max_desc(struct mhi_client_handle *client_handle)
+{
+ return -EINVAL;
+};
+
+static inline int mhi_set_lpm(struct mhi_client_handle *client_handle,
+ bool enable_lpm)
+{
+ return -EINVAL;
+};
+
+static inline int mhi_get_epid(struct mhi_client_handle *mhi_handle)
+{
+ return -EINVAL;
+};
+
+static inline struct mhi_result *mhi_poll(struct mhi_client_handle
+ *client_handle)
+{
+ return NULL;
+};
+
+static inline void mhi_mask_irq(struct mhi_client_handle *client_handle)
+{
+};
+
+static inline void mhi_unmask_irq(struct mhi_client_handle *client_handle)
+{
+};
+
+#endif
#endif