mhi.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
* [PATCH v3] bus: mhi: make mhi_controller_config::event_cfg const
@ 2022-08-19 21:02 Jeff Johnson
  2022-08-19 21:08 ` Jeffrey Hugo
                   ` (2 more replies)
  0 siblings, 3 replies; 16+ messages in thread
From: Jeff Johnson @ 2022-08-19 21:02 UTC (permalink / raw)
  To: Manivannan Sadhasivam, Hemant Kumar; +Cc: linux-arm-msm, mhi, Jeff Johnson

Currently the event_cfg pointer in struct mhi_controller_config is not
defined as a const pointer. This prevents clients from registering a
read-only configuration unless they use a typecast. Since the
event_cfg should not be modified once registered, add the const
qualifier to event_cfg. This is aligned with the definition of ch_cfg.

Signed-off-by: Jeff Johnson <quic_jjohnson@quicinc.com>
---
 drivers/bus/mhi/host/pci_generic.c | 14 +++++++-------
 include/linux/mhi.h                |  2 +-
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/bus/mhi/host/pci_generic.c b/drivers/bus/mhi/host/pci_generic.c
index 841626727f6b..2470e9f82aeb 100644
--- a/drivers/bus/mhi/host/pci_generic.c
+++ b/drivers/bus/mhi/host/pci_generic.c
@@ -238,7 +238,7 @@ static const struct mhi_channel_config modem_qcom_v1_mhi_channels[] = {
 	MHI_CHANNEL_CONFIG_HW_DL(101, "IP_HW0", 128, 3),
 };
 
-static struct mhi_event_config modem_qcom_v1_mhi_events[] = {
+static const struct mhi_event_config modem_qcom_v1_mhi_events[] = {
 	/* first ring is control+data ring */
 	MHI_EVENT_CONFIG_CTRL(0, 64),
 	/* DIAG dedicated event ring */
@@ -305,7 +305,7 @@ static const struct mhi_channel_config mhi_quectel_em1xx_channels[] = {
 	MHI_CHANNEL_CONFIG_HW_DL(101, "IP_HW0_MBIM", 128, 3),
 };
 
-static struct mhi_event_config mhi_quectel_em1xx_events[] = {
+static const struct mhi_event_config mhi_quectel_em1xx_events[] = {
 	MHI_EVENT_CONFIG_CTRL(0, 128),
 	MHI_EVENT_CONFIG_DATA(1, 128),
 	MHI_EVENT_CONFIG_HW_DATA(2, 1024, 100),
@@ -344,7 +344,7 @@ static const struct mhi_channel_config mhi_foxconn_sdx55_channels[] = {
 	MHI_CHANNEL_CONFIG_HW_DL(101, "IP_HW0_MBIM", 128, 3),
 };
 
-static struct mhi_event_config mhi_foxconn_sdx55_events[] = {
+static struct const mhi_event_config mhi_foxconn_sdx55_events[] = {
 	MHI_EVENT_CONFIG_CTRL(0, 128),
 	MHI_EVENT_CONFIG_DATA(1, 128),
 	MHI_EVENT_CONFIG_HW_DATA(2, 1024, 100),
@@ -391,7 +391,7 @@ static const struct mhi_channel_config mhi_mv3x_channels[] = {
 	MHI_CHANNEL_CONFIG_HW_DL(101, "IP_HW0_MBIM", 512, 3),
 };
 
-static struct mhi_event_config mhi_mv3x_events[] = {
+static const struct mhi_event_config mhi_mv3x_events[] = {
 	MHI_EVENT_CONFIG_CTRL(0, 256),
 	MHI_EVENT_CONFIG_DATA(1, 256),
 	MHI_EVENT_CONFIG_HW_DATA(2, 1024, 100),
@@ -438,7 +438,7 @@ static const struct mhi_channel_config mhi_sierra_em919x_channels[] = {
 	MHI_CHANNEL_CONFIG_HW_DL(101, "IP_HW0", 512, 2),
 };
 
-static struct mhi_event_config modem_sierra_em919x_mhi_events[] = {
+static const struct mhi_event_config modem_sierra_em919x_mhi_events[] = {
 	/* first ring is control+data and DIAG ring */
 	MHI_EVENT_CONFIG_CTRL(0, 2048),
 	/* Hardware channels request dedicated hardware event rings */
@@ -472,7 +472,7 @@ static const struct mhi_channel_config mhi_telit_fn980_hw_v1_channels[] = {
 	MHI_CHANNEL_CONFIG_HW_DL(101, "IP_HW0", 128, 2),
 };
 
-static struct mhi_event_config mhi_telit_fn980_hw_v1_events[] = {
+static const struct mhi_event_config mhi_telit_fn980_hw_v1_events[] = {
 	MHI_EVENT_CONFIG_CTRL(0, 128),
 	MHI_EVENT_CONFIG_HW_DATA(1, 1024, 100),
 	MHI_EVENT_CONFIG_HW_DATA(2, 2048, 101)
@@ -511,7 +511,7 @@ static const struct mhi_channel_config mhi_telit_fn990_channels[] = {
 	MHI_CHANNEL_CONFIG_HW_DL(101, "IP_HW0_MBIM", 128, 3),
 };
 
-static struct mhi_event_config mhi_telit_fn990_events[] = {
+static const struct mhi_event_config mhi_telit_fn990_events[] = {
 	MHI_EVENT_CONFIG_CTRL(0, 128),
 	MHI_EVENT_CONFIG_DATA(1, 128),
 	MHI_EVENT_CONFIG_HW_DATA(2, 1024, 100),
diff --git a/include/linux/mhi.h b/include/linux/mhi.h
index a5441ad33c74..ada2f18af4d6 100644
--- a/include/linux/mhi.h
+++ b/include/linux/mhi.h
@@ -281,7 +281,7 @@ struct mhi_controller_config {
 	u32 num_channels;
 	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;
 };
-- 
2.37.0


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

* Re: [PATCH v3] bus: mhi: make mhi_controller_config::event_cfg const
  2022-08-19 21:02 [PATCH v3] bus: mhi: make mhi_controller_config::event_cfg const Jeff Johnson
@ 2022-08-19 21:08 ` Jeffrey Hugo
  2022-08-19 21:15   ` Jeff Johnson
  2022-08-29 17:31 ` Manivannan Sadhasivam
  2022-08-29 20:51 ` [PATCH v4] bus: mhi: host: " Jeff Johnson
  2 siblings, 1 reply; 16+ messages in thread
From: Jeffrey Hugo @ 2022-08-19 21:08 UTC (permalink / raw)
  To: Jeff Johnson, Manivannan Sadhasivam, Hemant Kumar; +Cc: linux-arm-msm, mhi

On 8/19/2022 3:02 PM, Jeff Johnson wrote:
> Currently the event_cfg pointer in struct mhi_controller_config is not
> defined as a const pointer. This prevents clients from registering a
> read-only configuration unless they use a typecast. Since the
> event_cfg should not be modified once registered, add the const
> qualifier to event_cfg. This is aligned with the definition of ch_cfg.
> 
> Signed-off-by: Jeff Johnson <quic_jjohnson@quicinc.com>
> ---

v3 and no changelog?

>   drivers/bus/mhi/host/pci_generic.c | 14 +++++++-------
>   include/linux/mhi.h                |  2 +-
>   2 files changed, 8 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/bus/mhi/host/pci_generic.c b/drivers/bus/mhi/host/pci_generic.c
> index 841626727f6b..2470e9f82aeb 100644
> --- a/drivers/bus/mhi/host/pci_generic.c
> +++ b/drivers/bus/mhi/host/pci_generic.c
> @@ -238,7 +238,7 @@ static const struct mhi_channel_config modem_qcom_v1_mhi_channels[] = {
>   	MHI_CHANNEL_CONFIG_HW_DL(101, "IP_HW0", 128, 3),
>   };
>   
> -static struct mhi_event_config modem_qcom_v1_mhi_events[] = {
> +static const struct mhi_event_config modem_qcom_v1_mhi_events[] = {
>   	/* first ring is control+data ring */
>   	MHI_EVENT_CONFIG_CTRL(0, 64),
>   	/* DIAG dedicated event ring */
> @@ -305,7 +305,7 @@ static const struct mhi_channel_config mhi_quectel_em1xx_channels[] = {
>   	MHI_CHANNEL_CONFIG_HW_DL(101, "IP_HW0_MBIM", 128, 3),
>   };
>   
> -static struct mhi_event_config mhi_quectel_em1xx_events[] = {
> +static const struct mhi_event_config mhi_quectel_em1xx_events[] = {
>   	MHI_EVENT_CONFIG_CTRL(0, 128),
>   	MHI_EVENT_CONFIG_DATA(1, 128),
>   	MHI_EVENT_CONFIG_HW_DATA(2, 1024, 100),
> @@ -344,7 +344,7 @@ static const struct mhi_channel_config mhi_foxconn_sdx55_channels[] = {
>   	MHI_CHANNEL_CONFIG_HW_DL(101, "IP_HW0_MBIM", 128, 3),
>   };
>   
> -static struct mhi_event_config mhi_foxconn_sdx55_events[] = {
> +static struct const mhi_event_config mhi_foxconn_sdx55_events[] = {
>   	MHI_EVENT_CONFIG_CTRL(0, 128),
>   	MHI_EVENT_CONFIG_DATA(1, 128),
>   	MHI_EVENT_CONFIG_HW_DATA(2, 1024, 100),
> @@ -391,7 +391,7 @@ static const struct mhi_channel_config mhi_mv3x_channels[] = {
>   	MHI_CHANNEL_CONFIG_HW_DL(101, "IP_HW0_MBIM", 512, 3),
>   };
>   
> -static struct mhi_event_config mhi_mv3x_events[] = {
> +static const struct mhi_event_config mhi_mv3x_events[] = {
>   	MHI_EVENT_CONFIG_CTRL(0, 256),
>   	MHI_EVENT_CONFIG_DATA(1, 256),
>   	MHI_EVENT_CONFIG_HW_DATA(2, 1024, 100),
> @@ -438,7 +438,7 @@ static const struct mhi_channel_config mhi_sierra_em919x_channels[] = {
>   	MHI_CHANNEL_CONFIG_HW_DL(101, "IP_HW0", 512, 2),
>   };
>   
> -static struct mhi_event_config modem_sierra_em919x_mhi_events[] = {
> +static const struct mhi_event_config modem_sierra_em919x_mhi_events[] = {
>   	/* first ring is control+data and DIAG ring */
>   	MHI_EVENT_CONFIG_CTRL(0, 2048),
>   	/* Hardware channels request dedicated hardware event rings */
> @@ -472,7 +472,7 @@ static const struct mhi_channel_config mhi_telit_fn980_hw_v1_channels[] = {
>   	MHI_CHANNEL_CONFIG_HW_DL(101, "IP_HW0", 128, 2),
>   };
>   
> -static struct mhi_event_config mhi_telit_fn980_hw_v1_events[] = {
> +static const struct mhi_event_config mhi_telit_fn980_hw_v1_events[] = {
>   	MHI_EVENT_CONFIG_CTRL(0, 128),
>   	MHI_EVENT_CONFIG_HW_DATA(1, 1024, 100),
>   	MHI_EVENT_CONFIG_HW_DATA(2, 2048, 101)
> @@ -511,7 +511,7 @@ static const struct mhi_channel_config mhi_telit_fn990_channels[] = {
>   	MHI_CHANNEL_CONFIG_HW_DL(101, "IP_HW0_MBIM", 128, 3),
>   };
>   
> -static struct mhi_event_config mhi_telit_fn990_events[] = {
> +static const struct mhi_event_config mhi_telit_fn990_events[] = {
>   	MHI_EVENT_CONFIG_CTRL(0, 128),
>   	MHI_EVENT_CONFIG_DATA(1, 128),
>   	MHI_EVENT_CONFIG_HW_DATA(2, 1024, 100),
> diff --git a/include/linux/mhi.h b/include/linux/mhi.h
> index a5441ad33c74..ada2f18af4d6 100644
> --- a/include/linux/mhi.h
> +++ b/include/linux/mhi.h
> @@ -281,7 +281,7 @@ struct mhi_controller_config {
>   	u32 num_channels;
>   	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;
>   };


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

* Re: [PATCH v3] bus: mhi: make mhi_controller_config::event_cfg const
  2022-08-19 21:08 ` Jeffrey Hugo
@ 2022-08-19 21:15   ` Jeff Johnson
  2022-08-27 18:43     ` Jeff Johnson
  0 siblings, 1 reply; 16+ messages in thread
From: Jeff Johnson @ 2022-08-19 21:15 UTC (permalink / raw)
  To: Jeffrey Hugo, Manivannan Sadhasivam, Hemant Kumar; +Cc: linux-arm-msm, mhi

On 8/19/2022 2:08 PM, Jeffrey Hugo wrote:
> On 8/19/2022 3:02 PM, Jeff Johnson wrote:
>> Currently the event_cfg pointer in struct mhi_controller_config is not
>> defined as a const pointer. This prevents clients from registering a
>> read-only configuration unless they use a typecast. Since the
>> event_cfg should not be modified once registered, add the const
>> qualifier to event_cfg. This is aligned with the definition of ch_cfg.
>>
>> Signed-off-by: Jeff Johnson <quic_jjohnson@quicinc.com>
>> ---
> 
> v3 and no changelog?

Rookie mistake :)
v1: only header file changed
v2: added SOB
v3: added pci_generic.c change

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

* Re: [PATCH v3] bus: mhi: make mhi_controller_config::event_cfg const
  2022-08-19 21:15   ` Jeff Johnson
@ 2022-08-27 18:43     ` Jeff Johnson
  0 siblings, 0 replies; 16+ messages in thread
From: Jeff Johnson @ 2022-08-27 18:43 UTC (permalink / raw)
  To: Jeffrey Hugo, Manivannan Sadhasivam, Hemant Kumar; +Cc: linux-arm-msm, mhi

On 8/19/2022 2:15 PM, Jeff Johnson wrote:
> On 8/19/2022 2:08 PM, Jeffrey Hugo wrote:
>> On 8/19/2022 3:02 PM, Jeff Johnson wrote:
>>> Currently the event_cfg pointer in struct mhi_controller_config is not
>>> defined as a const pointer. This prevents clients from registering a
>>> read-only configuration unless they use a typecast. Since the
>>> event_cfg should not be modified once registered, add the const
>>> qualifier to event_cfg. This is aligned with the definition of ch_cfg.
>>>
>>> Signed-off-by: Jeff Johnson <quic_jjohnson@quicinc.com>
>>> ---
>>
>> v3 and no changelog?
> 
> Rookie mistake :)
> v1: only header file changed
> v2: added SOB
> v3: added pci_generic.c change

I see my patch has been set to Not Applicable in patchwork, but did not 
receive any comments other than the one quoted here.

Should I rebase & post v4 with a correct changelog?


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

* Re: [PATCH v3] bus: mhi: make mhi_controller_config::event_cfg const
  2022-08-19 21:02 [PATCH v3] bus: mhi: make mhi_controller_config::event_cfg const Jeff Johnson
  2022-08-19 21:08 ` Jeffrey Hugo
@ 2022-08-29 17:31 ` Manivannan Sadhasivam
  2022-08-29 20:51 ` [PATCH v4] bus: mhi: host: " Jeff Johnson
  2 siblings, 0 replies; 16+ messages in thread
From: Manivannan Sadhasivam @ 2022-08-29 17:31 UTC (permalink / raw)
  To: Jeff Johnson; +Cc: Hemant Kumar, linux-arm-msm, mhi

On Fri, Aug 19, 2022 at 02:02:30PM -0700, Jeff Johnson wrote:

Subject prefix should include "host" as we now have both host and ep MHI
stacks. Like,

bus: mhi: host: make mhi_controller_config::event_cfg const

> Currently the event_cfg pointer in struct mhi_controller_config is not
> defined as a const pointer. This prevents clients from registering a
> read-only configuration unless they use a typecast. Since the
> event_cfg should not be modified once registered, add the const
> qualifier to event_cfg. This is aligned with the definition of ch_cfg.
> 

I don't know how it got missed as it should've been made constant in the
initial implementation itself :/

> Signed-off-by: Jeff Johnson <quic_jjohnson@quicinc.com>
> ---
>  drivers/bus/mhi/host/pci_generic.c | 14 +++++++-------
>  include/linux/mhi.h                |  2 +-
>  2 files changed, 8 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/bus/mhi/host/pci_generic.c b/drivers/bus/mhi/host/pci_generic.c
> index 841626727f6b..2470e9f82aeb 100644
> --- a/drivers/bus/mhi/host/pci_generic.c
> +++ b/drivers/bus/mhi/host/pci_generic.c
> @@ -238,7 +238,7 @@ static const struct mhi_channel_config modem_qcom_v1_mhi_channels[] = {
>  	MHI_CHANNEL_CONFIG_HW_DL(101, "IP_HW0", 128, 3),
>  };
>  
> -static struct mhi_event_config modem_qcom_v1_mhi_events[] = {
> +static const struct mhi_event_config modem_qcom_v1_mhi_events[] = {
>  	/* first ring is control+data ring */
>  	MHI_EVENT_CONFIG_CTRL(0, 64),
>  	/* DIAG dedicated event ring */
> @@ -305,7 +305,7 @@ static const struct mhi_channel_config mhi_quectel_em1xx_channels[] = {
>  	MHI_CHANNEL_CONFIG_HW_DL(101, "IP_HW0_MBIM", 128, 3),
>  };
>  
> -static struct mhi_event_config mhi_quectel_em1xx_events[] = {
> +static const struct mhi_event_config mhi_quectel_em1xx_events[] = {
>  	MHI_EVENT_CONFIG_CTRL(0, 128),
>  	MHI_EVENT_CONFIG_DATA(1, 128),
>  	MHI_EVENT_CONFIG_HW_DATA(2, 1024, 100),
> @@ -344,7 +344,7 @@ static const struct mhi_channel_config mhi_foxconn_sdx55_channels[] = {
>  	MHI_CHANNEL_CONFIG_HW_DL(101, "IP_HW0_MBIM", 128, 3),
>  };
>  
> -static struct mhi_event_config mhi_foxconn_sdx55_events[] = {
> +static struct const mhi_event_config mhi_foxconn_sdx55_events[] = {

const struct?

Thanks,
Mani

>  	MHI_EVENT_CONFIG_CTRL(0, 128),
>  	MHI_EVENT_CONFIG_DATA(1, 128),
>  	MHI_EVENT_CONFIG_HW_DATA(2, 1024, 100),
> @@ -391,7 +391,7 @@ static const struct mhi_channel_config mhi_mv3x_channels[] = {
>  	MHI_CHANNEL_CONFIG_HW_DL(101, "IP_HW0_MBIM", 512, 3),
>  };
>  
> -static struct mhi_event_config mhi_mv3x_events[] = {
> +static const struct mhi_event_config mhi_mv3x_events[] = {
>  	MHI_EVENT_CONFIG_CTRL(0, 256),
>  	MHI_EVENT_CONFIG_DATA(1, 256),
>  	MHI_EVENT_CONFIG_HW_DATA(2, 1024, 100),
> @@ -438,7 +438,7 @@ static const struct mhi_channel_config mhi_sierra_em919x_channels[] = {
>  	MHI_CHANNEL_CONFIG_HW_DL(101, "IP_HW0", 512, 2),
>  };
>  
> -static struct mhi_event_config modem_sierra_em919x_mhi_events[] = {
> +static const struct mhi_event_config modem_sierra_em919x_mhi_events[] = {
>  	/* first ring is control+data and DIAG ring */
>  	MHI_EVENT_CONFIG_CTRL(0, 2048),
>  	/* Hardware channels request dedicated hardware event rings */
> @@ -472,7 +472,7 @@ static const struct mhi_channel_config mhi_telit_fn980_hw_v1_channels[] = {
>  	MHI_CHANNEL_CONFIG_HW_DL(101, "IP_HW0", 128, 2),
>  };
>  
> -static struct mhi_event_config mhi_telit_fn980_hw_v1_events[] = {
> +static const struct mhi_event_config mhi_telit_fn980_hw_v1_events[] = {
>  	MHI_EVENT_CONFIG_CTRL(0, 128),
>  	MHI_EVENT_CONFIG_HW_DATA(1, 1024, 100),
>  	MHI_EVENT_CONFIG_HW_DATA(2, 2048, 101)
> @@ -511,7 +511,7 @@ static const struct mhi_channel_config mhi_telit_fn990_channels[] = {
>  	MHI_CHANNEL_CONFIG_HW_DL(101, "IP_HW0_MBIM", 128, 3),
>  };
>  
> -static struct mhi_event_config mhi_telit_fn990_events[] = {
> +static const struct mhi_event_config mhi_telit_fn990_events[] = {
>  	MHI_EVENT_CONFIG_CTRL(0, 128),
>  	MHI_EVENT_CONFIG_DATA(1, 128),
>  	MHI_EVENT_CONFIG_HW_DATA(2, 1024, 100),
> diff --git a/include/linux/mhi.h b/include/linux/mhi.h
> index a5441ad33c74..ada2f18af4d6 100644
> --- a/include/linux/mhi.h
> +++ b/include/linux/mhi.h
> @@ -281,7 +281,7 @@ struct mhi_controller_config {
>  	u32 num_channels;
>  	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;
>  };
> -- 
> 2.37.0
> 

-- 
மணிவண்ணன் சதாசிவம்

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

* [PATCH v4] bus: mhi: host: make mhi_controller_config::event_cfg const
  2022-08-19 21:02 [PATCH v3] bus: mhi: make mhi_controller_config::event_cfg const Jeff Johnson
  2022-08-19 21:08 ` Jeffrey Hugo
  2022-08-29 17:31 ` Manivannan Sadhasivam
@ 2022-08-29 20:51 ` Jeff Johnson
  2022-08-30  7:46   ` Manivannan Sadhasivam
  2022-08-30 17:11   ` [PATCH v5] " Jeff Johnson
  2 siblings, 2 replies; 16+ messages in thread
From: Jeff Johnson @ 2022-08-29 20:51 UTC (permalink / raw)
  To: Manivannan Sadhasivam, Hemant Kumar; +Cc: linux-arm-msm, mhi, Jeff Johnson

Currently the event_cfg pointer in struct mhi_controller_config is not
defined as a const pointer. This prevents clients from registering a
read-only configuration unless they use a typecast. Since the
event_cfg should not be modified once registered, add the const
qualifier to event_cfg. This is aligned with the definition of ch_cfg.

Signed-off-by: Jeff Johnson <quic_jjohnson@quicinc.com>
---
v4:	updated subject, rebased to v6.0-rc3

v3:	added pci_generic.c change

v2:	added S-O-B

 drivers/bus/mhi/host/pci_generic.c | 14 +++++++-------
 include/linux/mhi.h                |  2 +-
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/bus/mhi/host/pci_generic.c b/drivers/bus/mhi/host/pci_generic.c
index 9e545f2a5a26..8db63543ce8f 100644
--- a/drivers/bus/mhi/host/pci_generic.c
+++ b/drivers/bus/mhi/host/pci_generic.c
@@ -238,7 +238,7 @@ static const struct mhi_channel_config modem_qcom_v1_mhi_channels[] = {
 	MHI_CHANNEL_CONFIG_HW_DL(101, "IP_HW0", 128, 3),
 };
 
-static struct mhi_event_config modem_qcom_v1_mhi_events[] = {
+static const struct mhi_event_config modem_qcom_v1_mhi_events[] = {
 	/* first ring is control+data ring */
 	MHI_EVENT_CONFIG_CTRL(0, 64),
 	/* DIAG dedicated event ring */
@@ -305,7 +305,7 @@ static const struct mhi_channel_config mhi_quectel_em1xx_channels[] = {
 	MHI_CHANNEL_CONFIG_HW_DL(101, "IP_HW0_MBIM", 128, 3),
 };
 
-static struct mhi_event_config mhi_quectel_em1xx_events[] = {
+static const struct mhi_event_config mhi_quectel_em1xx_events[] = {
 	MHI_EVENT_CONFIG_CTRL(0, 128),
 	MHI_EVENT_CONFIG_DATA(1, 128),
 	MHI_EVENT_CONFIG_HW_DATA(2, 1024, 100),
@@ -344,7 +344,7 @@ static const struct mhi_channel_config mhi_foxconn_sdx55_channels[] = {
 	MHI_CHANNEL_CONFIG_HW_DL(101, "IP_HW0_MBIM", 128, 3),
 };
 
-static struct mhi_event_config mhi_foxconn_sdx55_events[] = {
+static struct const mhi_event_config mhi_foxconn_sdx55_events[] = {
 	MHI_EVENT_CONFIG_CTRL(0, 128),
 	MHI_EVENT_CONFIG_DATA(1, 128),
 	MHI_EVENT_CONFIG_HW_DATA(2, 1024, 100),
@@ -391,7 +391,7 @@ static const struct mhi_channel_config mhi_mv3x_channels[] = {
 	MHI_CHANNEL_CONFIG_HW_DL(101, "IP_HW0_MBIM", 512, 3),
 };
 
-static struct mhi_event_config mhi_mv3x_events[] = {
+static const struct mhi_event_config mhi_mv3x_events[] = {
 	MHI_EVENT_CONFIG_CTRL(0, 256),
 	MHI_EVENT_CONFIG_DATA(1, 256),
 	MHI_EVENT_CONFIG_HW_DATA(2, 1024, 100),
@@ -438,7 +438,7 @@ static const struct mhi_channel_config mhi_sierra_em919x_channels[] = {
 	MHI_CHANNEL_CONFIG_HW_DL(101, "IP_HW0", 512, 2),
 };
 
-static struct mhi_event_config modem_sierra_em919x_mhi_events[] = {
+static const struct mhi_event_config modem_sierra_em919x_mhi_events[] = {
 	/* first ring is control+data and DIAG ring */
 	MHI_EVENT_CONFIG_CTRL(0, 2048),
 	/* Hardware channels request dedicated hardware event rings */
@@ -472,7 +472,7 @@ static const struct mhi_channel_config mhi_telit_fn980_hw_v1_channels[] = {
 	MHI_CHANNEL_CONFIG_HW_DL(101, "IP_HW0", 128, 2),
 };
 
-static struct mhi_event_config mhi_telit_fn980_hw_v1_events[] = {
+static const struct mhi_event_config mhi_telit_fn980_hw_v1_events[] = {
 	MHI_EVENT_CONFIG_CTRL(0, 128),
 	MHI_EVENT_CONFIG_HW_DATA(1, 1024, 100),
 	MHI_EVENT_CONFIG_HW_DATA(2, 2048, 101)
@@ -511,7 +511,7 @@ static const struct mhi_channel_config mhi_telit_fn990_channels[] = {
 	MHI_CHANNEL_CONFIG_HW_DL(101, "IP_HW0_MBIM", 128, 3),
 };
 
-static struct mhi_event_config mhi_telit_fn990_events[] = {
+static const struct mhi_event_config mhi_telit_fn990_events[] = {
 	MHI_EVENT_CONFIG_CTRL(0, 128),
 	MHI_EVENT_CONFIG_DATA(1, 128),
 	MHI_EVENT_CONFIG_HW_DATA(2, 1024, 100),
diff --git a/include/linux/mhi.h b/include/linux/mhi.h
index a5441ad33c74..ada2f18af4d6 100644
--- a/include/linux/mhi.h
+++ b/include/linux/mhi.h
@@ -281,7 +281,7 @@ struct mhi_controller_config {
 	u32 num_channels;
 	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;
 };
-- 
2.37.0


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

* Re: [PATCH v4] bus: mhi: host: make mhi_controller_config::event_cfg const
  2022-08-29 20:51 ` [PATCH v4] bus: mhi: host: " Jeff Johnson
@ 2022-08-30  7:46   ` Manivannan Sadhasivam
  2022-08-30 17:12     ` Jeff Johnson
  2022-08-30 17:11   ` [PATCH v5] " Jeff Johnson
  1 sibling, 1 reply; 16+ messages in thread
From: Manivannan Sadhasivam @ 2022-08-30  7:46 UTC (permalink / raw)
  To: Jeff Johnson; +Cc: Manivannan Sadhasivam, Hemant Kumar, linux-arm-msm, mhi

On Mon, Aug 29, 2022 at 01:51:12PM -0700, Jeff Johnson wrote:
> Currently the event_cfg pointer in struct mhi_controller_config is not
> defined as a const pointer. This prevents clients from registering a
> read-only configuration unless they use a typecast. Since the
> event_cfg should not be modified once registered, add the const
> qualifier to event_cfg. This is aligned with the definition of ch_cfg.
> 
> Signed-off-by: Jeff Johnson <quic_jjohnson@quicinc.com>
> ---
> v4:	updated subject, rebased to v6.0-rc3
> 
> v3:	added pci_generic.c change
> 
> v2:	added S-O-B
> 
>  drivers/bus/mhi/host/pci_generic.c | 14 +++++++-------
>  include/linux/mhi.h                |  2 +-
>  2 files changed, 8 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/bus/mhi/host/pci_generic.c b/drivers/bus/mhi/host/pci_generic.c
> index 9e545f2a5a26..8db63543ce8f 100644
> --- a/drivers/bus/mhi/host/pci_generic.c
> +++ b/drivers/bus/mhi/host/pci_generic.c
> @@ -238,7 +238,7 @@ static const struct mhi_channel_config modem_qcom_v1_mhi_channels[] = {
>  	MHI_CHANNEL_CONFIG_HW_DL(101, "IP_HW0", 128, 3),
>  };
>  
> -static struct mhi_event_config modem_qcom_v1_mhi_events[] = {
> +static const struct mhi_event_config modem_qcom_v1_mhi_events[] = {
>  	/* first ring is control+data ring */
>  	MHI_EVENT_CONFIG_CTRL(0, 64),
>  	/* DIAG dedicated event ring */
> @@ -305,7 +305,7 @@ static const struct mhi_channel_config mhi_quectel_em1xx_channels[] = {
>  	MHI_CHANNEL_CONFIG_HW_DL(101, "IP_HW0_MBIM", 128, 3),
>  };
>  
> -static struct mhi_event_config mhi_quectel_em1xx_events[] = {
> +static const struct mhi_event_config mhi_quectel_em1xx_events[] = {
>  	MHI_EVENT_CONFIG_CTRL(0, 128),
>  	MHI_EVENT_CONFIG_DATA(1, 128),
>  	MHI_EVENT_CONFIG_HW_DATA(2, 1024, 100),
> @@ -344,7 +344,7 @@ static const struct mhi_channel_config mhi_foxconn_sdx55_channels[] = {
>  	MHI_CHANNEL_CONFIG_HW_DL(101, "IP_HW0_MBIM", 128, 3),
>  };
>  
> -static struct mhi_event_config mhi_foxconn_sdx55_events[] = {
> +static struct const mhi_event_config mhi_foxconn_sdx55_events[] = {

You still haven't fixed this...

Thanks,
Mani

>  	MHI_EVENT_CONFIG_CTRL(0, 128),
>  	MHI_EVENT_CONFIG_DATA(1, 128),
>  	MHI_EVENT_CONFIG_HW_DATA(2, 1024, 100),
> @@ -391,7 +391,7 @@ static const struct mhi_channel_config mhi_mv3x_channels[] = {
>  	MHI_CHANNEL_CONFIG_HW_DL(101, "IP_HW0_MBIM", 512, 3),
>  };
>  
> -static struct mhi_event_config mhi_mv3x_events[] = {
> +static const struct mhi_event_config mhi_mv3x_events[] = {
>  	MHI_EVENT_CONFIG_CTRL(0, 256),
>  	MHI_EVENT_CONFIG_DATA(1, 256),
>  	MHI_EVENT_CONFIG_HW_DATA(2, 1024, 100),
> @@ -438,7 +438,7 @@ static const struct mhi_channel_config mhi_sierra_em919x_channels[] = {
>  	MHI_CHANNEL_CONFIG_HW_DL(101, "IP_HW0", 512, 2),
>  };
>  
> -static struct mhi_event_config modem_sierra_em919x_mhi_events[] = {
> +static const struct mhi_event_config modem_sierra_em919x_mhi_events[] = {
>  	/* first ring is control+data and DIAG ring */
>  	MHI_EVENT_CONFIG_CTRL(0, 2048),
>  	/* Hardware channels request dedicated hardware event rings */
> @@ -472,7 +472,7 @@ static const struct mhi_channel_config mhi_telit_fn980_hw_v1_channels[] = {
>  	MHI_CHANNEL_CONFIG_HW_DL(101, "IP_HW0", 128, 2),
>  };
>  
> -static struct mhi_event_config mhi_telit_fn980_hw_v1_events[] = {
> +static const struct mhi_event_config mhi_telit_fn980_hw_v1_events[] = {
>  	MHI_EVENT_CONFIG_CTRL(0, 128),
>  	MHI_EVENT_CONFIG_HW_DATA(1, 1024, 100),
>  	MHI_EVENT_CONFIG_HW_DATA(2, 2048, 101)
> @@ -511,7 +511,7 @@ static const struct mhi_channel_config mhi_telit_fn990_channels[] = {
>  	MHI_CHANNEL_CONFIG_HW_DL(101, "IP_HW0_MBIM", 128, 3),
>  };
>  
> -static struct mhi_event_config mhi_telit_fn990_events[] = {
> +static const struct mhi_event_config mhi_telit_fn990_events[] = {
>  	MHI_EVENT_CONFIG_CTRL(0, 128),
>  	MHI_EVENT_CONFIG_DATA(1, 128),
>  	MHI_EVENT_CONFIG_HW_DATA(2, 1024, 100),
> diff --git a/include/linux/mhi.h b/include/linux/mhi.h
> index a5441ad33c74..ada2f18af4d6 100644
> --- a/include/linux/mhi.h
> +++ b/include/linux/mhi.h
> @@ -281,7 +281,7 @@ struct mhi_controller_config {
>  	u32 num_channels;
>  	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;
>  };
> -- 
> 2.37.0
> 
> 

-- 
மணிவண்ணன் சதாசிவம்

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

* [PATCH v5] bus: mhi: host: make mhi_controller_config::event_cfg const
  2022-08-29 20:51 ` [PATCH v4] bus: mhi: host: " Jeff Johnson
  2022-08-30  7:46   ` Manivannan Sadhasivam
@ 2022-08-30 17:11   ` Jeff Johnson
  2022-08-31  8:13     ` Manivannan Sadhasivam
  2022-09-07  8:00     ` Manivannan Sadhasivam
  1 sibling, 2 replies; 16+ messages in thread
From: Jeff Johnson @ 2022-08-30 17:11 UTC (permalink / raw)
  To: Manivannan Sadhasivam, Hemant Kumar; +Cc: linux-arm-msm, mhi, Jeff Johnson

Currently the event_cfg pointer in struct mhi_controller_config is not
defined as a const pointer. This prevents clients from registering a
read-only configuration unless they use a typecast. Since the
event_cfg should not be modified once registered, add the const
qualifier to event_cfg. This is aligned with the definition of ch_cfg.

Signed-off-by: Jeff Johnson <quic_jjohnson@quicinc.com>
---
v5:	corrected mhi_foxconn_sdx55_events[]

v4:	updated subject, rebased to v6.0-rc3

v3:	added pci_generic.c change

v2:	added S-O-B

 drivers/bus/mhi/host/pci_generic.c | 14 +++++++-------
 include/linux/mhi.h                |  2 +-
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/bus/mhi/host/pci_generic.c b/drivers/bus/mhi/host/pci_generic.c
index 9e545f2a5a26..0db437ac3ba4 100644
--- a/drivers/bus/mhi/host/pci_generic.c
+++ b/drivers/bus/mhi/host/pci_generic.c
@@ -238,7 +238,7 @@ static const struct mhi_channel_config modem_qcom_v1_mhi_channels[] = {
 	MHI_CHANNEL_CONFIG_HW_DL(101, "IP_HW0", 128, 3),
 };
 
-static struct mhi_event_config modem_qcom_v1_mhi_events[] = {
+static const struct mhi_event_config modem_qcom_v1_mhi_events[] = {
 	/* first ring is control+data ring */
 	MHI_EVENT_CONFIG_CTRL(0, 64),
 	/* DIAG dedicated event ring */
@@ -305,7 +305,7 @@ static const struct mhi_channel_config mhi_quectel_em1xx_channels[] = {
 	MHI_CHANNEL_CONFIG_HW_DL(101, "IP_HW0_MBIM", 128, 3),
 };
 
-static struct mhi_event_config mhi_quectel_em1xx_events[] = {
+static const struct mhi_event_config mhi_quectel_em1xx_events[] = {
 	MHI_EVENT_CONFIG_CTRL(0, 128),
 	MHI_EVENT_CONFIG_DATA(1, 128),
 	MHI_EVENT_CONFIG_HW_DATA(2, 1024, 100),
@@ -344,7 +344,7 @@ static const struct mhi_channel_config mhi_foxconn_sdx55_channels[] = {
 	MHI_CHANNEL_CONFIG_HW_DL(101, "IP_HW0_MBIM", 128, 3),
 };
 
-static struct mhi_event_config mhi_foxconn_sdx55_events[] = {
+static const struct mhi_event_config mhi_foxconn_sdx55_events[] = {
 	MHI_EVENT_CONFIG_CTRL(0, 128),
 	MHI_EVENT_CONFIG_DATA(1, 128),
 	MHI_EVENT_CONFIG_HW_DATA(2, 1024, 100),
@@ -391,7 +391,7 @@ static const struct mhi_channel_config mhi_mv3x_channels[] = {
 	MHI_CHANNEL_CONFIG_HW_DL(101, "IP_HW0_MBIM", 512, 3),
 };
 
-static struct mhi_event_config mhi_mv3x_events[] = {
+static const struct mhi_event_config mhi_mv3x_events[] = {
 	MHI_EVENT_CONFIG_CTRL(0, 256),
 	MHI_EVENT_CONFIG_DATA(1, 256),
 	MHI_EVENT_CONFIG_HW_DATA(2, 1024, 100),
@@ -438,7 +438,7 @@ static const struct mhi_channel_config mhi_sierra_em919x_channels[] = {
 	MHI_CHANNEL_CONFIG_HW_DL(101, "IP_HW0", 512, 2),
 };
 
-static struct mhi_event_config modem_sierra_em919x_mhi_events[] = {
+static const struct mhi_event_config modem_sierra_em919x_mhi_events[] = {
 	/* first ring is control+data and DIAG ring */
 	MHI_EVENT_CONFIG_CTRL(0, 2048),
 	/* Hardware channels request dedicated hardware event rings */
@@ -472,7 +472,7 @@ static const struct mhi_channel_config mhi_telit_fn980_hw_v1_channels[] = {
 	MHI_CHANNEL_CONFIG_HW_DL(101, "IP_HW0", 128, 2),
 };
 
-static struct mhi_event_config mhi_telit_fn980_hw_v1_events[] = {
+static const struct mhi_event_config mhi_telit_fn980_hw_v1_events[] = {
 	MHI_EVENT_CONFIG_CTRL(0, 128),
 	MHI_EVENT_CONFIG_HW_DATA(1, 1024, 100),
 	MHI_EVENT_CONFIG_HW_DATA(2, 2048, 101)
@@ -511,7 +511,7 @@ static const struct mhi_channel_config mhi_telit_fn990_channels[] = {
 	MHI_CHANNEL_CONFIG_HW_DL(101, "IP_HW0_MBIM", 128, 3),
 };
 
-static struct mhi_event_config mhi_telit_fn990_events[] = {
+static const struct mhi_event_config mhi_telit_fn990_events[] = {
 	MHI_EVENT_CONFIG_CTRL(0, 128),
 	MHI_EVENT_CONFIG_DATA(1, 128),
 	MHI_EVENT_CONFIG_HW_DATA(2, 1024, 100),
diff --git a/include/linux/mhi.h b/include/linux/mhi.h
index a5441ad33c74..ada2f18af4d6 100644
--- a/include/linux/mhi.h
+++ b/include/linux/mhi.h
@@ -281,7 +281,7 @@ struct mhi_controller_config {
 	u32 num_channels;
 	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;
 };
-- 
2.37.0


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

* Re: [PATCH v4] bus: mhi: host: make mhi_controller_config::event_cfg const
  2022-08-30  7:46   ` Manivannan Sadhasivam
@ 2022-08-30 17:12     ` Jeff Johnson
  0 siblings, 0 replies; 16+ messages in thread
From: Jeff Johnson @ 2022-08-30 17:12 UTC (permalink / raw)
  To: Manivannan Sadhasivam; +Cc: Hemant Kumar, linux-arm-msm, mhi

On 8/30/2022 12:46 AM, Manivannan Sadhasivam wrote:
>> -static struct mhi_event_config mhi_foxconn_sdx55_events[] = {
>> +static struct const mhi_event_config mhi_foxconn_sdx55_events[] = {
> 
> You still haven't fixed this...

Doh, put const in wrong place, v5 posted

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

* Re: [PATCH v5] bus: mhi: host: make mhi_controller_config::event_cfg const
  2022-08-30 17:11   ` [PATCH v5] " Jeff Johnson
@ 2022-08-31  8:13     ` Manivannan Sadhasivam
  2022-09-07  8:00     ` Manivannan Sadhasivam
  1 sibling, 0 replies; 16+ messages in thread
From: Manivannan Sadhasivam @ 2022-08-31  8:13 UTC (permalink / raw)
  To: Jeff Johnson; +Cc: Manivannan Sadhasivam, Hemant Kumar, linux-arm-msm, mhi

On Tue, Aug 30, 2022 at 10:11:47AM -0700, Jeff Johnson wrote:
> Currently the event_cfg pointer in struct mhi_controller_config is not
> defined as a const pointer. This prevents clients from registering a
> read-only configuration unless they use a typecast. Since the
> event_cfg should not be modified once registered, add the const
> qualifier to event_cfg. This is aligned with the definition of ch_cfg.
> 
> Signed-off-by: Jeff Johnson <quic_jjohnson@quicinc.com>

Reviewed-by: Manivannan Sadhasivam <mani@kernel.org>

Thanks,
Mani

> ---
> v5:	corrected mhi_foxconn_sdx55_events[]
> 
> v4:	updated subject, rebased to v6.0-rc3
> 
> v3:	added pci_generic.c change
> 
> v2:	added S-O-B
> 
>  drivers/bus/mhi/host/pci_generic.c | 14 +++++++-------
>  include/linux/mhi.h                |  2 +-
>  2 files changed, 8 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/bus/mhi/host/pci_generic.c b/drivers/bus/mhi/host/pci_generic.c
> index 9e545f2a5a26..0db437ac3ba4 100644
> --- a/drivers/bus/mhi/host/pci_generic.c
> +++ b/drivers/bus/mhi/host/pci_generic.c
> @@ -238,7 +238,7 @@ static const struct mhi_channel_config modem_qcom_v1_mhi_channels[] = {
>  	MHI_CHANNEL_CONFIG_HW_DL(101, "IP_HW0", 128, 3),
>  };
>  
> -static struct mhi_event_config modem_qcom_v1_mhi_events[] = {
> +static const struct mhi_event_config modem_qcom_v1_mhi_events[] = {
>  	/* first ring is control+data ring */
>  	MHI_EVENT_CONFIG_CTRL(0, 64),
>  	/* DIAG dedicated event ring */
> @@ -305,7 +305,7 @@ static const struct mhi_channel_config mhi_quectel_em1xx_channels[] = {
>  	MHI_CHANNEL_CONFIG_HW_DL(101, "IP_HW0_MBIM", 128, 3),
>  };
>  
> -static struct mhi_event_config mhi_quectel_em1xx_events[] = {
> +static const struct mhi_event_config mhi_quectel_em1xx_events[] = {
>  	MHI_EVENT_CONFIG_CTRL(0, 128),
>  	MHI_EVENT_CONFIG_DATA(1, 128),
>  	MHI_EVENT_CONFIG_HW_DATA(2, 1024, 100),
> @@ -344,7 +344,7 @@ static const struct mhi_channel_config mhi_foxconn_sdx55_channels[] = {
>  	MHI_CHANNEL_CONFIG_HW_DL(101, "IP_HW0_MBIM", 128, 3),
>  };
>  
> -static struct mhi_event_config mhi_foxconn_sdx55_events[] = {
> +static const struct mhi_event_config mhi_foxconn_sdx55_events[] = {
>  	MHI_EVENT_CONFIG_CTRL(0, 128),
>  	MHI_EVENT_CONFIG_DATA(1, 128),
>  	MHI_EVENT_CONFIG_HW_DATA(2, 1024, 100),
> @@ -391,7 +391,7 @@ static const struct mhi_channel_config mhi_mv3x_channels[] = {
>  	MHI_CHANNEL_CONFIG_HW_DL(101, "IP_HW0_MBIM", 512, 3),
>  };
>  
> -static struct mhi_event_config mhi_mv3x_events[] = {
> +static const struct mhi_event_config mhi_mv3x_events[] = {
>  	MHI_EVENT_CONFIG_CTRL(0, 256),
>  	MHI_EVENT_CONFIG_DATA(1, 256),
>  	MHI_EVENT_CONFIG_HW_DATA(2, 1024, 100),
> @@ -438,7 +438,7 @@ static const struct mhi_channel_config mhi_sierra_em919x_channels[] = {
>  	MHI_CHANNEL_CONFIG_HW_DL(101, "IP_HW0", 512, 2),
>  };
>  
> -static struct mhi_event_config modem_sierra_em919x_mhi_events[] = {
> +static const struct mhi_event_config modem_sierra_em919x_mhi_events[] = {
>  	/* first ring is control+data and DIAG ring */
>  	MHI_EVENT_CONFIG_CTRL(0, 2048),
>  	/* Hardware channels request dedicated hardware event rings */
> @@ -472,7 +472,7 @@ static const struct mhi_channel_config mhi_telit_fn980_hw_v1_channels[] = {
>  	MHI_CHANNEL_CONFIG_HW_DL(101, "IP_HW0", 128, 2),
>  };
>  
> -static struct mhi_event_config mhi_telit_fn980_hw_v1_events[] = {
> +static const struct mhi_event_config mhi_telit_fn980_hw_v1_events[] = {
>  	MHI_EVENT_CONFIG_CTRL(0, 128),
>  	MHI_EVENT_CONFIG_HW_DATA(1, 1024, 100),
>  	MHI_EVENT_CONFIG_HW_DATA(2, 2048, 101)
> @@ -511,7 +511,7 @@ static const struct mhi_channel_config mhi_telit_fn990_channels[] = {
>  	MHI_CHANNEL_CONFIG_HW_DL(101, "IP_HW0_MBIM", 128, 3),
>  };
>  
> -static struct mhi_event_config mhi_telit_fn990_events[] = {
> +static const struct mhi_event_config mhi_telit_fn990_events[] = {
>  	MHI_EVENT_CONFIG_CTRL(0, 128),
>  	MHI_EVENT_CONFIG_DATA(1, 128),
>  	MHI_EVENT_CONFIG_HW_DATA(2, 1024, 100),
> diff --git a/include/linux/mhi.h b/include/linux/mhi.h
> index a5441ad33c74..ada2f18af4d6 100644
> --- a/include/linux/mhi.h
> +++ b/include/linux/mhi.h
> @@ -281,7 +281,7 @@ struct mhi_controller_config {
>  	u32 num_channels;
>  	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;
>  };
> -- 
> 2.37.0
> 
> 

-- 
மணிவண்ணன் சதாசிவம்

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

* Re: [PATCH v5] bus: mhi: host: make mhi_controller_config::event_cfg const
  2022-08-30 17:11   ` [PATCH v5] " Jeff Johnson
  2022-08-31  8:13     ` Manivannan Sadhasivam
@ 2022-09-07  8:00     ` Manivannan Sadhasivam
  2022-11-08 13:33       ` Kalle Valo
  1 sibling, 1 reply; 16+ messages in thread
From: Manivannan Sadhasivam @ 2022-09-07  8:00 UTC (permalink / raw)
  To: Jeff Johnson; +Cc: Hemant Kumar, linux-arm-msm, mhi

On Tue, Aug 30, 2022 at 10:11:47AM -0700, Jeff Johnson wrote:
> Currently the event_cfg pointer in struct mhi_controller_config is not
> defined as a const pointer. This prevents clients from registering a
> read-only configuration unless they use a typecast. Since the
> event_cfg should not be modified once registered, add the const
> qualifier to event_cfg. This is aligned with the definition of ch_cfg.
> 
> Signed-off-by: Jeff Johnson <quic_jjohnson@quicinc.com>

Applied to mhi-next!

Thanks,
Mani

> ---
> v5:	corrected mhi_foxconn_sdx55_events[]
> 
> v4:	updated subject, rebased to v6.0-rc3
> 
> v3:	added pci_generic.c change
> 
> v2:	added S-O-B
> 
>  drivers/bus/mhi/host/pci_generic.c | 14 +++++++-------
>  include/linux/mhi.h                |  2 +-
>  2 files changed, 8 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/bus/mhi/host/pci_generic.c b/drivers/bus/mhi/host/pci_generic.c
> index 9e545f2a5a26..0db437ac3ba4 100644
> --- a/drivers/bus/mhi/host/pci_generic.c
> +++ b/drivers/bus/mhi/host/pci_generic.c
> @@ -238,7 +238,7 @@ static const struct mhi_channel_config modem_qcom_v1_mhi_channels[] = {
>  	MHI_CHANNEL_CONFIG_HW_DL(101, "IP_HW0", 128, 3),
>  };
>  
> -static struct mhi_event_config modem_qcom_v1_mhi_events[] = {
> +static const struct mhi_event_config modem_qcom_v1_mhi_events[] = {
>  	/* first ring is control+data ring */
>  	MHI_EVENT_CONFIG_CTRL(0, 64),
>  	/* DIAG dedicated event ring */
> @@ -305,7 +305,7 @@ static const struct mhi_channel_config mhi_quectel_em1xx_channels[] = {
>  	MHI_CHANNEL_CONFIG_HW_DL(101, "IP_HW0_MBIM", 128, 3),
>  };
>  
> -static struct mhi_event_config mhi_quectel_em1xx_events[] = {
> +static const struct mhi_event_config mhi_quectel_em1xx_events[] = {
>  	MHI_EVENT_CONFIG_CTRL(0, 128),
>  	MHI_EVENT_CONFIG_DATA(1, 128),
>  	MHI_EVENT_CONFIG_HW_DATA(2, 1024, 100),
> @@ -344,7 +344,7 @@ static const struct mhi_channel_config mhi_foxconn_sdx55_channels[] = {
>  	MHI_CHANNEL_CONFIG_HW_DL(101, "IP_HW0_MBIM", 128, 3),
>  };
>  
> -static struct mhi_event_config mhi_foxconn_sdx55_events[] = {
> +static const struct mhi_event_config mhi_foxconn_sdx55_events[] = {
>  	MHI_EVENT_CONFIG_CTRL(0, 128),
>  	MHI_EVENT_CONFIG_DATA(1, 128),
>  	MHI_EVENT_CONFIG_HW_DATA(2, 1024, 100),
> @@ -391,7 +391,7 @@ static const struct mhi_channel_config mhi_mv3x_channels[] = {
>  	MHI_CHANNEL_CONFIG_HW_DL(101, "IP_HW0_MBIM", 512, 3),
>  };
>  
> -static struct mhi_event_config mhi_mv3x_events[] = {
> +static const struct mhi_event_config mhi_mv3x_events[] = {
>  	MHI_EVENT_CONFIG_CTRL(0, 256),
>  	MHI_EVENT_CONFIG_DATA(1, 256),
>  	MHI_EVENT_CONFIG_HW_DATA(2, 1024, 100),
> @@ -438,7 +438,7 @@ static const struct mhi_channel_config mhi_sierra_em919x_channels[] = {
>  	MHI_CHANNEL_CONFIG_HW_DL(101, "IP_HW0", 512, 2),
>  };
>  
> -static struct mhi_event_config modem_sierra_em919x_mhi_events[] = {
> +static const struct mhi_event_config modem_sierra_em919x_mhi_events[] = {
>  	/* first ring is control+data and DIAG ring */
>  	MHI_EVENT_CONFIG_CTRL(0, 2048),
>  	/* Hardware channels request dedicated hardware event rings */
> @@ -472,7 +472,7 @@ static const struct mhi_channel_config mhi_telit_fn980_hw_v1_channels[] = {
>  	MHI_CHANNEL_CONFIG_HW_DL(101, "IP_HW0", 128, 2),
>  };
>  
> -static struct mhi_event_config mhi_telit_fn980_hw_v1_events[] = {
> +static const struct mhi_event_config mhi_telit_fn980_hw_v1_events[] = {
>  	MHI_EVENT_CONFIG_CTRL(0, 128),
>  	MHI_EVENT_CONFIG_HW_DATA(1, 1024, 100),
>  	MHI_EVENT_CONFIG_HW_DATA(2, 2048, 101)
> @@ -511,7 +511,7 @@ static const struct mhi_channel_config mhi_telit_fn990_channels[] = {
>  	MHI_CHANNEL_CONFIG_HW_DL(101, "IP_HW0_MBIM", 128, 3),
>  };
>  
> -static struct mhi_event_config mhi_telit_fn990_events[] = {
> +static const struct mhi_event_config mhi_telit_fn990_events[] = {
>  	MHI_EVENT_CONFIG_CTRL(0, 128),
>  	MHI_EVENT_CONFIG_DATA(1, 128),
>  	MHI_EVENT_CONFIG_HW_DATA(2, 1024, 100),
> diff --git a/include/linux/mhi.h b/include/linux/mhi.h
> index a5441ad33c74..ada2f18af4d6 100644
> --- a/include/linux/mhi.h
> +++ b/include/linux/mhi.h
> @@ -281,7 +281,7 @@ struct mhi_controller_config {
>  	u32 num_channels;
>  	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;
>  };
> -- 
> 2.37.0
> 
> 

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

* Re: [PATCH v5] bus: mhi: host: make mhi_controller_config::event_cfg const
  2022-09-07  8:00     ` Manivannan Sadhasivam
@ 2022-11-08 13:33       ` Kalle Valo
  2022-11-08 14:39         ` Manivannan Sadhasivam
  0 siblings, 1 reply; 16+ messages in thread
From: Kalle Valo @ 2022-11-08 13:33 UTC (permalink / raw)
  To: Manivannan Sadhasivam; +Cc: Jeff Johnson, Hemant Kumar, linux-arm-msm, mhi

Manivannan Sadhasivam <mani@kernel.org> writes:

> On Tue, Aug 30, 2022 at 10:11:47AM -0700, Jeff Johnson wrote:
>> Currently the event_cfg pointer in struct mhi_controller_config is not
>> defined as a const pointer. This prevents clients from registering a
>> read-only configuration unless they use a typecast. Since the
>> event_cfg should not be modified once registered, add the const
>> qualifier to event_cfg. This is aligned with the definition of ch_cfg.
>> 
>> Signed-off-by: Jeff Johnson <quic_jjohnson@quicinc.com>
>
> Applied to mhi-next!

BTW what happened to this patch? I cannot find it anywhere.

-- 
https://patchwork.kernel.org/project/linux-wireless/list/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches

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

* Re: [PATCH v5] bus: mhi: host: make mhi_controller_config::event_cfg const
  2022-11-08 13:33       ` Kalle Valo
@ 2022-11-08 14:39         ` Manivannan Sadhasivam
  2022-11-08 14:58           ` Kalle Valo
  2022-11-09  7:45           ` Manivannan Sadhasivam
  0 siblings, 2 replies; 16+ messages in thread
From: Manivannan Sadhasivam @ 2022-11-08 14:39 UTC (permalink / raw)
  To: Kalle Valo; +Cc: Jeff Johnson, Hemant Kumar, linux-arm-msm, mhi

On Tue, Nov 08, 2022 at 03:33:35PM +0200, Kalle Valo wrote:
> Manivannan Sadhasivam <mani@kernel.org> writes:
> 
> > On Tue, Aug 30, 2022 at 10:11:47AM -0700, Jeff Johnson wrote:
> >> Currently the event_cfg pointer in struct mhi_controller_config is not
> >> defined as a const pointer. This prevents clients from registering a
> >> read-only configuration unless they use a typecast. Since the
> >> event_cfg should not be modified once registered, add the const
> >> qualifier to event_cfg. This is aligned with the definition of ch_cfg.
> >> 
> >> Signed-off-by: Jeff Johnson <quic_jjohnson@quicinc.com>
> >
> > Applied to mhi-next!
> 
> BTW what happened to this patch? I cannot find it anywhere.
> 

Sorry! I did apply this patch earlier locally but didn't push it to
remote. So it got lost.

Now pushed! Thanks for spotting.

> -- 
> https://patchwork.kernel.org/project/linux-wireless/list/
> 
> https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
> 

-- 
மணிவண்ணன் சதாசிவம்

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

* Re: [PATCH v5] bus: mhi: host: make mhi_controller_config::event_cfg const
  2022-11-08 14:39         ` Manivannan Sadhasivam
@ 2022-11-08 14:58           ` Kalle Valo
  2022-11-09  7:45           ` Manivannan Sadhasivam
  1 sibling, 0 replies; 16+ messages in thread
From: Kalle Valo @ 2022-11-08 14:58 UTC (permalink / raw)
  To: Manivannan Sadhasivam; +Cc: Jeff Johnson, Hemant Kumar, linux-arm-msm, mhi

Manivannan Sadhasivam <mani@kernel.org> writes:

> On Tue, Nov 08, 2022 at 03:33:35PM +0200, Kalle Valo wrote:
>> Manivannan Sadhasivam <mani@kernel.org> writes:
>> 
>> > On Tue, Aug 30, 2022 at 10:11:47AM -0700, Jeff Johnson wrote:
>> >> Currently the event_cfg pointer in struct mhi_controller_config is not
>> >> defined as a const pointer. This prevents clients from registering a
>> >> read-only configuration unless they use a typecast. Since the
>> >> event_cfg should not be modified once registered, add the const
>> >> qualifier to event_cfg. This is aligned with the definition of ch_cfg.
>> >> 
>> >> Signed-off-by: Jeff Johnson <quic_jjohnson@quicinc.com>
>> >
>> > Applied to mhi-next!
>> 
>> BTW what happened to this patch? I cannot find it anywhere.
>> 
>
> Sorry! I did apply this patch earlier locally but didn't push it to
> remote. So it got lost.
>
> Now pushed! Thanks for spotting.

Great, thanks Mani.

-- 
https://patchwork.kernel.org/project/linux-wireless/list/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches

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

* Re: [PATCH v5] bus: mhi: host: make mhi_controller_config::event_cfg const
  2022-11-08 14:39         ` Manivannan Sadhasivam
  2022-11-08 14:58           ` Kalle Valo
@ 2022-11-09  7:45           ` Manivannan Sadhasivam
  2022-11-09 15:26             ` Jeff Johnson
  1 sibling, 1 reply; 16+ messages in thread
From: Manivannan Sadhasivam @ 2022-11-09  7:45 UTC (permalink / raw)
  To: Kalle Valo; +Cc: Jeff Johnson, Hemant Kumar, linux-arm-msm, mhi

On Tue, Nov 08, 2022 at 08:09:02PM +0530, Manivannan Sadhasivam wrote:
> On Tue, Nov 08, 2022 at 03:33:35PM +0200, Kalle Valo wrote:
> > Manivannan Sadhasivam <mani@kernel.org> writes:
> > 
> > > On Tue, Aug 30, 2022 at 10:11:47AM -0700, Jeff Johnson wrote:
> > >> Currently the event_cfg pointer in struct mhi_controller_config is not
> > >> defined as a const pointer. This prevents clients from registering a
> > >> read-only configuration unless they use a typecast. Since the
> > >> event_cfg should not be modified once registered, add the const
> > >> qualifier to event_cfg. This is aligned with the definition of ch_cfg.
> > >> 
> > >> Signed-off-by: Jeff Johnson <quic_jjohnson@quicinc.com>
> > >
> > > Applied to mhi-next!
> > 
> > BTW what happened to this patch? I cannot find it anywhere.
> > 
> 
> Sorry! I did apply this patch earlier locally but didn't push it to
> remote. So it got lost.
> 
> Now pushed! Thanks for spotting.
> 

Dropped the patch now because of this: https://lore.kernel.org/lkml/20221109151637.67be60f8@canb.auug.org.au/

Since we need to modify event_cfg for using the shared IRQ, I don't think the
patch is applicable. Maybe that's the reason I dropped it earlier also, but
forgot to share it in mailing list.

Thanks,
Mani

> > -- 
> > https://patchwork.kernel.org/project/linux-wireless/list/
> > 
> > https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
> > 
> 
> -- 
> மணிவண்ணன் சதாசிவம்
> 

-- 
மணிவண்ணன் சதாசிவம்

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

* Re: [PATCH v5] bus: mhi: host: make mhi_controller_config::event_cfg const
  2022-11-09  7:45           ` Manivannan Sadhasivam
@ 2022-11-09 15:26             ` Jeff Johnson
  0 siblings, 0 replies; 16+ messages in thread
From: Jeff Johnson @ 2022-11-09 15:26 UTC (permalink / raw)
  To: Manivannan Sadhasivam, Kalle Valo; +Cc: Hemant Kumar, linux-arm-msm, mhi

On 11/8/2022 11:45 PM, Manivannan Sadhasivam wrote:
> Dropped the patch now because of this: https://lore.kernel.org/lkml/20221109151637.67be60f8@canb.auug.org.au/
> 
> Since we need to modify event_cfg for using the shared IRQ, I don't think the
> patch is applicable. Maybe that's the reason I dropped it earlier also, but
> forgot to share it in mailing list.
> 
> Thanks,
> Mani

yes, that was the reason it was dropped before.
Perhaps this code can be revisited so that the event_cfg doesn't need to 
be modified for this one case, but I personally don't have time for that 
now.


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

end of thread, other threads:[~2022-11-09 15:26 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-19 21:02 [PATCH v3] bus: mhi: make mhi_controller_config::event_cfg const Jeff Johnson
2022-08-19 21:08 ` Jeffrey Hugo
2022-08-19 21:15   ` Jeff Johnson
2022-08-27 18:43     ` Jeff Johnson
2022-08-29 17:31 ` Manivannan Sadhasivam
2022-08-29 20:51 ` [PATCH v4] bus: mhi: host: " Jeff Johnson
2022-08-30  7:46   ` Manivannan Sadhasivam
2022-08-30 17:12     ` Jeff Johnson
2022-08-30 17:11   ` [PATCH v5] " Jeff Johnson
2022-08-31  8:13     ` Manivannan Sadhasivam
2022-09-07  8:00     ` Manivannan Sadhasivam
2022-11-08 13:33       ` Kalle Valo
2022-11-08 14:39         ` Manivannan Sadhasivam
2022-11-08 14:58           ` Kalle Valo
2022-11-09  7:45           ` Manivannan Sadhasivam
2022-11-09 15:26             ` Jeff Johnson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).