forked from ~ljy/RK356X_SDK_RELEASE

hc
2023-12-09 b22da3d8526a935aa31e086e63f60ff3246cb61c
kernel/drivers/firmware/arm_scmi/mailbox.c
....@@ -110,7 +110,7 @@
110110 struct scmi_chan_info *cinfo = p;
111111 struct scmi_mailbox *smbox = cinfo->transport_info;
112112
113
- if (!IS_ERR(smbox->chan)) {
113
+ if (smbox && !IS_ERR(smbox->chan)) {
114114 mbox_free_channel(smbox->chan);
115115 cinfo->transport_info = NULL;
116116 smbox->chan = NULL;
....@@ -158,6 +158,21 @@
158158 shmem_fetch_response(smbox->shmem, xfer);
159159 }
160160
161
+static void mailbox_fetch_notification(struct scmi_chan_info *cinfo,
162
+ size_t max_len, struct scmi_xfer *xfer)
163
+{
164
+ struct scmi_mailbox *smbox = cinfo->transport_info;
165
+
166
+ shmem_fetch_notification(smbox->shmem, max_len, xfer);
167
+}
168
+
169
+static void mailbox_clear_channel(struct scmi_chan_info *cinfo)
170
+{
171
+ struct scmi_mailbox *smbox = cinfo->transport_info;
172
+
173
+ shmem_clear_channel(smbox->shmem);
174
+}
175
+
161176 static bool
162177 mailbox_poll_done(struct scmi_chan_info *cinfo, struct scmi_xfer *xfer)
163178 {
....@@ -166,13 +181,15 @@
166181 return shmem_poll_done(smbox->shmem, xfer);
167182 }
168183
169
-static struct scmi_transport_ops scmi_mailbox_ops = {
184
+static const struct scmi_transport_ops scmi_mailbox_ops = {
170185 .chan_available = mailbox_chan_available,
171186 .chan_setup = mailbox_chan_setup,
172187 .chan_free = mailbox_chan_free,
173188 .send_message = mailbox_send_message,
174189 .mark_txdone = mailbox_mark_txdone,
175190 .fetch_response = mailbox_fetch_response,
191
+ .fetch_notification = mailbox_fetch_notification,
192
+ .clear_channel = mailbox_clear_channel,
176193 .poll_done = mailbox_poll_done,
177194 };
178195