Re: [PATCH -next] riscv: perf_event: Make some funciton static

From: Kefeng Wang
Date: Sun May 10 2020 - 21:31:08 EST



On 2020/5/9 1:13, Palmer Dabbelt wrote:
What's the "-next" for? This seems appropriate for an RC to me, as it's a
build fix.

Thanks for your review, this patch and "[PATCH -next] riscv: perf: RISCV_BASE_PMU

should be closeable", I fix the issue based on linux-next, so add the next prefix ; )

and we also found some another build issue when add RISCV arch to huawei build robot,

will send out the patches later.



On Thu, 07 May 2020 08:04:44 PDT (-0700), wangkefeng.wang@xxxxxxxxxx wrote:
Fixes the following warning detected when running make with W=1,
../arch/riscv/kernel/perf_event.c:150:5: warning: no previous prototype for âriscv_map_cache_decodeâ [-Wmissing-prototypes]
Âint riscv_map_cache_decode(u64 config, unsigned int *type,
ÂÂÂÂ ^~~~~~~~~~~~~~~~~~~~~~
../arch/riscv/kernel/perf_event.c:345:13: warning: no previous prototype for âriscv_base_pmu_handle_irqâ [-Wmissing-prototypes]
Âirqreturn_t riscv_base_pmu_handle_irq(int irq_num, void *dev)
ÂÂÂÂÂÂÂÂÂÂÂÂ ^~~~~~~~~~~~~~~~~~~~~~~~~
../arch/riscv/kernel/perf_event.c:364:6: warning: no previous prototype for ârelease_pmc_hardwareâ [-Wmissing-prototypes]
Âvoid release_pmc_hardware(void)
ÂÂÂÂÂ ^~~~~~~~~~~~~~~~~~~~
../arch/riscv/kernel/perf_event.c:467:12: warning: no previous prototype for âinit_hw_perf_eventsâ [-Wmissing-prototypes]
Âint __init init_hw_perf_events(void)
ÂÂÂÂÂÂÂÂÂÂÂ ^~~~~~~~~~~~~~~~~~~

Cc: Alan Kao <alankao@xxxxxxxxxxxxx>
Signed-off-by: Kefeng Wang <wangkefeng.wang@xxxxxxxxxx>
---
Âarch/riscv/kernel/perf_event.c | 8 ++++----
Â1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/riscv/kernel/perf_event.c b/arch/riscv/kernel/perf_event.c
index 91626d9ae5f2..c835f0362d94 100644
--- a/arch/riscv/kernel/perf_event.c
+++ b/arch/riscv/kernel/perf_event.c
@@ -147,7 +147,7 @@ static int riscv_map_hw_event(u64 config)
ÂÂÂÂ return riscv_pmu->hw_events[config];
Â}

-int riscv_map_cache_decode(u64 config, unsigned int *type,
+static int riscv_map_cache_decode(u64 config, unsigned int *type,
ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ unsigned int *op, unsigned int *result)
Â{
ÂÂÂÂ return -ENOENT;
@@ -342,7 +342,7 @@ static void riscv_pmu_del(struct perf_event *event, int flags)

Âstatic DEFINE_MUTEX(pmc_reserve_mutex);

-irqreturn_t riscv_base_pmu_handle_irq(int irq_num, void *dev)
+static irqreturn_t riscv_base_pmu_handle_irq(int irq_num, void *dev)
Â{
ÂÂÂÂ return IRQ_NONE;
Â}
@@ -361,7 +361,7 @@ static int reserve_pmc_hardware(void)
ÂÂÂÂ return err;
Â}

-void release_pmc_hardware(void)
+static void release_pmc_hardware(void)
Â{
ÂÂÂÂ mutex_lock(&pmc_reserve_mutex);
ÂÂÂÂ if (riscv_pmu->irq >= 0)
@@ -464,7 +464,7 @@ static const struct of_device_id riscv_pmu_of_ids[] = {
ÂÂÂÂ { /* sentinel value */ }
Â};

-int __init init_hw_perf_events(void)
+static int __init init_hw_perf_events(void)
Â{
ÂÂÂÂ struct device_node *node = of_find_node_by_type(NULL, "pmu");
ÂÂÂÂ const struct of_device_id *of_id;

Reviewed-by: Palmer Dabbelt <palmerdabbelt@xxxxxxxxxx>

.