Skip to content

Commit eb0d862

Browse files
AngeloGioacchino Del Regnombgg
authored andcommitted
soc: mediatek: cmdq: Add inline functions for !CONFIG_MTK_CMDQ
In preparation for a cleanup of ifdef instances of IS_REACHABLE() for the CONFIG_MTK_CMDQ configuration option, add inline functions that will either return a failure or, for void functions, do nothing. Signed-off-by: AngeloGioacchino Del Regno <[email protected]> Reviewed-by: Chen-Yu Tsai <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Matthias Brugger <[email protected]>
1 parent 1fccd1e commit eb0d862

File tree

1 file changed

+114
-0
lines changed

1 file changed

+114
-0
lines changed

include/linux/soc/mediatek/mtk-cmdq.h

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ struct cmdq_client {
2727
struct mbox_chan *chan;
2828
};
2929

30+
#if IS_ENABLED(CONFIG_MTK_CMDQ)
31+
3032
/**
3133
* cmdq_dev_get_client_reg() - parse cmdq client reg from the device
3234
* node of CMDQ client
@@ -277,4 +279,116 @@ int cmdq_pkt_finalize(struct cmdq_pkt *pkt);
277279
*/
278280
int cmdq_pkt_flush_async(struct cmdq_pkt *pkt);
279281

282+
#else /* IS_ENABLED(CONFIG_MTK_CMDQ) */
283+
284+
static inline int cmdq_dev_get_client_reg(struct device *dev,
285+
struct cmdq_client_reg *client_reg, int idx)
286+
{
287+
return -ENODEV;
288+
}
289+
290+
static inline struct cmdq_client *cmdq_mbox_create(struct device *dev, int index)
291+
{
292+
return ERR_PTR(-EINVAL);
293+
}
294+
295+
static inline void cmdq_mbox_destroy(struct cmdq_client *client) { }
296+
297+
static inline struct cmdq_pkt *cmdq_pkt_create(struct cmdq_client *client, size_t size)
298+
{
299+
return ERR_PTR(-EINVAL);
300+
}
301+
302+
static inline void cmdq_pkt_destroy(struct cmdq_pkt *pkt) { }
303+
304+
static inline int cmdq_pkt_write(struct cmdq_pkt *pkt, u8 subsys, u16 offset, u32 value)
305+
{
306+
return -ENOENT;
307+
}
308+
309+
static inline int cmdq_pkt_write_mask(struct cmdq_pkt *pkt, u8 subsys,
310+
u16 offset, u32 value, u32 mask)
311+
{
312+
return -ENOENT;
313+
}
314+
315+
static inline int cmdq_pkt_read_s(struct cmdq_pkt *pkt, u16 high_addr_reg_idx,
316+
u16 addr_low, u16 reg_idx)
317+
{
318+
return -ENOENT;
319+
}
320+
321+
static inline int cmdq_pkt_write_s(struct cmdq_pkt *pkt, u16 high_addr_reg_idx,
322+
u16 addr_low, u16 src_reg_idx)
323+
{
324+
return -ENOENT;
325+
}
326+
327+
static inline int cmdq_pkt_write_s_mask(struct cmdq_pkt *pkt, u16 high_addr_reg_idx,
328+
u16 addr_low, u16 src_reg_idx, u32 mask)
329+
{
330+
return -ENOENT;
331+
}
332+
333+
static inline int cmdq_pkt_write_s_value(struct cmdq_pkt *pkt, u8 high_addr_reg_idx,
334+
u16 addr_low, u32 value)
335+
{
336+
return -ENOENT;
337+
}
338+
339+
static inline int cmdq_pkt_write_s_mask_value(struct cmdq_pkt *pkt, u8 high_addr_reg_idx,
340+
u16 addr_low, u32 value, u32 mask)
341+
{
342+
return -ENOENT;
343+
}
344+
345+
static inline int cmdq_pkt_wfe(struct cmdq_pkt *pkt, u16 event, bool clear)
346+
{
347+
return -EINVAL;
348+
}
349+
350+
static inline int cmdq_pkt_clear_event(struct cmdq_pkt *pkt, u16 event)
351+
{
352+
return -EINVAL;
353+
}
354+
355+
static inline int cmdq_pkt_set_event(struct cmdq_pkt *pkt, u16 event)
356+
{
357+
return -EINVAL;
358+
}
359+
360+
static inline int cmdq_pkt_poll(struct cmdq_pkt *pkt, u8 subsys,
361+
u16 offset, u32 value)
362+
{
363+
return -EINVAL;
364+
}
365+
366+
static inline int cmdq_pkt_poll_mask(struct cmdq_pkt *pkt, u8 subsys,
367+
u16 offset, u32 value, u32 mask)
368+
{
369+
return -EINVAL;
370+
}
371+
372+
static inline int cmdq_pkt_assign(struct cmdq_pkt *pkt, u16 reg_idx, u32 value)
373+
{
374+
return -EINVAL;
375+
}
376+
377+
static inline int cmdq_pkt_jump(struct cmdq_pkt *pkt, dma_addr_t addr)
378+
{
379+
return -EINVAL;
380+
}
381+
382+
static inline int cmdq_pkt_finalize(struct cmdq_pkt *pkt)
383+
{
384+
return -EINVAL;
385+
}
386+
387+
static inline int cmdq_pkt_flush_async(struct cmdq_pkt *pkt)
388+
{
389+
return -EINVAL;
390+
}
391+
392+
#endif /* IS_ENABLED(CONFIG_MTK_CMDQ) */
393+
280394
#endif /* __MTK_CMDQ_H__ */

0 commit comments

Comments
 (0)