From mboxrd@z Thu Jan 1 00:00:00 1970 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 2EB2EC0015E for ; Wed, 9 Aug 2023 14:09:58 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.581144.909708 (Exim 4.92) (envelope-from ) id 1qTjsX-0002h1-Gw; Wed, 09 Aug 2023 14:09:37 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 581144.909708; Wed, 09 Aug 2023 14:09:37 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1qTjsX-0002gu-DJ; Wed, 09 Aug 2023 14:09:37 +0000 Received: by outflank-mailman (input) for mailman id 581144; Wed, 09 Aug 2023 14:09:36 +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 1qTjsW-0002go-D9 for xen-devel@lists.xenproject.org; Wed, 09 Aug 2023 14:09:36 +0000 Received: from support.bugseng.com (mail.bugseng.com [162.55.131.47]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 5c706ae3-36be-11ee-8613-37d641c3527e; Wed, 09 Aug 2023 16:09:32 +0200 (CEST) Received: from support.bugseng.com (support.bugseng.com [162.55.131.47]) by support.bugseng.com (Postfix) with ESMTPA id 64EFC4EE073F; Wed, 9 Aug 2023 16:09:31 +0200 (CEST) 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: 5c706ae3-36be-11ee-8613-37d641c3527e MIME-Version: 1.0 Date: Wed, 09 Aug 2023 16:09:31 +0200 From: Nicola Vetrini To: Luca Fancellu Cc: Xen-devel , Stefano Stabellini , michal.orzel@amd.com, xenia.ragiadakou@amd.com, ayan.kumar.halder@amd.com, consulting@bugseng.com, Andrew Cooper , George Dunlap , Jan Beulich , Julien Grall , Wei Liu Subject: Re: [XEN PATCH 2/2] xen/delay: address MISRA C:2012 Rule 5.3. In-Reply-To: References: <47e2c8770e38ab064cbcdfaafa8467c5e733f11d.1691567429.git.nicola.vetrini@bugseng.com> User-Agent: Roundcube Webmail/1.4.3 Message-ID: X-Sender: nicola.vetrini@bugseng.com Organization: BUGSENG s.r.l. Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit On 09/08/2023 15:56, Luca Fancellu wrote: >> On 9 Aug 2023, at 08:55, Nicola Vetrini >> wrote: >> >> The variable 'msec' declared in the macro shadows the local >> variable in 'ehci_dbgp_bios_handoff', but to prevent any >> future clashes with other functions the macro is converted to >> a static inline function. >> >> No functional change. >> >> Signed-off-by: Nicola Vetrini >> --- >> xen/include/xen/delay.h | 8 ++++++-- >> 1 file changed, 6 insertions(+), 2 deletions(-) >> >> diff --git a/xen/include/xen/delay.h b/xen/include/xen/delay.h >> index 9d70ef035f..9150226271 100644 >> --- a/xen/include/xen/delay.h >> +++ b/xen/include/xen/delay.h >> @@ -4,7 +4,11 @@ >> /* Copyright (C) 1993 Linus Torvalds */ >> >> #include >> -#define mdelay(n) (\ >> - {unsigned long msec=(n); while (msec--) udelay(1000);}) >> + >> +static inline void mdelay(unsigned long msec) >> +{ >> + while ( msec-- ) > > Does misra allows to modify the function parameters? (Truly asking > because IDK) > I checked: there's an advisory (R17.8) that disallows this, but since advisories (apart from a couple of selected ones) are not taken into consideration for compliance, so it's not a big deal. Even less so since it's not a pointer type. -- Nicola Vetrini, BSc Software Engineer, BUGSENG srl (https://bugseng.com)