bus: mhi: core: Add const qualifier to MHI config information
Subsystems (2)
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH 1/1 bus: mhi: core: Add const qualifier to MHI config information
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.
--- drivers/bus/mhi/core/init.c | 12 ++++++------ include/linux/mhi.h | 6 +++--- 2 files changed, 9 insertions(+), 9 deletions(-)
drivers/bus/mhi/core/init.c +6 -6
@@ -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;
include/linux/mhi.h +3 -3
@@ -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
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project
Quoted 7 lines · 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 <[email protected]>Signed-off-by Hemant Kumar <[email protected]>
Thanks,
Mani
Quoted 81 lines
--- drivers/bus/mhi/core/init.c | 12 ++++++------ include/linux/mhi.h | 6 +++--- 2 files changed, 9 insertions(+), 9 deletions(-)drivers/bus/mhi/core/init.c +6
-6@@ -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;include/linux/mhi.h +3
-3@@ -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 Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project
Manivannan Sadhasivam
AppliedQuoted 7 lines · 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 <[email protected]>Signed-off-by Hemant Kumar <[email protected]>
Applied to mhi-next!
Thanks,
Mani
Quoted 81 lines
--- drivers/bus/mhi/core/init.c | 12 ++++++------ include/linux/mhi.h | 6 +++--- 2 files changed, 9 insertions(+), 9 deletions(-)drivers/bus/mhi/core/init.c +6
-6@@ -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;include/linux/mhi.h +3
-3@@ -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 Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project