All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1] bus: mhi: core: Add const qualifier to MHI config information
       [not found] <1599812017-32680-1-git-send-email-hemantk@codeaurora.org>
@ 2020-09-11  8:13 ` Hemant Kumar
  2020-09-15  8:19   ` Manivannan Sadhasivam
  2020-09-15  8:20   ` Manivannan Sadhasivam
  0 siblings, 2 replies; 3+ messages in thread
From: Hemant Kumar @ 2020-09-11  8:13 UTC (permalink / raw)
  To: manivannan.sadhasivam
  Cc: linux-arm-msm, linux-kernel, jhugo, bbhatt, Hemant Kumar

MHI channel, event and controller config data needs to be
treated read only information. Add const qualifier to make
sure config information passed by MHI controller is not
modified by MHI core driver.

Suggested-by: Kalle Valo <kvalo@codeaurora.org>
Signed-off-by: Hemant Kumar <hemantk@codeaurora.org>
---
 drivers/bus/mhi/core/init.c | 12 ++++++------
 include/linux/mhi.h         |  6 +++---
 2 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/drivers/bus/mhi/core/init.c b/drivers/bus/mhi/core/init.c
index f69a2f3..d232938 100644
--- a/drivers/bus/mhi/core/init.c
+++ b/drivers/bus/mhi/core/init.c
@@ -562,10 +562,10 @@ int mhi_init_chan_ctxt(struct mhi_controller *mhi_cntrl,
 }
 
 static int parse_ev_cfg(struct mhi_controller *mhi_cntrl,
-			struct mhi_controller_config *config)
+			const struct mhi_controller_config *config)
 {
 	struct mhi_event *mhi_event;
-	struct mhi_event_config *event_cfg;
+	const struct mhi_event_config *event_cfg;
 	struct device *dev = &mhi_cntrl->mhi_dev->dev;
 	int i, num;
 
@@ -648,9 +648,9 @@ static int parse_ev_cfg(struct mhi_controller *mhi_cntrl,
 }
 
 static int parse_ch_cfg(struct mhi_controller *mhi_cntrl,
-			struct mhi_controller_config *config)
+			const struct mhi_controller_config *config)
 {
-	struct mhi_channel_config *ch_cfg;
+	const struct mhi_channel_config *ch_cfg;
 	struct device *dev = &mhi_cntrl->mhi_dev->dev;
 	int i;
 	u32 chan;
@@ -766,7 +766,7 @@ static int parse_ch_cfg(struct mhi_controller *mhi_cntrl,
 }
 
 static int parse_config(struct mhi_controller *mhi_cntrl,
-			struct mhi_controller_config *config)
+			const struct mhi_controller_config *config)
 {
 	int ret;
 
@@ -803,7 +803,7 @@ static int parse_config(struct mhi_controller *mhi_cntrl,
 }
 
 int mhi_register_controller(struct mhi_controller *mhi_cntrl,
-			    struct mhi_controller_config *config)
+			    const struct mhi_controller_config *config)
 {
 	struct mhi_event *mhi_event;
 	struct mhi_chan *mhi_chan;
diff --git a/include/linux/mhi.h b/include/linux/mhi.h
index 6b987e8..b2c0214 100644
--- a/include/linux/mhi.h
+++ b/include/linux/mhi.h
@@ -280,9 +280,9 @@ struct mhi_controller_config {
 	u32 timeout_ms;
 	u32 buf_len;
 	u32 num_channels;
-	struct mhi_channel_config *ch_cfg;
+	const struct mhi_channel_config *ch_cfg;
 	u32 num_events;
-	struct mhi_event_config *event_cfg;
+	const struct mhi_event_config *event_cfg;
 	bool use_bounce_buf;
 	bool m2_no_db;
 };
@@ -545,7 +545,7 @@ struct mhi_driver {
  * @config: Configuration to use for the controller
  */
 int mhi_register_controller(struct mhi_controller *mhi_cntrl,
-			    struct mhi_controller_config *config);
+			const struct mhi_controller_config *config);
 
 /**
  * mhi_unregister_controller - Unregister MHI controller
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v1] bus: mhi: core: Add const qualifier to MHI config information
  2020-09-11  8:13 ` [PATCH v1] bus: mhi: core: Add const qualifier to MHI config information Hemant Kumar
@ 2020-09-15  8:19   ` Manivannan Sadhasivam
  2020-09-15  8:20   ` Manivannan Sadhasivam
  1 sibling, 0 replies; 3+ messages in thread
From: Manivannan Sadhasivam @ 2020-09-15  8:19 UTC (permalink / raw)
  To: Hemant Kumar; +Cc: linux-arm-msm, linux-kernel, jhugo, bbhatt

On Fri, Sep 11, 2020 at 08:13:58AM +0000, Hemant Kumar wrote:
> MHI channel, event and controller config data needs to be
> treated read only information. Add const qualifier to make
> sure config information passed by MHI controller is not
> modified by MHI core driver.
> 
> Suggested-by: Kalle Valo <kvalo@codeaurora.org>
> Signed-off-by: Hemant Kumar <hemantk@codeaurora.org>

Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>

Thanks,
Mani

> ---
>  drivers/bus/mhi/core/init.c | 12 ++++++------
>  include/linux/mhi.h         |  6 +++---
>  2 files changed, 9 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/bus/mhi/core/init.c b/drivers/bus/mhi/core/init.c
> index f69a2f3..d232938 100644
> --- a/drivers/bus/mhi/core/init.c
> +++ b/drivers/bus/mhi/core/init.c
> @@ -562,10 +562,10 @@ int mhi_init_chan_ctxt(struct mhi_controller *mhi_cntrl,
>  }
>  
>  static int parse_ev_cfg(struct mhi_controller *mhi_cntrl,
> -			struct mhi_controller_config *config)
> +			const struct mhi_controller_config *config)
>  {
>  	struct mhi_event *mhi_event;
> -	struct mhi_event_config *event_cfg;
> +	const struct mhi_event_config *event_cfg;
>  	struct device *dev = &mhi_cntrl->mhi_dev->dev;
>  	int i, num;
>  
> @@ -648,9 +648,9 @@ static int parse_ev_cfg(struct mhi_controller *mhi_cntrl,
>  }
>  
>  static int parse_ch_cfg(struct mhi_controller *mhi_cntrl,
> -			struct mhi_controller_config *config)
> +			const struct mhi_controller_config *config)
>  {
> -	struct mhi_channel_config *ch_cfg;
> +	const struct mhi_channel_config *ch_cfg;
>  	struct device *dev = &mhi_cntrl->mhi_dev->dev;
>  	int i;
>  	u32 chan;
> @@ -766,7 +766,7 @@ static int parse_ch_cfg(struct mhi_controller *mhi_cntrl,
>  }
>  
>  static int parse_config(struct mhi_controller *mhi_cntrl,
> -			struct mhi_controller_config *config)
> +			const struct mhi_controller_config *config)
>  {
>  	int ret;
>  
> @@ -803,7 +803,7 @@ static int parse_config(struct mhi_controller *mhi_cntrl,
>  }
>  
>  int mhi_register_controller(struct mhi_controller *mhi_cntrl,
> -			    struct mhi_controller_config *config)
> +			    const struct mhi_controller_config *config)
>  {
>  	struct mhi_event *mhi_event;
>  	struct mhi_chan *mhi_chan;
> diff --git a/include/linux/mhi.h b/include/linux/mhi.h
> index 6b987e8..b2c0214 100644
> --- a/include/linux/mhi.h
> +++ b/include/linux/mhi.h
> @@ -280,9 +280,9 @@ struct mhi_controller_config {
>  	u32 timeout_ms;
>  	u32 buf_len;
>  	u32 num_channels;
> -	struct mhi_channel_config *ch_cfg;
> +	const struct mhi_channel_config *ch_cfg;
>  	u32 num_events;
> -	struct mhi_event_config *event_cfg;
> +	const struct mhi_event_config *event_cfg;
>  	bool use_bounce_buf;
>  	bool m2_no_db;
>  };
> @@ -545,7 +545,7 @@ struct mhi_driver {
>   * @config: Configuration to use for the controller
>   */
>  int mhi_register_controller(struct mhi_controller *mhi_cntrl,
> -			    struct mhi_controller_config *config);
> +			const struct mhi_controller_config *config);
>  
>  /**
>   * mhi_unregister_controller - Unregister MHI controller
> -- 
> The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
> a Linux Foundation Collaborative Project
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v1] bus: mhi: core: Add const qualifier to MHI config information
  2020-09-11  8:13 ` [PATCH v1] bus: mhi: core: Add const qualifier to MHI config information Hemant Kumar
  2020-09-15  8:19   ` Manivannan Sadhasivam
@ 2020-09-15  8:20   ` Manivannan Sadhasivam
  1 sibling, 0 replies; 3+ messages in thread
From: Manivannan Sadhasivam @ 2020-09-15  8:20 UTC (permalink / raw)
  To: Hemant Kumar; +Cc: linux-arm-msm, linux-kernel, jhugo, bbhatt

On Fri, Sep 11, 2020 at 08:13:58AM +0000, Hemant Kumar wrote:
> MHI channel, event and controller config data needs to be
> treated read only information. Add const qualifier to make
> sure config information passed by MHI controller is not
> modified by MHI core driver.
> 
> Suggested-by: Kalle Valo <kvalo@codeaurora.org>
> Signed-off-by: Hemant Kumar <hemantk@codeaurora.org>

Applied to mhi-next!

Thanks,
Mani

> ---
>  drivers/bus/mhi/core/init.c | 12 ++++++------
>  include/linux/mhi.h         |  6 +++---
>  2 files changed, 9 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/bus/mhi/core/init.c b/drivers/bus/mhi/core/init.c
> index f69a2f3..d232938 100644
> --- a/drivers/bus/mhi/core/init.c
> +++ b/drivers/bus/mhi/core/init.c
> @@ -562,10 +562,10 @@ int mhi_init_chan_ctxt(struct mhi_controller *mhi_cntrl,
>  }
>  
>  static int parse_ev_cfg(struct mhi_controller *mhi_cntrl,
> -			struct mhi_controller_config *config)
> +			const struct mhi_controller_config *config)
>  {
>  	struct mhi_event *mhi_event;
> -	struct mhi_event_config *event_cfg;
> +	const struct mhi_event_config *event_cfg;
>  	struct device *dev = &mhi_cntrl->mhi_dev->dev;
>  	int i, num;
>  
> @@ -648,9 +648,9 @@ static int parse_ev_cfg(struct mhi_controller *mhi_cntrl,
>  }
>  
>  static int parse_ch_cfg(struct mhi_controller *mhi_cntrl,
> -			struct mhi_controller_config *config)
> +			const struct mhi_controller_config *config)
>  {
> -	struct mhi_channel_config *ch_cfg;
> +	const struct mhi_channel_config *ch_cfg;
>  	struct device *dev = &mhi_cntrl->mhi_dev->dev;
>  	int i;
>  	u32 chan;
> @@ -766,7 +766,7 @@ static int parse_ch_cfg(struct mhi_controller *mhi_cntrl,
>  }
>  
>  static int parse_config(struct mhi_controller *mhi_cntrl,
> -			struct mhi_controller_config *config)
> +			const struct mhi_controller_config *config)
>  {
>  	int ret;
>  
> @@ -803,7 +803,7 @@ static int parse_config(struct mhi_controller *mhi_cntrl,
>  }
>  
>  int mhi_register_controller(struct mhi_controller *mhi_cntrl,
> -			    struct mhi_controller_config *config)
> +			    const struct mhi_controller_config *config)
>  {
>  	struct mhi_event *mhi_event;
>  	struct mhi_chan *mhi_chan;
> diff --git a/include/linux/mhi.h b/include/linux/mhi.h
> index 6b987e8..b2c0214 100644
> --- a/include/linux/mhi.h
> +++ b/include/linux/mhi.h
> @@ -280,9 +280,9 @@ struct mhi_controller_config {
>  	u32 timeout_ms;
>  	u32 buf_len;
>  	u32 num_channels;
> -	struct mhi_channel_config *ch_cfg;
> +	const struct mhi_channel_config *ch_cfg;
>  	u32 num_events;
> -	struct mhi_event_config *event_cfg;
> +	const struct mhi_event_config *event_cfg;
>  	bool use_bounce_buf;
>  	bool m2_no_db;
>  };
> @@ -545,7 +545,7 @@ struct mhi_driver {
>   * @config: Configuration to use for the controller
>   */
>  int mhi_register_controller(struct mhi_controller *mhi_cntrl,
> -			    struct mhi_controller_config *config);
> +			const struct mhi_controller_config *config);
>  
>  /**
>   * mhi_unregister_controller - Unregister MHI controller
> -- 
> The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
> a Linux Foundation Collaborative Project
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-09-15  8:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <1599812017-32680-1-git-send-email-hemantk@codeaurora.org>
2020-09-11  8:13 ` [PATCH v1] bus: mhi: core: Add const qualifier to MHI config information Hemant Kumar
2020-09-15  8:19   ` Manivannan Sadhasivam
2020-09-15  8:20   ` Manivannan Sadhasivam

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.