Files
android_kernel_xiaomi_sm8450/include/trace/hooks/block.h
Elliot Berman 573c7f061d ANDROID: Guard hooks with their CONFIG_ options
ANDROID_VENDOR_HOOKS has implicit dependencies on the subsystems which
it hooks into whenever it directly uses an "internal" header for that
system. For instance, drivers/scsi/ufs/ufshcd.h doesn't compile unless
CONFIG_SCSI_UFSHCD is enabled:

  In file included from drivers/android/vendor_hooks.c:41:
  In file included from include/trace/hooks/ufshcd.h:21:
  include/../drivers/scsi/ufs/ufshcd.h:675:38: error: field has incomplete type 'struct devfreq_simple_ondemand_data'
          struct devfreq_simple_ondemand_data ondemand_data;
                                              ^
  include/../drivers/scsi/ufs/ufshcd.h:675:9: note: forward declaration of 'struct devfreq_simple_ondemand_data'
          struct devfreq_simple_ondemand_data ondemand_data;

To avoid these implicit dependencies, guard any "internal" header
includes with the respective CONFIG_ options when applicable. If the
CONFIG_ option is not enabled, then the forward-declared structs are
used. This is acceptable because those hooks would not have been called
anyway since the underlying subsytem wasn't enabled.

Fixes: commit 1590a0e8e1 ("ANDROID: GKI: include more type definitions in vendor hooks")
Bug: 240404657
Change-Id: I43d19136fdb1b534e80630067f5db92c379adc67
Signed-off-by: Elliot Berman <quic_eberman@quicinc.com>
2022-07-29 14:34:26 -07:00

40 lines
1.1 KiB
C

/* SPDX-License-Identifier: GPL-2.0 */
#undef TRACE_SYSTEM
#define TRACE_SYSTEM block
#define TRACE_INCLUDE_PATH trace/hooks
#if !defined(_TRACE_HOOK_BLOCK_H) || defined(TRACE_HEADER_MULTI_READ)
#define _TRACE_HOOK_BLOCK_H
#include <linux/tracepoint.h>
#include <trace/hooks/vendor_hooks.h>
#if defined(__GENKSYMS__) || !defined(CONFIG_BLOCK)
struct blk_mq_tags;
struct blk_mq_alloc_data;
struct blk_mq_tag_set;
#else
/* struct blk_mq_tags */
#include <../block/blk-mq-tag.h>
/* struct blk_mq_alloc_data */
#include <../block/blk-mq.h>
/* struct blk_mq_tag_set */
#include <linux/blk-mq.h>
#endif /* __GENKSYMS__ */
DECLARE_HOOK(android_vh_blk_alloc_rqs,
TP_PROTO(size_t *rq_size, struct blk_mq_tag_set *set,
struct blk_mq_tags *tags),
TP_ARGS(rq_size, set, tags));
DECLARE_HOOK(android_vh_blk_rq_ctx_init,
TP_PROTO(struct request *rq, struct blk_mq_tags *tags,
struct blk_mq_alloc_data *data, u64 alloc_time_ns),
TP_ARGS(rq, tags, data, alloc_time_ns));
#endif /* _TRACE_HOOK_BLOCK_H */
/* This part must be outside protection */
#include <trace/define_trace.h>