Linux Perf Users
 help / color / mirror / Atom feed
From: Manish Bhardwaj <bhardwajmanish18@gmail.com>
To: bhardwajmanish18@gmail.com
Cc: acme@kernel.org, alexander.shishkin@linux.intel.com,
	irogers@google.com, jolsa@kernel.org,
	linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org,
	mark.rutland@arm.com, mingo@redhat.com, namhyung@kernel.org,
	peterz@infradead.org
Subject: [PATCH] perf/core: introduced stub APIs for exported APIs
Date: Sun,  5 Mar 2023 14:57:59 +0530	[thread overview]
Message-ID: <20230305092759.10754-1-bhardwajmanish18@gmail.com> (raw)
In-Reply-To: <20230305053934.9948-1-bhardwajmanish18@gmail.com>

Introduced stub APIs for exported APIs so that we can build
independent module without any error if CONFIG_PERF_EVENT
feature is disabled in kernel.

drivers/platform/tegra/uncore_pmu/tegra23x_perf_uncore.c:
In function _scf_pmu_device_probe_:
drivers/platform/tegra/uncore_pmu/tegra23x_perf_uncore.c:596:    8:
error: implicit declaration of function _perf_pmu_register_
[-Werror=implicit-function-declaration]
  err = perf_pmu_register(&uncore_pmu->pmu, uncore_pmu->pmu.name,
531       |        ^~~~~~~~~~~~~~~~~
drivers/platform/tegra/uncore_pmu/tegra23x_perf_uncore.c: In
function _scf_pmu_device_remove_:
drivers/platform/tegra/uncore_pmu/tegra23x_perf_uncore.c:611:    2:
error: implicit declaration of function _perf_pmu_unregister_; did you
mean _device_unregister_? [-Werror=implicit-function-declaration]
  611 |  perf_pmu_unregister(&uncore_pmu->pmu);
      |  ^~~~~~~~~~~~~~~~~~~
      |  device_unregister
cc1: some warnings being treated as errors
scripts/Makefile.build:297: recipe for target
'drivers/platform/tegra/uncore_pmu/tegra23x_perf_uncore.o' failed
make[7]: *** [drivers/platform/tegra/
uncore_pmu/tegra23x_perf_uncore.o] Error 1

Signed-off-by: Manish Bhardwaj <bhardwajmanish18@gmail.com>
---
 include/linux/perf_event.h | 36 ++++++++++++++++++++++++++++++++++++
 1 file changed, 36 insertions(+)

diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
index d5628a7b5eaa..96259320aff1 100644
--- a/include/linux/perf_event.h
+++ b/include/linux/perf_event.h
@@ -1679,6 +1679,42 @@ extern int perf_event_account_interrupt(struct perf_event *event);
 extern int perf_event_period(struct perf_event *event, u64 value);
 extern u64 perf_event_pause(struct perf_event *event, bool reset);
 #else /* !CONFIG_PERF_EVENTS: */
+static void perf_event_addr_filters_sync(struct perf_event *event)		{ }
+static u64 perf_event_read_value(struct perf_event *event,
+				 u64 *enabled, u64 *running)
+{
+	return 0;
+}
+static void perf_event_update_userpage(struct perf_event *event)			{ }
+static void perf_register_guest_info_callbacks(struct perf_guest_info_callbacks *cbs)	{ }
+static void perf_unregister_guest_info_callbacks(struct perf_guest_info_callbacks *cbs)	{ }
+static void perf_report_aux_output_id(struct perf_event *event, u64 hw_id)		{ }
+static void perf_tp_event(u16 event_type, u64 count, void *record,
+			  int entry_size, struct pt_regs *regs,
+			  struct hlist_head *head, int rctx,
+			  struct task_struct *task)
+{
+}
+static int perf_pmu_register(struct pmu *pmu, const char *name, int type)
+{
+	return -1;
+}
+static void perf_pmu_unregister(struct pmu *pmu)					{ }
+static struct perf_event *
+perf_event_create_kernel_counter(struct perf_event_attr *attr,
+				int cpu,
+				struct task_struct *task,
+				perf_overflow_handler_t callback,
+				void *context)
+{
+	return NULL;
+}
+static void perf_pmu_migrate_context(struct pmu *pmu, int src_cpu, int dst_cpu)		{ }
+static ssize_t perf_event_sysfs_show(struct device *dev, struct device_attribute *attr,
+			      char *page)
+{
+	return -1;
+}
 static inline void *
 perf_aux_output_begin(struct perf_output_handle *handle,
 		      struct perf_event *event)				{ return NULL; }

base-commit: b01fe98d34f3bed944a93bd8119fed80c856fad8
-- 
2.39.2


  parent reply	other threads:[~2023-03-05  9:28 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-05  5:39 [PATCH] perf/core: introduced stub APIs for exported APIs Manish Bhardwaj
2023-03-05  7:36 ` kernel test robot
2023-03-05  7:36 ` kernel test robot
2023-03-05  7:57 ` kernel test robot
2023-03-05  9:27 ` Manish Bhardwaj [this message]
2023-03-05 10:20   ` kernel test robot
2023-03-06 11:45   ` Peter Zijlstra
     [not found]   ` <CAPLwjC7=SS2v2qU==mAUrS=SH1Fmg0bXQx4Swnqh8ndSCvULEw@mail.gmail.com>
2023-03-06 11:46     ` Peter Zijlstra
2023-03-06 16:56 ` Mark Rutland

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230305092759.10754-1-bhardwajmanish18@gmail.com \
    --to=bhardwajmanish18@gmail.com \
    --cc=acme@kernel.org \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=irogers@google.com \
    --cc=jolsa@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mingo@redhat.com \
    --cc=namhyung@kernel.org \
    --cc=peterz@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox