This patch series serves to clean up the MHI host driver by removing an
unnecessary counter and an unused function. It also renames a function to make
it clearly worded. There is currently no user of this exported function which
makes it is safe to do so now.
Bug fixes include adding a missing EXPORT_SYMBOL_GPL to a function, and adding
a return value check to bail out of RDDM download in kernel panic path.
An outlier among the group exports the mhi_get_exec_env() API for use by
controller drivers, in case they need to determine behavior on the basis of the
current execution environment.
This set of patches was tested on arm64.
Bhaumik Bhatt (6):
bus: mhi: core: Remove unnecessary counter from mhi_firmware_copy()
bus: mhi: core: Add missing EXPORT_SYMBOL for mhi_get_mhi_state()
bus: mhi: core: Expose mhi_get_exec_env() API for controllers
bus: mhi: core: Remove unused mhi_fw_load_worker() declaration
bus: mhi: core: Rename RDDM download function to use proper words
bus: mhi: core: Skip RDDM download for unknown execution environment
drivers/bus/mhi/core/boot.c | 13 ++++++++-----
drivers/bus/mhi/core/internal.h | 1 -
drivers/bus/mhi/core/main.c | 2 ++
include/linux/mhi.h | 12 +++++++++---
4 files changed, 19 insertions(+), 9 deletions(-)
--
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project
The mhi_get_exec_env() APIs can be used by the controller drivers
to query the execution environment of the MHI device. Expose it
so it can be used in some scenarios to determine behavior of
controllers.
Signed-off-by: Bhaumik Bhatt <[email protected]>
---
drivers/bus/mhi/core/main.c | 1 +
include/linux/mhi.h | 6 ++++++
2 files changed, 7 insertions(+)
diff --git a/drivers/bus/mhi/core/main.c b/drivers/bus/mhi/core/main.c
index 778897e..7c45657 100644
--- a/drivers/bus/mhi/core/main.c
+++ b/drivers/bus/mhi/core/main.c
@@ -123,6 +123,7 @@ enum mhi_ee_type mhi_get_exec_env(struct mhi_controller *mhi_cntrl)
return (ret) ? MHI_EE_MAX : exec;
}
+EXPORT_SYMBOL_GPL(mhi_get_exec_env);
enum mhi_state mhi_get_mhi_state(struct mhi_controller *mhi_cntrl)
{
diff --git a/include/linux/mhi.h b/include/linux/mhi.h
index d4841e5..9225d55 100644
--- a/include/linux/mhi.h
+++ b/include/linux/mhi.h
@@ -659,6 +659,12 @@ int mhi_download_rddm_img(struct mhi_controller *mhi_cntrl, bool in_panic);
int mhi_force_rddm_mode(struct mhi_controller *mhi_cntrl);
/**
+ * mhi_get_exec_env - Get BHI execution environment of the device
+ * @mhi_cntrl: MHI controller
+ */
+enum mhi_ee_type mhi_get_exec_env(struct mhi_controller *mhi_cntrl);
+
+/**
* mhi_get_mhi_state - Get MHI state of the device
* @mhi_cntrl: MHI controller
*/
--
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project
The mhi_fw_load_worker() function no longer exists. Remove its
declaration as part of code clean-up.
Signed-off-by: Bhaumik Bhatt <[email protected]>
---
drivers/bus/mhi/core/internal.h | 1 -
1 file changed, 1 deletion(-)
diff --git a/drivers/bus/mhi/core/internal.h b/drivers/bus/mhi/core/internal.h
index 7989269..4f8f384 100644
--- a/drivers/bus/mhi/core/internal.h
+++ b/drivers/bus/mhi/core/internal.h
@@ -614,7 +614,6 @@ int mhi_queue_state_transition(struct mhi_controller *mhi_cntrl,
enum dev_st_transition state);
void mhi_pm_st_worker(struct work_struct *work);
void mhi_pm_sys_err_handler(struct mhi_controller *mhi_cntrl);
-void mhi_fw_load_worker(struct work_struct *work);
int mhi_ready_state_transition(struct mhi_controller *mhi_cntrl);
int mhi_pm_m0_transition(struct mhi_controller *mhi_cntrl);
void mhi_pm_m1_transition(struct mhi_controller *mhi_cntrl);
--
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project
On Thu, Nov 05, 2020 at 04:34:26PM -0800, Bhaumik Bhatt wrote:
> The mhi_get_exec_env() APIs can be used by the controller drivers
> to query the execution environment of the MHI device. Expose it
> so it can be used in some scenarios to determine behavior of
> controllers.
>
> Signed-off-by: Bhaumik Bhatt <[email protected]>
> ---
> drivers/bus/mhi/core/main.c | 1 +
> include/linux/mhi.h | 6 ++++++
> 2 files changed, 7 insertions(+)
>
> diff --git a/drivers/bus/mhi/core/main.c b/drivers/bus/mhi/core/main.c
> index 778897e..7c45657 100644
> --- a/drivers/bus/mhi/core/main.c
> +++ b/drivers/bus/mhi/core/main.c
> @@ -123,6 +123,7 @@ enum mhi_ee_type mhi_get_exec_env(struct mhi_controller *mhi_cntrl)
>
> return (ret) ? MHI_EE_MAX : exec;
> }
> +EXPORT_SYMBOL_GPL(mhi_get_exec_env);
>
> enum mhi_state mhi_get_mhi_state(struct mhi_controller *mhi_cntrl)
> {
> diff --git a/include/linux/mhi.h b/include/linux/mhi.h
> index d4841e5..9225d55 100644
> --- a/include/linux/mhi.h
> +++ b/include/linux/mhi.h
> @@ -659,6 +659,12 @@ int mhi_download_rddm_img(struct mhi_controller *mhi_cntrl, bool in_panic);
> int mhi_force_rddm_mode(struct mhi_controller *mhi_cntrl);
>
> /**
> + * mhi_get_exec_env - Get BHI execution environment of the device
> + * @mhi_cntrl: MHI controller
> + */
> +enum mhi_ee_type mhi_get_exec_env(struct mhi_controller *mhi_cntrl);
And you should remove the declaration in internal.h.
Thanks,
Mani
> +
> +/**
> * mhi_get_mhi_state - Get MHI state of the device
> * @mhi_cntrl: MHI controller
> */
> --
> The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
> a Linux Foundation Collaborative Project
>
On Thu, Nov 05, 2020 at 04:34:27PM -0800, Bhaumik Bhatt wrote:
> The mhi_fw_load_worker() function no longer exists. Remove its
> declaration as part of code clean-up.
>
> Signed-off-by: Bhaumik Bhatt <[email protected]>
Reviewed-by: Manivannan Sadhasivam <[email protected]>
Thanks,
Mani
> ---
> drivers/bus/mhi/core/internal.h | 1 -
> 1 file changed, 1 deletion(-)
>
> diff --git a/drivers/bus/mhi/core/internal.h b/drivers/bus/mhi/core/internal.h
> index 7989269..4f8f384 100644
> --- a/drivers/bus/mhi/core/internal.h
> +++ b/drivers/bus/mhi/core/internal.h
> @@ -614,7 +614,6 @@ int mhi_queue_state_transition(struct mhi_controller *mhi_cntrl,
> enum dev_st_transition state);
> void mhi_pm_st_worker(struct work_struct *work);
> void mhi_pm_sys_err_handler(struct mhi_controller *mhi_cntrl);
> -void mhi_fw_load_worker(struct work_struct *work);
> int mhi_ready_state_transition(struct mhi_controller *mhi_cntrl);
> int mhi_pm_m0_transition(struct mhi_controller *mhi_cntrl);
> void mhi_pm_m1_transition(struct mhi_controller *mhi_cntrl);
> --
> The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
> a Linux Foundation Collaborative Project
>