[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [XEN PATCH][for-next v2 6/8] x86/mce: Move MC_NCLASSES into the enum mctelem_class


  • To: Nicola Vetrini <nicola.vetrini@xxxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Mon, 16 Oct 2023 17:45:19 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=5MtG5WG8C8z5WHNmPe3GjTvrXlY7bDtxauhg/a5/8hE=; b=elf04errhjTyTWH/s0xTsAMCbHZMxGx/pisZZUQLA8duffSeP0jEcfBj3EZkRm2u9dPgDh+rNSYtZ8R21VIv3CqnvAdhlYr+SCHaU7TSEROtdXtR6EBK7EoT05lx2Tw5zHF77h+ZtCQLA64l+7FYPTnwJeqHE/iLpSxaRVKr+ZYsM0qmXsSnE4L0UO3zN5N92FCiF+Beus1MgPVNPM6uu7riqJNtmycTUs5dOSDRNe8BLvzv4uGBjrp6XOwt/ebkepvbaHbw1VzZ1l99AUka85GczZC9fUQ7jnBZjpX0fd5KnRlln7afxVD4iKjs799H+Y3pQcW47ukl3c3uAlcB0w==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XvOppz9UAZkB5KEatf9xNpsGhmegQsDFunLfnaRJHw7fjR2oLcv/V2MH5veeRtjpKdQjhsDZShOlkN6P7jWgDJDLsDw7eTJ413qRdtqZrhJA53WAFKJfKMqS+Xd05AjCF+DPy+xdbnr1dpQcueNgpTUFUg2sP6mVs9Ymc55W3filuM3wlKCfO5D+X3B2A/C4lAZ4O6UFKSx7+/zrSG1dUtfZ5T+cqxWHj6J1B1FHmh3WyHVXtdzmd22QPfzHSaoG18pz0M2kuxsd+ojTIQL8zvmL0ZiANb6x76hzLBXWN6oR2ZaHKIvDtTanjaJGqc4KQnEPoH+9I10wqgHT9Svs0Q==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: sstabellini@xxxxxxxxxx, michal.orzel@xxxxxxx, xenia.ragiadakou@xxxxxxx, ayan.kumar.halder@xxxxxxx, consulting@xxxxxxxxxxx, andrew.cooper3@xxxxxxxxxx, roger.pau@xxxxxxxxxx, Wei Liu <wl@xxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Mon, 16 Oct 2023 15:45:56 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 12.10.2023 17:28, Nicola Vetrini wrote:
> The definition of MC_NCLASSES contained a violation of MISRA C:2012
> Rule 10.1, therefore by moving it as an enumeration constant resolves the
> violation and makes it more resilient to possible additions to that enum.

And using an enumerator as array dimension specifier is okay for Misra?
That would be odd when elsewhere named enums are treated specially.

Jan

> --- a/xen/arch/x86/cpu/mcheck/mctelem.c
> +++ b/xen/arch/x86/cpu/mcheck/mctelem.c
> @@ -64,8 +64,6 @@ struct mctelem_ent {
>  
>  #define MC_NENT (MC_URGENT_NENT + MC_NONURGENT_NENT)
>  
> -#define      MC_NCLASSES             (MC_NONURGENT + 1)
> -
>  #define      COOKIE2MCTE(c)          ((struct mctelem_ent *)(c))
>  #define      MCTE2COOKIE(tep)        ((mctelem_cookie_t)(tep))
>  
> diff --git a/xen/arch/x86/cpu/mcheck/mctelem.h 
> b/xen/arch/x86/cpu/mcheck/mctelem.h
> index d4eba53ae0e5..21b251847bc0 100644
> --- a/xen/arch/x86/cpu/mcheck/mctelem.h
> +++ b/xen/arch/x86/cpu/mcheck/mctelem.h
> @@ -55,8 +55,9 @@
>  typedef struct mctelem_cookie *mctelem_cookie_t;
>  
>  typedef enum mctelem_class {
> -     MC_URGENT,
> -     MC_NONURGENT
> +    MC_URGENT,
> +    MC_NONURGENT,
> +    MC_NCLASSES
>  } mctelem_class_t;
>  
>  extern void mctelem_init(unsigned int);




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.