* [RESEND PATCH] mailbox: Add dummy mailbox API implementation
@ 2020-03-19 17:49 Daniel Baluta
2020-03-19 17:57 ` Randy Dunlap
0 siblings, 1 reply; 2+ messages in thread
From: Daniel Baluta @ 2020-03-19 17:49 UTC (permalink / raw)
To: rdunlap, jassisinghbrar
Cc: leonard.crestez, aisheng.dong, linux-imx, linux-kernel, peng.fan,
Daniel Baluta
From: Daniel Baluta <daniel.baluta@nxp.com>
There are users of mailbox API that could be enabled
via COMPILE_TEST without select CONFIG_MAILBOX.
In such cases we got compilation errors, like these:
ld: drivers/firmware/imx/imx-scu.o: in function `imx_scu_probe':
imx-scu.c:(.text+0x25e): undefined reference to
`mbox_request_channel_byname'
ld: drivers/firmware/imx/imx-scu.o: in function `imx_scu_call_rpc':
imx-scu.c:(.text+0x4b8): undefined reference to `mbox_send_message'
ld: drivers/firmware/imx/imx-scu-irq.o: in function
`imx_scu_enable_general_irq_channel':
imx-scu-irq.c:(.text+0x34d): undefined reference to
`mbox_request_channel_byname'
Fix this by implementing dummy mailbox API when CONFIG_MAILBOX is not
set.
Reported-by: Randy Dunlap <rdunlap@infradead.org>
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
---
resend adding Jassi's email
include/linux/mailbox_client.h | 34 ++++++++++++++++++++++++++++++++++
1 file changed, 34 insertions(+)
diff --git a/include/linux/mailbox_client.h b/include/linux/mailbox_client.h
index 65229a45590f..ab5d130f0b5c 100644
--- a/include/linux/mailbox_client.h
+++ b/include/linux/mailbox_client.h
@@ -37,6 +37,7 @@ struct mbox_client {
void (*tx_done)(struct mbox_client *cl, void *mssg, int r);
};
+#ifdef CONFIG_MAILBOX
struct mbox_chan *mbox_request_channel_byname(struct mbox_client *cl,
const char *name);
struct mbox_chan *mbox_request_channel(struct mbox_client *cl, int index);
@@ -46,4 +47,37 @@ void mbox_client_txdone(struct mbox_chan *chan, int r); /* atomic */
bool mbox_client_peek_data(struct mbox_chan *chan); /* atomic */
void mbox_free_channel(struct mbox_chan *chan); /* may sleep */
+#else
+static inline
+struct mbox_chan *mbox_request_channel_byname(struct mbox_client *cl,
+ const char *name)
+{
+ return ERR_PTR(-ENOTSUPP);
+}
+
+static inline
+struct mbox_chan *mbox_request_channel(struct mbox_client *cl, int index)
+{
+ return ERR_PTR(-ENOTSUPP);
+}
+
+static inline int mbox_send_message(struct mbox_chan *chan, void *mssg)
+{
+ return -ENOTSUPP;
+}
+
+static inline int mbox_flush(struct mbox_chan *chan, unsigned long timeout)
+{
+ return -ENOTSUPP;
+}
+
+static inline void mbox_client_txdone(struct mbox_chan *chan, int r) { }
+
+static inline bool mbox_client_peek_data(struct mbox_chan *chan)
+{
+ return false;
+}
+
+static inline void mbox_free_channel(struct mbox_chan *chan) { }
+#endif
#endif /* __MAILBOX_CLIENT_H */
--
2.17.1
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [RESEND PATCH] mailbox: Add dummy mailbox API implementation
2020-03-19 17:49 [RESEND PATCH] mailbox: Add dummy mailbox API implementation Daniel Baluta
@ 2020-03-19 17:57 ` Randy Dunlap
0 siblings, 0 replies; 2+ messages in thread
From: Randy Dunlap @ 2020-03-19 17:57 UTC (permalink / raw)
To: Daniel Baluta, jassisinghbrar
Cc: leonard.crestez, aisheng.dong, linux-imx, linux-kernel, peng.fan,
Daniel Baluta
On 3/19/20 10:49 AM, Daniel Baluta wrote:
> From: Daniel Baluta <daniel.baluta@nxp.com>
>
> There are users of mailbox API that could be enabled
> via COMPILE_TEST without select CONFIG_MAILBOX.
>
> In such cases we got compilation errors, like these:
>
> ld: drivers/firmware/imx/imx-scu.o: in function `imx_scu_probe':
> imx-scu.c:(.text+0x25e): undefined reference to
> `mbox_request_channel_byname'
> ld: drivers/firmware/imx/imx-scu.o: in function `imx_scu_call_rpc':
> imx-scu.c:(.text+0x4b8): undefined reference to `mbox_send_message'
> ld: drivers/firmware/imx/imx-scu-irq.o: in function
> `imx_scu_enable_general_irq_channel':
> imx-scu-irq.c:(.text+0x34d): undefined reference to
> `mbox_request_channel_byname'
>
> Fix this by implementing dummy mailbox API when CONFIG_MAILBOX is not
> set.
>
> Reported-by: Randy Dunlap <rdunlap@infradead.org>
> Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
Acked-by: Randy Dunlap <rdunlap@infradead.org> # build-tested
Thanks.
> ---
> resend adding Jassi's email
>
> include/linux/mailbox_client.h | 34 ++++++++++++++++++++++++++++++++++
> 1 file changed, 34 insertions(+)
>
> diff --git a/include/linux/mailbox_client.h b/include/linux/mailbox_client.h
> index 65229a45590f..ab5d130f0b5c 100644
> --- a/include/linux/mailbox_client.h
> +++ b/include/linux/mailbox_client.h
> @@ -37,6 +37,7 @@ struct mbox_client {
> void (*tx_done)(struct mbox_client *cl, void *mssg, int r);
> };
>
> +#ifdef CONFIG_MAILBOX
> struct mbox_chan *mbox_request_channel_byname(struct mbox_client *cl,
> const char *name);
> struct mbox_chan *mbox_request_channel(struct mbox_client *cl, int index);
> @@ -46,4 +47,37 @@ void mbox_client_txdone(struct mbox_chan *chan, int r); /* atomic */
> bool mbox_client_peek_data(struct mbox_chan *chan); /* atomic */
> void mbox_free_channel(struct mbox_chan *chan); /* may sleep */
>
> +#else
> +static inline
> +struct mbox_chan *mbox_request_channel_byname(struct mbox_client *cl,
> + const char *name)
> +{
> + return ERR_PTR(-ENOTSUPP);
> +}
> +
> +static inline
> +struct mbox_chan *mbox_request_channel(struct mbox_client *cl, int index)
> +{
> + return ERR_PTR(-ENOTSUPP);
> +}
> +
> +static inline int mbox_send_message(struct mbox_chan *chan, void *mssg)
> +{
> + return -ENOTSUPP;
> +}
> +
> +static inline int mbox_flush(struct mbox_chan *chan, unsigned long timeout)
> +{
> + return -ENOTSUPP;
> +}
> +
> +static inline void mbox_client_txdone(struct mbox_chan *chan, int r) { }
> +
> +static inline bool mbox_client_peek_data(struct mbox_chan *chan)
> +{
> + return false;
> +}
> +
> +static inline void mbox_free_channel(struct mbox_chan *chan) { }
> +#endif
> #endif /* __MAILBOX_CLIENT_H */
>
--
~Randy
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-03-19 17:57 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-19 17:49 [RESEND PATCH] mailbox: Add dummy mailbox API implementation Daniel Baluta
2020-03-19 17:57 ` Randy Dunlap
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®