Skip to content

Commit

Permalink
samples: qmi: Constify static qmi ops
Browse files Browse the repository at this point in the history
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 <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Bjorn Andersson <[email protected]>
  • Loading branch information
rikardfalkeborn authored and andersson committed Nov 24, 2020
1 parent 0af104d commit bfc1b65
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions samples/qmi/qmi_sample_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
};
Expand Down

0 comments on commit bfc1b65

Please sign in to comment.