All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1 0/2] perf: Minor typo and style changes to perf_event.h
@ 2019-05-03 10:23 Andrew Murray
  2019-05-03 10:23 ` [PATCH v1 1/2] perf: Fix incorrect comment for event_idx callback Andrew Murray
  2019-05-03 10:23 ` [PATCH v1 2/2] perf: Use consistent style of comments for optional callbacks Andrew Murray
  0 siblings, 2 replies; 3+ messages in thread
From: Andrew Murray @ 2019-05-03 10:23 UTC (permalink / raw)
  To: Peter Zijlstra; +Cc: Ingo Molnar, Alexander Shishkin, linux-kernel

This series makes minor changes to perf_event.h to fix an incorrect
comment and to improve the readability of the annotations for the
optional callbacks.


Andrew Murray (2):
  perf: Fix incorrect comment for event_idx callback
  perf: Use consistent style of comments for optional callbacks

 include/linux/perf_event.h | 27 +++++++++++++++++++--------
 1 file changed, 19 insertions(+), 8 deletions(-)

-- 
2.21.0


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH v1 1/2] perf: Fix incorrect comment for event_idx callback
  2019-05-03 10:23 [PATCH v1 0/2] perf: Minor typo and style changes to perf_event.h Andrew Murray
@ 2019-05-03 10:23 ` Andrew Murray
  2019-05-03 10:23 ` [PATCH v1 2/2] perf: Use consistent style of comments for optional callbacks Andrew Murray
  1 sibling, 0 replies; 3+ messages in thread
From: Andrew Murray @ 2019-05-03 10:23 UTC (permalink / raw)
  To: Peter Zijlstra; +Cc: Ingo Molnar, Alexander Shishkin, linux-kernel

The default implementation of the event_idx callback
(perf_event_idx_default) returns 0. Let's update the comment for the
callback to reflect this, as it currently indicates an incorrect value.

Signed-off-by: Andrew Murray <andrew.murray@arm.com>
---
 include/linux/perf_event.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
index e47ef764f613..27c1cb3cddf1 100644
--- a/include/linux/perf_event.h
+++ b/include/linux/perf_event.h
@@ -392,7 +392,7 @@ struct pmu {
 
 	/*
 	 * Will return the value for perf_event_mmap_page::index for this event,
-	 * if no implementation is provided it will default to: event->hw.idx + 1.
+	 * if no implementation is provided it will default to: 0.
 	 */
 	int (*event_idx)		(struct perf_event *event); /*optional */
 
-- 
2.21.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH v1 2/2] perf: Use consistent style of comments for optional callbacks
  2019-05-03 10:23 [PATCH v1 0/2] perf: Minor typo and style changes to perf_event.h Andrew Murray
  2019-05-03 10:23 ` [PATCH v1 1/2] perf: Fix incorrect comment for event_idx callback Andrew Murray
@ 2019-05-03 10:23 ` Andrew Murray
  1 sibling, 0 replies; 3+ messages in thread
From: Andrew Murray @ 2019-05-03 10:23 UTC (permalink / raw)
  To: Peter Zijlstra; +Cc: Ingo Molnar, Alexander Shishkin, linux-kernel

To improve the readability of perf_event.h, let's be consistent in how we
annotate optional struct pmu callbacks. Where a multi-line comment block
is present before a single function prototype we add the annotation at the
end of the block. Otherwise we use a single line comment at the end of the
function prototype.

Signed-off-by: Andrew Murray <andrew.murray@arm.com>
---
 include/linux/perf_event.h | 25 ++++++++++++++++++-------
 1 file changed, 18 insertions(+), 7 deletions(-)

diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
index 27c1cb3cddf1..f0479c99d2ec 100644
--- a/include/linux/perf_event.h
+++ b/include/linux/perf_event.h
@@ -393,8 +393,10 @@ struct pmu {
 	/*
 	 * Will return the value for perf_event_mmap_page::index for this event,
 	 * if no implementation is provided it will default to: 0.
+	 *
+	 * Optional.
 	 */
-	int (*event_idx)		(struct perf_event *event); /*optional */
+	int (*event_idx)		(struct perf_event *event);
 
 	/*
 	 * context-switches callback
@@ -409,15 +411,18 @@ struct pmu {
 
 	/*
 	 * Set up pmu-private data structures for an AUX area
+	 *
+	 * Optional.
 	 */
 	void *(*setup_aux)		(struct perf_event *event, void **pages,
 					 int nr_pages, bool overwrite);
-					/* optional */
 
 	/*
 	 * Free pmu-private AUX data structures
+	 *
+	 * Optional.
 	 */
-	void (*free_aux)		(void *aux); /* optional */
+	void (*free_aux)		(void *aux);
 
 	/*
 	 * Validate address range filters: make sure the HW supports the
@@ -426,9 +431,10 @@ struct pmu {
 	 *
 	 * Runs in the context of the ioctl()ing process and is not serialized
 	 * with the rest of the PMU callbacks.
+	 *
+	 * Optional.
 	 */
 	int (*addr_filters_validate)	(struct list_head *filters);
-					/* optional */
 
 	/*
 	 * Synchronize address range filter configuration:
@@ -440,19 +446,24 @@ struct pmu {
 	 *
 	 * May (and should) traverse event::addr_filters::list, for which its
 	 * caller provides necessary serialization.
+	 *
+	 * Optional.
 	 */
 	void (*addr_filters_sync)	(struct perf_event *event);
-					/* optional */
 
 	/*
 	 * Filter events for PMU-specific reasons.
+	 *
+	 * Optional.
 	 */
-	int (*filter_match)		(struct perf_event *event); /* optional */
+	int (*filter_match)		(struct perf_event *event);
 
 	/*
 	 * Check period value for PERF_EVENT_IOC_PERIOD ioctl.
+	 *
+	 * Optional.
 	 */
-	int (*check_period)		(struct perf_event *event, u64 value); /* optional */
+	int (*check_period)		(struct perf_event *event, u64 value);
 };
 
 enum perf_addr_filter_action_t {
-- 
2.21.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-05-03 10:23 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-03 10:23 [PATCH v1 0/2] perf: Minor typo and style changes to perf_event.h Andrew Murray
2019-05-03 10:23 ` [PATCH v1 1/2] perf: Fix incorrect comment for event_idx callback Andrew Murray
2019-05-03 10:23 ` [PATCH v1 2/2] perf: Use consistent style of comments for optional callbacks Andrew Murray

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.