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>
This commit is contained in:
@@ -11,19 +11,23 @@
|
|||||||
* Following tracepoints are not exported in tracefs and provide a
|
* Following tracepoints are not exported in tracefs and provide a
|
||||||
* mechanism for vendor modules to hook and extend functionality
|
* mechanism for vendor modules to hook and extend functionality
|
||||||
*/
|
*/
|
||||||
#ifdef __GENKSYMS__
|
#if defined(__GENKSYMS__) || !IS_ENABLED(CONFIG_ANDROID_BINDER_IPC)
|
||||||
struct binder_alloc;
|
struct binder_alloc;
|
||||||
struct binder_proc;
|
struct binder_proc;
|
||||||
struct binder_thread;
|
struct binder_thread;
|
||||||
struct binder_transaction;
|
struct binder_transaction;
|
||||||
struct task_struct;
|
|
||||||
struct seq_file;
|
|
||||||
struct binder_transaction_data;
|
struct binder_transaction_data;
|
||||||
#else
|
#else
|
||||||
/* struct binder_alloc */
|
/* struct binder_alloc */
|
||||||
#include <../drivers/android/binder_alloc.h>
|
#include <../drivers/android/binder_alloc.h>
|
||||||
/* struct binder_proc, struct binder_thread, struct binder_transaction */
|
/* struct binder_proc, struct binder_thread, struct binder_transaction */
|
||||||
#include <../drivers/android/binder_internal.h>
|
#include <../drivers/android/binder_internal.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __GENKSYMS__
|
||||||
|
struct task_struct;
|
||||||
|
struct seq_file;
|
||||||
|
#else
|
||||||
/* struct task_struct */
|
/* struct task_struct */
|
||||||
#include <linux/sched.h>
|
#include <linux/sched.h>
|
||||||
/* struct seq_file */
|
/* struct seq_file */
|
||||||
@@ -31,6 +35,7 @@ struct binder_transaction_data;
|
|||||||
/* struct binder_transaction_data */
|
/* struct binder_transaction_data */
|
||||||
#include <uapi/linux/android/binder.h>
|
#include <uapi/linux/android/binder.h>
|
||||||
#endif /* __GENKSYMS__ */
|
#endif /* __GENKSYMS__ */
|
||||||
|
|
||||||
DECLARE_HOOK(android_vh_binder_transaction_init,
|
DECLARE_HOOK(android_vh_binder_transaction_init,
|
||||||
TP_PROTO(struct binder_transaction *t),
|
TP_PROTO(struct binder_transaction *t),
|
||||||
TP_ARGS(t));
|
TP_ARGS(t));
|
||||||
|
@@ -10,7 +10,7 @@
|
|||||||
#include <linux/tracepoint.h>
|
#include <linux/tracepoint.h>
|
||||||
#include <trace/hooks/vendor_hooks.h>
|
#include <trace/hooks/vendor_hooks.h>
|
||||||
|
|
||||||
#ifdef __GENKSYMS__
|
#if defined(__GENKSYMS__) || !defined(CONFIG_BLOCK)
|
||||||
struct blk_mq_tags;
|
struct blk_mq_tags;
|
||||||
struct blk_mq_alloc_data;
|
struct blk_mq_alloc_data;
|
||||||
struct blk_mq_tag_set;
|
struct blk_mq_tag_set;
|
||||||
|
@@ -10,7 +10,7 @@
|
|||||||
#include <linux/tracepoint.h>
|
#include <linux/tracepoint.h>
|
||||||
#include <trace/hooks/vendor_hooks.h>
|
#include <trace/hooks/vendor_hooks.h>
|
||||||
|
|
||||||
#ifdef __GENKSYMS__
|
#if defined(__GENKSYMS__) || !IS_ENABLED(CONFIG_PRINTK)
|
||||||
struct printk_record;
|
struct printk_record;
|
||||||
struct printk_ringbuffer;
|
struct printk_ringbuffer;
|
||||||
#else
|
#else
|
||||||
|
@@ -10,13 +10,17 @@
|
|||||||
#include <linux/tracepoint.h>
|
#include <linux/tracepoint.h>
|
||||||
#include <trace/hooks/vendor_hooks.h>
|
#include <trace/hooks/vendor_hooks.h>
|
||||||
|
|
||||||
#ifdef __GENKSYMS__
|
#if defined(__GENKSYMS__) || !IS_ENABLED(CONFIG_MMC_SDHCI)
|
||||||
struct sdhci_host;
|
struct sdhci_host;
|
||||||
struct mmc_card;
|
|
||||||
struct mmc_host;
|
|
||||||
#else
|
#else
|
||||||
/* struct sdhci_host */
|
/* struct sdhci_host */
|
||||||
#include <../drivers/mmc/host/sdhci.h>
|
#include <../drivers/mmc/host/sdhci.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __GENKSYMS__
|
||||||
|
struct mmc_card;
|
||||||
|
struct mmc_host;
|
||||||
|
#else
|
||||||
/* struct mmc_card */
|
/* struct mmc_card */
|
||||||
#include <linux/mmc/card.h>
|
#include <linux/mmc/card.h>
|
||||||
/* struct mmc_host */
|
/* struct mmc_host */
|
||||||
|
@@ -12,7 +12,7 @@
|
|||||||
|
|
||||||
#if defined(CONFIG_TRACEPOINTS) && defined(CONFIG_ANDROID_VENDOR_HOOKS)
|
#if defined(CONFIG_TRACEPOINTS) && defined(CONFIG_ANDROID_VENDOR_HOOKS)
|
||||||
|
|
||||||
#ifdef __GENKSYMS__
|
#if defined(__GENKSYMS__) || !defined(CONFIG_PSI)
|
||||||
struct psi_group;
|
struct psi_group;
|
||||||
struct psi_trigger;
|
struct psi_trigger;
|
||||||
#else
|
#else
|
||||||
|
@@ -6,12 +6,13 @@
|
|||||||
#define _TRACE_HOOK_TYPEC_H
|
#define _TRACE_HOOK_TYPEC_H
|
||||||
#include <linux/tracepoint.h>
|
#include <linux/tracepoint.h>
|
||||||
#include <linux/usb/pd.h>
|
#include <linux/usb/pd.h>
|
||||||
|
#include <linux/usb/tcpm.h>
|
||||||
#include <trace/hooks/vendor_hooks.h>
|
#include <trace/hooks/vendor_hooks.h>
|
||||||
/*
|
/*
|
||||||
* Following tracepoints are not exported in tracefs and provide a
|
* Following tracepoints are not exported in tracefs and provide a
|
||||||
* mechanism for vendor modules to hook and extend functionality
|
* mechanism for vendor modules to hook and extend functionality
|
||||||
*/
|
*/
|
||||||
#ifdef __GENKSYMS__
|
#if defined(__GENKSYMS__) || !IS_ENABLED(CONFIG_TYPEC_TCPCI)
|
||||||
struct tcpci_data;
|
struct tcpci_data;
|
||||||
#else
|
#else
|
||||||
/* struct tcpci_data */
|
/* struct tcpci_data */
|
||||||
|
@@ -10,7 +10,7 @@
|
|||||||
* Following tracepoints are not exported in tracefs and provide a
|
* Following tracepoints are not exported in tracefs and provide a
|
||||||
* mechanism for vendor modules to hook and extend functionality
|
* mechanism for vendor modules to hook and extend functionality
|
||||||
*/
|
*/
|
||||||
#ifdef __GENKSYMS__
|
#if defined(__GENKSYMS__) || !IS_ENABLED(CONFIG_SCSI_UFSHCD)
|
||||||
struct ufs_hba;
|
struct ufs_hba;
|
||||||
struct ufshcd_lrb;
|
struct ufshcd_lrb;
|
||||||
struct uic_command;
|
struct uic_command;
|
||||||
|
Reference in New Issue
Block a user