Skip to contentSkip to conversation

mailbox: Prototype mbox_client_peek_data()

PATCH New Mark Brown 1 participant 2 messages Jun 13, 2014 Mailbox API

lore
Share & tools
lore

Mark Brown

author
#0 lore raw

PATCH 1/2 mailbox: Prototype mbox_client_peek_data()

From: Mark Brown <[email protected]>

This is an interface intended for client drivers and exported but it is not prototyped in the headers so can't be used. Add a prototype.

---
 include/linux/mailbox_client.h | 1 +
 1 file changed, 1 insertion(+)
include/linux/mailbox_client.h +1 -0
index 53eb0784261b..cbfcf8478ca9 100644
@@ -40,6 +40,7 @@ struct mbox_client {
 struct mbox_chan *mbox_request_channel(const struct mbox_client *cl);
 int mbox_send_message(struct mbox_chan *chan, void *mssg);
 void mbox_client_txdone(struct mbox_chan *chan, int r);
+bool mbox_client_peek_data(struct mbox_chan *chan);
 void mbox_free_channel(struct mbox_chan *chan);
 
 #endif /* __MAILBOX_CLIENT_H */
Signature · 1 line
2.0.0
author
#1 lore raw

PATCH 2/2 mailbox: Remove const from client argument of mbox_request_channel()

From: Mark Brown <[email protected]>

The struct mbox_client supplied to mbox_request_channel() is const but it is stored in the channel in a non-constant member causing compiler warnings.

While the mailbox API should treat the struct mailbox_client as const itself the struct is passed back to the channel in callbacks without a const so we need to either remove the const, change the callbacks to take const or cast the const away when doing callbacks. Take the simplest option and just remove the const.

---
 drivers/mailbox/mailbox.c      | 2 +-
 include/linux/mailbox_client.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/mailbox/mailbox.c +1 -1
index ae4abd9f7513..662f8e550473 100644
@@ -294,7 +294,7 @@ EXPORT_SYMBOL_GPL(mbox_send_message);
  * Return: Pointer to the channel assigned to the client if successful.
  *		ERR_PTR for request failure.
  */
-struct mbox_chan *mbox_request_channel(const struct mbox_client *cl)
+struct mbox_chan *mbox_request_channel(struct mbox_client *cl)
 {
 	struct device *dev = cl->dev;
 	struct mbox_controller *mbox;
include/linux/mailbox_client.h +1 -1
index cbfcf8478ca9..955f3d7641e8 100644
@@ -37,7 +37,7 @@ struct mbox_client {
 	bool knows_txdone;
 };
 
-struct mbox_chan *mbox_request_channel(const struct mbox_client *cl);
+struct mbox_chan *mbox_request_channel(struct mbox_client *cl);
 int mbox_send_message(struct mbox_chan *chan, void *mssg);
 void mbox_client_txdone(struct mbox_chan *chan, int r);
 bool mbox_client_peek_data(struct mbox_chan *chan);
Signature · 1 line
2.0.0