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

Re: [PATCH v1 20/29] xen/asm-generic: introduce stub header div64.h


  • To: Oleksii Kurochko <oleksii.kurochko@xxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Thu, 19 Oct 2023 13:12:08 +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=HLZsUKhIXPghoHJHATbYjETKwEOuoxAVnYN6srOTNUM=; b=c+mESyi3KieUvZnDh0jDf8EfYXMiZYEe8qC+cVkKfLqVRQucRO8HJbZHl0u/an9F80Q+trWhvp0BqKxFGYzvFSpz4TJLGBrp+yQaGOVf08DMz6POMwYm23wc9LwK3goYsyA3/NWg47uY2ZvKC+m8oyZZFttrt5gYmWNOXoAPHJM0PR7U1RC66HZP6CLCqO51uqOsDz4ZnLVawWbna7qwtTZv95/hWpKfloW8mAq2iwB5J7zqEyUt1j0vHF+zOlx6p3EM2Z141SZ2/EBaOJJAXlYh5LtUUh2QlufgEuSMhG8njfMFiPBJ2bIiNonm/KL8TLBxV+h2ACDwMLV+Pn+Qlw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DMmOJ/o/ASbT1zwfBXedWV4H4J3BQgshXLVOFo7IVnI6+mMX4N3mzEta6cvN2wlp17e+nZNW7demIMb88D+5lUr3cIwp69PBdb8baiIghjuwjlPVgTM+sQEF4dsDF1gCsjZ2xEK0LiEDN96hXDdGMT/3kvvZ2zX7huhAIARn9MGLo62VSl5KNTI6b3pkISM2zzyrzhrhopIIf1jYuIc/7Ii9p5mSqZMb8Dz4VHTcmiRfaFHYecobtsgJlxMRKQm1AIxbIV91PhCEYNwiYONpV76WDBkkypRJ7qdDxvLxk8/LKKkxiusLXynt816ozm3Sjl+Kz2SS/J+rUPT1xA6VHw==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Thu, 19 Oct 2023 11:12:17 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 14.09.2023 16:56, Oleksii Kurochko wrote:
> --- /dev/null
> +++ b/xen/include/asm-generic/div64.h
> @@ -0,0 +1,24 @@
> +/* SPDX-License-Identifier: GPL-2.0-only */
> +#ifndef __ASM_GENERIC_DIV64
> +#define __ASM_GENERIC_DIV64
> +
> +#include <xen/types.h>
> +
> +# define do_div(n,base) ({                                      \
> +        uint32_t __base = (base);                               \
> +        uint32_t __rem;                                         \
> +        __rem = ((uint64_t)(n)) % __base;                       \
> +        (n) = ((uint64_t)(n)) / __base;                         \
> +        __rem;                                                  \
> + })

While I'm fine with having just the BITS_PER_LONG == 64 implementation
here, this then still needs to have the #if retained that Arm has. Only
with that will it then be fine to have a blank between # and define.

There are style issues though: A blank is missing after the comma,
and according to recent agreement leading underscores should not be
used for symbols like the ones here anymore (I also wonder whether
"base" is really a good name for the symbol; "divisor" may be more to
the point). There are also excess parentheses around the two cast
expressions.

Jan



 


Rackspace

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