aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLoic Poulain <loic.poulain@linaro.org>2020-11-24 09:28:29 +0100
committerLoic Poulain <loic.poulain@linaro.org>2020-12-14 15:14:09 +0100
commitf53df5bfe28c0f9213d246102d8f3858b1c1fc08 (patch)
tree1f90a7d3a62c2194d125e7533d2b118c1b5fbfbf
parent8fdf7e6eab1d2ad6da3e5dae6057da562b03d948 (diff)
mhi: Add mhi_controller_initialize helper
This function allows to initialize a mhi_controller structure. Today, it only zeroing the structure. Use this function from mhi_alloc_controller so that any further initialization can be factorized in initalize function. Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
-rw-r--r--drivers/bus/mhi/core/init.c6
-rw-r--r--include/linux/mhi.h6
2 files changed, 12 insertions, 0 deletions
diff --git a/drivers/bus/mhi/core/init.c b/drivers/bus/mhi/core/init.c
index 96cde9c0034c..a75ab8c38dd3 100644
--- a/drivers/bus/mhi/core/init.c
+++ b/drivers/bus/mhi/core/init.c
@@ -1021,6 +1021,12 @@ void mhi_unregister_controller(struct mhi_controller *mhi_cntrl)
}
EXPORT_SYMBOL_GPL(mhi_unregister_controller);
+void mhi_initialize_controller(struct mhi_controller *mhi_cntrl)
+{
+ memset(mhi_cntrl, 0, sizeof(*mhi_cntrl));
+}
+EXPORT_SYMBOL_GPL(mhi_initialize_controller);
+
struct mhi_controller *mhi_alloc_controller(void)
{
struct mhi_controller *mhi_cntrl;
diff --git a/include/linux/mhi.h b/include/linux/mhi.h
index 04cf7f3f3dfc..275474205fa5 100644
--- a/include/linux/mhi.h
+++ b/include/linux/mhi.h
@@ -537,6 +537,12 @@ struct mhi_driver {
#define to_mhi_device(dev) container_of(dev, struct mhi_device, dev)
/**
+ * mhi_initialize_controller - Initialize MHI Controller structure
+ * @mhi_cntrl: MHI controller structure to initialize
+ */
+void mhi_initialize_controller(struct mhi_controller *mhi_cntrl);
+
+/**
* mhi_alloc_controller - Allocate the MHI Controller structure
* Allocate the mhi_controller structure using zero initialized memory
*/