git: e6b3aaa3e68d - stable/13 - hwpmc: unused/diagused annotations in tsc class

From: Mitchell Horne <mhorne_at_FreeBSD.org>
Date: Fri, 09 Jun 2023 19:58:13 UTC
The branch stable/13 has been updated by mhorne:

URL: https://cgit.FreeBSD.org/src/commit/?id=e6b3aaa3e68db10ef4ef7ae25cefb04b3d61b5d2

commit e6b3aaa3e68db10ef4ef7ae25cefb04b3d61b5d2
Author:     Mitchell Horne <mhorne@FreeBSD.org>
AuthorDate: 2023-05-05 21:59:53 +0000
Commit:     Mitchell Horne <mhorne@FreeBSD.org>
CommitDate: 2023-06-09 18:14:59 +0000

    hwpmc: unused/diagused annotations in tsc class
    
    These are preferred over casts to void. No functional change.
    
    Reviewed by:    jkoshy
    MFC after:      2 weeks
    Sponsored by:   The FreeBSD Foundation
    Differential Revision:  https://reviews.freebsd.org/D39914
    
    (cherry picked from commit a35453b9c7644f11df83d0c7e73da488f521e56e)
---
 sys/dev/hwpmc/hwpmc_tsc.c | 27 ++++++++-------------------
 1 file changed, 8 insertions(+), 19 deletions(-)

diff --git a/sys/dev/hwpmc/hwpmc_tsc.c b/sys/dev/hwpmc/hwpmc_tsc.c
index 25b2e9f8fd57..3c95ceb080a5 100644
--- a/sys/dev/hwpmc/hwpmc_tsc.c
+++ b/sys/dev/hwpmc/hwpmc_tsc.c
@@ -70,10 +70,9 @@ struct tsc_cpu {
 static struct tsc_cpu **tsc_pcpu;
 
 static int
-tsc_allocate_pmc(int cpu, int ri, struct pmc *pm,
+tsc_allocate_pmc(int cpu __diagused, int ri __diagused, struct pmc *pm __unused,
     const struct pmc_op_pmcallocate *a)
 {
-	(void) cpu;
 
 	KASSERT(cpu >= 0 && cpu < pmc_cpu_max(),
 	    ("[tsc,%d] illegal CPU value %d", __LINE__, cpu));
@@ -140,9 +139,8 @@ tsc_describe(int cpu, int ri, struct pmc_info *pi, struct pmc **ppmc)
 }
 
 static int
-tsc_get_config(int cpu, int ri, struct pmc **ppm)
+tsc_get_config(int cpu, int ri __diagused, struct pmc **ppm)
 {
-	(void) ri;
 
 	KASSERT(cpu >= 0 && cpu < pmc_cpu_max(),
 	    ("[tsc,%d] illegal CPU %d", __LINE__, cpu));
@@ -154,9 +152,8 @@ tsc_get_config(int cpu, int ri, struct pmc **ppm)
 }
 
 static int
-tsc_get_msr(int ri, uint32_t *msr)
+tsc_get_msr(int ri __diagused, uint32_t *msr)
 {
-	(void) ri;
 
 	KASSERT(ri >= 0 && ri < TSC_NPMCS,
 	    ("[tsc,%d] ri %d out of range", __LINE__, ri));
@@ -252,12 +249,10 @@ tsc_read_pmc(int cpu, int ri, pmc_value_t *v)
 }
 
 static int
-tsc_release_pmc(int cpu, int ri, struct pmc *pmc)
+tsc_release_pmc(int cpu, int ri __diagused, struct pmc *pmc __unused)
 {
 	struct pmc_hw *phw __diagused;
 
-	(void) pmc;
-
 	KASSERT(cpu >= 0 && cpu < pmc_cpu_max(),
 	    ("[tsc,%d] illegal CPU value %d", __LINE__, cpu));
 	KASSERT(ri == 0,
@@ -275,9 +270,8 @@ tsc_release_pmc(int cpu, int ri, struct pmc *pmc)
 }
 
 static int
-tsc_start_pmc(int cpu, int ri)
+tsc_start_pmc(int cpu __diagused, int ri __diagused)
 {
-	(void) cpu;
 
 	KASSERT(cpu >= 0 && cpu < pmc_cpu_max(),
 	    ("[tsc,%d] illegal CPU value %d", __LINE__, cpu));
@@ -287,9 +281,8 @@ tsc_start_pmc(int cpu, int ri)
 }
 
 static int
-tsc_stop_pmc(int cpu, int ri)
+tsc_stop_pmc(int cpu __diagused, int ri __diagused)
 {
-	(void) cpu; (void) ri;
 
 	KASSERT(cpu >= 0 && cpu < pmc_cpu_max(),
 	    ("[tsc,%d] illegal CPU value %d", __LINE__, cpu));
@@ -299,9 +292,8 @@ tsc_stop_pmc(int cpu, int ri)
 }
 
 static int
-tsc_write_pmc(int cpu, int ri, pmc_value_t v)
+tsc_write_pmc(int cpu __diagused, int ri __diagused, pmc_value_t v __unused)
 {
-	(void) cpu; (void) ri; (void) v;
 
 	KASSERT(cpu >= 0 && cpu < pmc_cpu_max(),
 	    ("[tsc,%d] illegal CPU value %d", __LINE__, cpu));
@@ -354,7 +346,7 @@ pmc_tsc_initialize(struct pmc_mdep *md, int maxcpu)
 }
 
 void
-pmc_tsc_finalize(struct pmc_mdep *md)
+pmc_tsc_finalize(struct pmc_mdep *md __diagused)
 {
 #ifdef	INVARIANTS
 	int i, ncpus;
@@ -366,9 +358,6 @@ pmc_tsc_finalize(struct pmc_mdep *md)
 
 	KASSERT(md->pmd_classdep[PMC_MDEP_CLASS_INDEX_TSC].pcd_class ==
 	    PMC_CLASS_TSC, ("[tsc,%d] class mismatch", __LINE__));
-
-#else
-	(void) md;
 #endif
 
 	free(tsc_pcpu, M_PMC);