Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp2972549pxb; Mon, 19 Apr 2021 19:53:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxl6UweI8Q3aN4it1U8cYFJWDts2nPZ3wzWlMG+o8OZWhCseU2WaGGkfgDJorqYo7kIo1ms X-Received: by 2002:a05:6402:110b:: with SMTP id u11mr30537203edv.356.1618887230891; Mon, 19 Apr 2021 19:53:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618887230; cv=none; d=google.com; s=arc-20160816; b=GGvUpUF1ue3Bm2C8Xibazopekm0mOvK8S8D876Bg/I7IysNPoWZ4T0LtP03syaK4W+ JQIshuvKl5oZakSGzgdDsB0EFwGztIwX6jRxluF4ij6Exn6ofmYb/o/slE/YTinMaxZK dBZPpsdtcM3PTCMdKnwFlbJK3yIGeRMNncqta0S56krgO9fTsw63GF1axgh1HnX2EKKh xK4XPYrfazaoLlsammbQpxxBj+vuHMGt4TxlLAuTu5zIcC31/6qll++JclfmatuVwsas mrn+X/7YA7JCzfvwOvXrZvXzIYRXocrzArzL5UgBoF++EaLcW8KnNrZMXVcb9QTNTkH/ Hzlw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:references:message-id :in-reply-to:subject:cc:to:from:date; bh=VelAw2REbFlIziW8xX3vAbWcldUYuW3XTLnXNzY8ULM=; b=WWVqDBIdw5Ms1JXCo27HywKasJYcAfL1UklREsf2iFeL3wrsyNWAYJd7c+kVf9lkUN bnKhWq7o9CwNUkMN/Pw4SI/hIFS5uW62PBXxQB+nmv0bZP+MbPcTghmTjMGhaxcJAXuI Eu4Y5huMCQU0SNLpHj13YNS6C9Epg0zbMSKRjs63YBIB+2eNq0OUjEmEy4HdNebL43TG PCR+YKwgN7diBwfESetVhgZFPjeEmcCZpH0b8zYQic3JLCJ60XJB/kpDxwStwjByK2gt XWY5PTGdjZoDxzlcV2x8C7siz82nMjfQn7kJq+X6ccJqhz0/glHWArUclysoHUcu4mA1 TYxw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id hj9si13520337ejb.190.2021.04.19.19.53.27; Mon, 19 Apr 2021 19:53:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233766AbhDTCvG (ORCPT + 99 others); Mon, 19 Apr 2021 22:51:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39314 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229508AbhDTCvE (ORCPT ); Mon, 19 Apr 2021 22:51:04 -0400 Received: from angie.orcam.me.uk (angie.orcam.me.uk [IPv6:2001:4190:8020::4]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 3D8F6C06174A; Mon, 19 Apr 2021 19:50:34 -0700 (PDT) Received: by angie.orcam.me.uk (Postfix, from userid 500) id 8B4E79200BB; Tue, 20 Apr 2021 04:50:33 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by angie.orcam.me.uk (Postfix) with ESMTP id 846FD9200B4; Tue, 20 Apr 2021 04:50:33 +0200 (CEST) Date: Tue, 20 Apr 2021 04:50:33 +0200 (CEST) From: "Maciej W. Rozycki" To: Arnd Bergmann , Thomas Bogendoerfer cc: Huacai Chen , Huacai Chen , Jiaxun Yang , linux-arch@vger.kernel.org, linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/4] div64: Correct inline documentation for `do_div' In-Reply-To: Message-ID: References: User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Correct inline documentation for `do_div', which is a function-like macro the `n' parameter of which has the semantics of a C++ reference: it is both read and written in the context of the caller without an explicit dereference such as with a pointer. In the C programming language it has no equivalent for proper functions, in terms of which the documentation expresses the semantics of `do_div', but substituting a pointer in documentation is misleading, and using the C++ notation should at least raise the reader's attention and encourage to seek explanation even if the C++ semantics is not readily understood. While at it observe that "semantics" is an uncountable noun, so refer to it with a singular rather than plural verb. Signed-off-by: Maciej W. Rozycki --- NB there's a `checkpatch.pl' warning for tabs preceded by spaces, but that is just the style of the piece of code quoted and I can see no gain from changing it or worse yet making inconsistent. --- include/asm-generic/div64.h | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) linux-div64-doc-fix.diff Index: linux-3maxp-div64/include/asm-generic/div64.h =================================================================== --- linux-3maxp-div64.orig/include/asm-generic/div64.h +++ linux-3maxp-div64/include/asm-generic/div64.h @@ -8,12 +8,14 @@ * Optimization for constant divisors on 32-bit machines: * Copyright (C) 2006-2015 Nicolas Pitre * - * The semantics of do_div() are: + * The semantics of do_div() is, in C++ notation, observing that the name + * is a function-like macro and the n parameter has the semantics of a C++ + * reference: * - * uint32_t do_div(uint64_t *n, uint32_t base) + * uint32_t do_div(uint64_t &n, uint32_t base) * { - * uint32_t remainder = *n % base; - * *n = *n / base; + * uint32_t remainder = n % base; + * n = n / base; * return remainder; * } *