Skip to content

Commit bfc1b65

Browse files
rikardfalkebornandersson
authored andcommitted
samples: qmi: Constify static qmi ops
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>
1 parent 0af104d commit bfc1b65

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

‎samples/qmi/qmi_sample_client.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,7 @@ static const struct file_operations data_fops = {
429429
.write = data_write,
430430
};
431431

432-
static struct qmi_msg_handler qmi_sample_handlers[] = {
432+
static const struct qmi_msg_handler qmi_sample_handlers[] = {
433433
{
434434
.type = QMI_RESPONSE,
435435
.msg_id = TEST_PING_REQ_MSG_ID_V01,
@@ -571,7 +571,7 @@ static void qmi_sample_del_server(struct qmi_handle *qmi,
571571

572572
static struct qmi_handle lookup_client;
573573

574-
static struct qmi_ops lookup_ops = {
574+
static const struct qmi_ops lookup_ops = {
575575
.new_server = qmi_sample_new_server,
576576
.del_server = qmi_sample_del_server,
577577
};

0 commit comments

Comments
 (0)