]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
samples: qmi: Constify static qmi ops
authorRikard Falkeborn <rikard.falkeborn@gmail.com>
Tue, 24 Nov 2020 21:29:54 +0000 (22:29 +0100)
committerBjorn Andersson <bjorn.andersson@linaro.org>
Tue, 24 Nov 2020 23:08:47 +0000 (17:08 -0600)
The only usage of qmi_sample_handlers[] and lookup_ops is to pass their
addresses 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>
Link: https://lore.kernel.org/r/20201124212954.17750-1-rikard.falkeborn@gmail.com
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
samples/qmi/qmi_sample_client.c

index c9e7276c3d83b02748fd5cb9c047f95cd95755b3..78fcedbd25e2634ecd77d3970b449da07fab5c30 100644 (file)
@@ -429,7 +429,7 @@ static const struct file_operations data_fops = {
        .write = data_write,
 };
 
-static struct qmi_msg_handler qmi_sample_handlers[] = {
+static const struct qmi_msg_handler qmi_sample_handlers[] = {
        {
                .type = QMI_RESPONSE,
                .msg_id = TEST_PING_REQ_MSG_ID_V01,
@@ -571,7 +571,7 @@ static void qmi_sample_del_server(struct qmi_handle *qmi,
 
 static struct qmi_handle lookup_client;
 
-static struct qmi_ops lookup_ops = {
+static const struct qmi_ops lookup_ops = {
        .new_server = qmi_sample_new_server,
        .del_server = qmi_sample_del_server,
 };