Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 0DB21C197A0 for ; Mon, 20 Nov 2023 13:56:06 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.636746.992474 (Exim 4.92) (envelope-from ) id 1r54kh-00045j-Ut; Mon, 20 Nov 2023 13:55:51 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 636746.992474; Mon, 20 Nov 2023 13:55:51 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1r54kh-00045c-S3; Mon, 20 Nov 2023 13:55:51 +0000 Received: by outflank-mailman (input) for mailman id 636746; Mon, 20 Nov 2023 13:55:50 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1r54kg-00044B-QN for xen-devel@lists.xenproject.org; Mon, 20 Nov 2023 13:55:50 +0000 Received: from support.bugseng.com (mail.bugseng.com [162.55.131.47]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 81f1335c-87ac-11ee-9b0e-b553b5be7939; Mon, 20 Nov 2023 14:55:48 +0100 (CET) Received: from [10.253.41.90] (unknown [160.78.253.159]) by support.bugseng.com (Postfix) with ESMTPSA id 48A3C4EE0739; Mon, 20 Nov 2023 14:55:47 +0100 (CET) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 81f1335c-87ac-11ee-9b0e-b553b5be7939 Message-ID: Date: Mon, 20 Nov 2023 14:55:46 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [XEN PATCH 1/5] xen/common: address violations of MISRA C:2012 Rule 8.2 Content-Language: en-US, it To: Stefano Stabellini Cc: xen-devel@lists.xenproject.org, consulting@bugseng.com, Jan Beulich , Andrew Cooper , George Dunlap , Julien Grall , Wei Liu References: From: Federico Serafini Organization: BUGSENG srl In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 18/11/23 03:59, Stefano Stabellini wrote: > On Fri, 17 Nov 2023, Federico Serafini wrote: >> diff --git a/xen/common/stop_machine.c b/xen/common/stop_machine.c >> index 3adbe380de..398cfd507c 100644 >> --- a/xen/common/stop_machine.c >> +++ b/xen/common/stop_machine.c >> @@ -46,7 +46,7 @@ struct stopmachine_data { >> >> unsigned int fn_cpu; >> int fn_result; >> - int (*fn)(void *); >> + int (*fn)(void *data); >> void *fn_data; >> }; > > At least one of the possible function used here calls the parameter > "arg", see take_cpu_down. But I don't think it is a MISRA requirement to > also harmonize those? > > >> @@ -73,7 +73,7 @@ static void stopmachine_wait_state(void) >> * mandatory to be called only on an idle vcpu, as otherwise active core >> * scheduling might hang. >> */ >> -int stop_machine_run(int (*fn)(void *), void *data, unsigned int cpu) >> +int stop_machine_run(int (*fn)(void *data), void *data, unsigned int cpu) >> { >> unsigned int i, nr_cpus; >> unsigned int this = smp_processor_id(); >> diff --git a/xen/common/tasklet.c b/xen/common/tasklet.c >> index 3ad67b5c24..3649798e6b 100644 >> --- a/xen/common/tasklet.c >> +++ b/xen/common/tasklet.c >> @@ -199,7 +199,7 @@ static void migrate_tasklets_from_cpu(unsigned int cpu, struct list_head *list) >> spin_unlock_irqrestore(&tasklet_lock, flags); >> } >> >> -void tasklet_init(struct tasklet *t, void (*func)(void *), void *data) >> +void tasklet_init(struct tasklet *t, void (*func)(void *data), void *data) >> { >> memset(t, 0, sizeof(*t)); >> INIT_LIST_HEAD(&t->list); >> @@ -208,7 +208,8 @@ void tasklet_init(struct tasklet *t, void (*func)(void *), void *data) >> t->data = data; >> } >> >> -void softirq_tasklet_init(struct tasklet *t, void (*func)(void *), void *data) >> +void softirq_tasklet_init(struct tasklet *t, >> + void (*func)(void *data), void *data) >> { >> tasklet_init(t, func, data); >> t->is_softirq = 1; >> diff --git a/xen/common/timer.c b/xen/common/timer.c >> index 0fddfa7487..bf7792dcb3 100644 >> --- a/xen/common/timer.c >> +++ b/xen/common/timer.c >> @@ -291,7 +291,7 @@ static bool active_timer(const struct timer *timer) >> >> void init_timer( >> struct timer *timer, >> - void (*function)(void *), >> + void (*function)(void *data), >> void *data, >> unsigned int cpu) >> { >> @@ -441,7 +441,7 @@ void kill_timer(struct timer *timer) >> >> static void execute_timer(struct timers *ts, struct timer *t) >> { >> - void (*fn)(void *) = t->function; >> + void (*fn)(void *data) = t->function; >> void *data = t->data; >> >> t->status = TIMER_STATUS_inactive; >> diff --git a/xen/include/xen/rangeset.h b/xen/include/xen/rangeset.h >> index 135f33f606..390f7b6082 100644 >> --- a/xen/include/xen/rangeset.h >> +++ b/xen/include/xen/rangeset.h >> @@ -68,7 +68,7 @@ bool_t __must_check rangeset_overlaps_range( >> struct rangeset *r, unsigned long s, unsigned long e); >> int rangeset_report_ranges( >> struct rangeset *r, unsigned long s, unsigned long e, >> - int (*cb)(unsigned long s, unsigned long e, void *), void *ctxt); >> + int (*cb)(unsigned long s, unsigned long e, void *data), void *ctxt); > > Also here some of the functions use "arg" instead of ctxt > > >> /* >> * Note that the consume function can return an error value apart from >> @@ -77,7 +77,7 @@ int rangeset_report_ranges( >> */ >> int rangeset_consume_ranges(struct rangeset *r, >> int (*cb)(unsigned long s, unsigned long e, >> - void *, unsigned long *c), >> + void *ctxt, unsigned long *c), >> void *ctxt); > > Also here some of the functions use "dom" like irq_remove_cb. > > > But I actually like the patch as is, so if that's OK from a MISRA point > of view then I would give my reviewed-by. Yes, this is OK for MISRA. -- Federico Serafini, M.Sc. Software Engineer, BUGSENG (http://bugseng.com)