Skip to contentSkip to conversation

net: Constify static qmi structs

PATCH Applied Rikard Falkeborn 4 participants 9 messages Nov 22, 2020 – Dec 2, 2020

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

cover net: Constify static qmi structs

Constify a couple of static qmi_ops and qmi_msg_handler structs that are never modified.

Rikard Falkeborn (2):
soc: qcom: ipa: Constify static qmi structs
ath10k: Constify static qmi structs

 drivers/net/ipa/ipa_qmi.c             | 8 ++++----
 drivers/net/wireless/ath/ath10k/qmi.c | 4 ++--
 2 files changed, 6 insertions(+), 6 deletions(-)
Signature · 1 line
2.29.2
#1 lore raw

PATCH 1/2 soc: qcom: ipa: Constify static qmi structs

These are only used as input arguments to qmi_handle_init() which accepts const pointers to both qmi_ops and qmi_msg_handler. Make them const to allow the compiler to put them in read-only memory.

---
 drivers/net/ipa/ipa_qmi.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/net/ipa/ipa_qmi.c +4 -4
index 5090f0f923ad..d2c3f273c233 100644
@@ -168,7 +168,7 @@ static void ipa_server_bye(struct qmi_handle *qmi, unsigned int node)
 	ipa_qmi->indication_sent = false;
 }
 
-static struct qmi_ops ipa_server_ops = {
+static const struct qmi_ops ipa_server_ops = {
 	.bye		= ipa_server_bye,
 };
 
@@ -234,7 +234,7 @@ static void ipa_server_driver_init_complete(struct qmi_handle *qmi,
 }
 
 /* The server handles two request message types sent by the modem. */
-static struct qmi_msg_handler ipa_server_msg_handlers[] = {
+static const struct qmi_msg_handler ipa_server_msg_handlers[] = {
 	{
 		.type		= QMI_REQUEST,
 		.msg_id		= IPA_QMI_INDICATION_REGISTER,
@@ -261,7 +261,7 @@ static void ipa_client_init_driver(struct qmi_handle *qmi,
 }
 
 /* The client handles one response message type sent by the modem. */
-static struct qmi_msg_handler ipa_client_msg_handlers[] = {
+static const struct qmi_msg_handler ipa_client_msg_handlers[] = {
 	{
 		.type		= QMI_RESPONSE,
 		.msg_id		= IPA_QMI_INIT_DRIVER,
@@ -463,7 +463,7 @@ ipa_client_new_server(struct qmi_handle *qmi, struct qmi_service *svc)
 	return 0;
 }
 
-static struct qmi_ops ipa_client_ops = {
+static const struct qmi_ops ipa_client_ops = {
 	.new_server	= ipa_client_new_server,
 };
 
Signature · 7 lines
2.29.2


_______________________________________________
ath10k mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/ath10k
maintainer
#2 lore raw

Re: [PATCH net-next 1/2] soc: qcom: ipa: Constify static qmi structs

Quoted 5 lines · On Mon, 23 Nov 2020 00:40:30 +0100 Rikard Falkeborn wrote:

These are only used as input arguments to qmi_handle_init() which accepts const pointers to both qmi_ops and qmi_msg_handler. Make them const to allow the compiler to put them in read-only memory.

I can take this one if Alex acks it.

The other patch is probably best handled by Kalle.

_______________________________________________
ath10k mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/ath10k

#3 lore raw

Re: [PATCH net-next 1/2] soc: qcom: ipa: Constify static qmi structs

Quoted 10 lines · Jakub Kicinski
Quoted 5 lines · On Mon, 23 Nov 2020 00:40:30 +0100 Rikard Falkeborn wrote:

These are only used as input arguments to qmi_handle_init() which accepts const pointers to both qmi_ops and qmi_msg_handler. Make them const to allow the compiler to put them in read-only memory.

I can take this one if Alex acks it.

The other patch is probably best handled by Kalle.

Yes, patch 2 is in my queue.

Signature · 8 lines
https://patchwork.kernel.org/project/linux-wireless/list/

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

_______________________________________________
ath10k mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/ath10k
Acked-by on v1 1/2
#4 lore raw

Re: [PATCH net-next 1/2] soc: qcom: ipa: Constify static qmi structs

In reply to Rikard Falkeborn
Quoted 5 lines · Rikard Falkeborn

These are only used as input arguments to qmi_handle_init() which accepts const pointers to both qmi_ops and qmi_msg_handler. Make them const to allow the compiler to put them in read-only memory.

Good idea. Thanks a lot.

Quoted 45 lines
---
  drivers/net/ipa/ipa_qmi.c | 8 ++++----
  1 file changed, 4 insertions(+), 4 deletions(-)
drivers/net/ipa/ipa_qmi.c +4 -4
index 5090f0f923ad..d2c3f273c233 100644
@@ -168,7 +168,7 @@ static void ipa_server_bye(struct qmi_handle *qmi, unsigned int node)
  	ipa_qmi->indication_sent = false;
  }
 
-static struct qmi_ops ipa_server_ops = {
+static const struct qmi_ops ipa_server_ops = {
  	.bye		= ipa_server_bye,
  };
 
@@ -234,7 +234,7 @@ static void ipa_server_driver_init_complete(struct qmi_handle *qmi,
  }
 
  /* The server handles two request message types sent by the modem. */
-static struct qmi_msg_handler ipa_server_msg_handlers[] = {
+static const struct qmi_msg_handler ipa_server_msg_handlers[] = {
  	{
  		.type		= QMI_REQUEST,
  		.msg_id		= IPA_QMI_INDICATION_REGISTER,
@@ -261,7 +261,7 @@ static void ipa_client_init_driver(struct qmi_handle *qmi,
  }
 
  /* The client handles one response message type sent by the modem. */
-static struct qmi_msg_handler ipa_client_msg_handlers[] = {
+static const struct qmi_msg_handler ipa_client_msg_handlers[] = {
  	{
  		.type		= QMI_RESPONSE,
  		.msg_id		= IPA_QMI_INIT_DRIVER,
@@ -463,7 +463,7 @@ ipa_client_new_server(struct qmi_handle *qmi, struct qmi_service *svc)
  	return 0;
  }
 
-static struct qmi_ops ipa_client_ops = {
+static const struct qmi_ops ipa_client_ops = {
  	.new_server	= ipa_client_new_server,
  };
 
maintainer Applied
#5 lore raw

Re: [PATCH net-next 1/2] soc: qcom: ipa: Constify static qmi structs

Quoted 8 lines · On Wed, 25 Nov 2020 15:45:05 -0600 Alex Elder wrote:
Quoted 5 lines · Rikard Falkeborn

These are only used as input arguments to qmi_handle_init() which accepts const pointers to both qmi_ops and qmi_msg_handler. Make them const to allow the compiler to put them in read-only memory.

Applied to net-next, thanks!

_______________________________________________
ath10k mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/ath10k

#6 lore raw

PATCH 2/2 ath10k: Constify static qmi structs

In reply to Rikard Falkeborn

qmi_msg_handler[] and ath10k_qmi_ops are only used as input arguments to qmi_handle_init() which accepts const pointers to both qmi_ops and qmi_msg_handler. Make them const to allow the compiler to put them in read-only memory.

---
 drivers/net/wireless/ath/ath10k/qmi.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/wireless/ath/ath10k/qmi.c +2 -2
index ae6b1f402adf..07e478f9a808 100644
@@ -917,7 +917,7 @@ static void ath10k_qmi_msa_ready_ind(struct qmi_handle *qmi_hdl,
 	ath10k_qmi_driver_event_post(qmi, ATH10K_QMI_EVENT_MSA_READY_IND, NULL);
 }
 
-static struct qmi_msg_handler qmi_msg_handler[] = {
+static const struct qmi_msg_handler qmi_msg_handler[] = {
 	{
 		.type = QMI_INDICATION,
 		.msg_id = QMI_WLFW_FW_READY_IND_V01,
@@ -981,7 +981,7 @@ static void ath10k_qmi_del_server(struct qmi_handle *qmi_hdl,
 					     NULL);
 }
 
-static struct qmi_ops ath10k_qmi_ops = {
+static const struct qmi_ops ath10k_qmi_ops = {
 	.new_server = ath10k_qmi_new_server,
 	.del_server = ath10k_qmi_del_server,
 };
Signature · 7 lines
2.29.2


_______________________________________________
ath10k mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/ath10k
#7 lore raw

Re: [PATCH net-next 2/2] ath10k: Constify static qmi structs

Quoted 7 lines · Rikard Falkeborn

qmi_msg_handler[] and ath10k_qmi_ops are only used as input arguments to qmi_handle_init() which accepts const pointers to both qmi_ops and qmi_msg_handler. Make them const to allow the compiler to put them in read-only memory.

Patch applied to ath-next branch of ath.git, thanks.

ad37a46e8cb5 ath10k: Constify static qmi structs

Signature · 9 lines
https://patchwork.kernel.org/project/linux-wireless/patch/[email protected]/

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


_______________________________________________
ath10k mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/ath10k
#8 lore raw

Re: [PATCH net-next 2/2] ath10k: Constify static qmi structs

In reply to Rikard Falkeborn
Quoted 7 lines · Rikard Falkeborn

qmi_msg_handler[] and ath10k_qmi_ops are only used as input arguments to qmi_handle_init() which accepts const pointers to both qmi_ops and qmi_msg_handler. Make them const to allow the compiler to put them in read-only memory.

Patch applied to ath-next branch of ath.git, thanks.

ad37a46e8cb5 ath10k: Constify static qmi structs

Signature · 3 lines
https://patchwork.kernel.org/project/linux-wireless/patch/[email protected]/

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