Message ID | 20201122234031.33432-2-rikard.falkeborn@gmail.com (mailing list archive) |
---|---|
State | Accepted |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | net: Constify static qmi structs | expand |
Context | Check | Description |
---|---|---|
netdev/cover_letter | success | Link |
netdev/fixes_present | success | Link |
netdev/patch_count | success | Link |
netdev/tree_selection | success | Clearly marked for net-next |
netdev/subject_prefix | success | Link |
netdev/source_inline | success | Was 0 now: 0 |
netdev/verify_signedoff | success | Link |
netdev/module_param | success | Was 0 now: 0 |
netdev/build_32bit | success | Errors and warnings before: 0 this patch: 0 |
netdev/kdoc | success | Errors and warnings before: 0 this patch: 0 |
netdev/verify_fixes | success | Link |
netdev/checkpatch | success | total: 0 errors, 0 warnings, 0 checks, 32 lines checked |
netdev/build_allmodconfig_warn | success | Errors and warnings before: 0 this patch: 0 |
netdev/header_inline | success | Link |
netdev/stable | success | Stable not CCed |
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. > > Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com> I can take this one if Alex acks it. The other patch is probably best handled by Kalle.
Jakub Kicinski <kuba@kernel.org> writes: > 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. >> >> Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com> > > 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.
On 11/22/20 5:40 PM, 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. > > Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com> Good idea. Thanks a lot. Acked-by: Alex Elder <elder@linaro.org> > --- > drivers/net/ipa/ipa_qmi.c | 8 ++++---- > 1 file changed, 4 insertions(+), 4 deletions(-) > > diff --git a/drivers/net/ipa/ipa_qmi.c b/drivers/net/ipa/ipa_qmi.c > index 5090f0f923ad..d2c3f273c233 100644 > --- a/drivers/net/ipa/ipa_qmi.c > +++ b/drivers/net/ipa/ipa_qmi.c > @@ -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, > }; > >
On Wed, 25 Nov 2020 15:45:05 -0600 Alex Elder wrote: > On 11/22/20 5:40 PM, 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. > > > > Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com> > > Acked-by: Alex Elder <elder@linaro.org> Applied to net-next, thanks!
diff --git a/drivers/net/ipa/ipa_qmi.c b/drivers/net/ipa/ipa_qmi.c index 5090f0f923ad..d2c3f273c233 100644 --- a/drivers/net/ipa/ipa_qmi.c +++ b/drivers/net/ipa/ipa_qmi.c @@ -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, };
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. Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com> --- drivers/net/ipa/ipa_qmi.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)