Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 4 Mar 2018 09:07:05 +1100 (EST)
From:      Bruce Evans <brde@optusnet.com.au>
To:        Ian Lepore <ian@freebsd.org>
Cc:        Konstantin Belousov <kostikbel@gmail.com>,  Hans Petter Selasky <hselasky@freebsd.org>, src-committers@freebsd.org,  svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   Re: svn commit: r330352 - in head/sys/compat/linuxkpi/common: include/linux src
Message-ID:  <20180304083915.E6774@besplex.bde.org>
In-Reply-To: <1520110970.23690.20.camel@freebsd.org>
References:  <201803031854.w23IsHxm086835@repo.freebsd.org>  <1520104482.23690.15.camel@freebsd.org> <20180303204913.GI3194@kib.kiev.ua> <1520110970.23690.20.camel@freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sat, 3 Mar 2018, Ian Lepore wrote:

> On Sat, 2018-03-03 at 22:49 +0200, Konstantin Belousov wrote:
>> ,,,
>> BTW mstosbt() and other functions have weird bracing in the formula. I
>> think that the formula as calculated by the C operator precedence is
>> fine, i.e. multiplication is done before right shift. But the bracing
>> is redundand then, because the '()' pair next to the return () braces by
>> inclusion is tautological.
>>
>
> Oh, on looking closer, it's not a paste-o, I just didn't put the
> closing paren where I had intended to for making it clear the shift
> happens last. =A0(So almost everyone except me is still going to think a
> fix has redundant parens.)

It is a good example of how redundant parentheses reduce readability.
Redundant parentheses make the non-redundant parentheses hard to see.
The most important ones are for _ms * (x / 500) (where x =3D
((uint64_t)1 << 63)).  These are needed since the natural expression
_ms * x / 500 would overflow since it is evaluated left to right.  Then
you want to add redundant parentheses for _ms * (x / 500) >> 32,
although both left to right evaluation and operator precedence work
right for that.  Then style(9) requires redundant parentheses for the
return value.  Normally I would parenthesize x * y >> z since I don't
remember the precedence of '>>' and suspect it is broken (*), but here
there are too many other parentheses.

(*) The precedence of '>>' is indeed broken.  It is like a division operato=
r
so should be at the same level or 1 lower.  But it is 2 lower (+ and - are
in between).  So x + y * z means x + (y * z), but x + y >> z means
(x + y) >> z.  So x + (y >> z) needs parentheses, and (x + y) >> z should
be parenthesized since it is surprising that its parentheses are redundant.

Bruce
From owner-svn-src-head@freebsd.org  Sat Mar  3 22:10:17 2018
Return-Path: <owner-svn-src-head@freebsd.org>
Delivered-To: svn-src-head@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 42C74F4093A;
 Sat,  3 Mar 2018 22:10:17 +0000 (UTC) (envelope-from ian@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org
 [IPv6:2610:1c1:1:606c::19:3])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (Client CN "mxrelay.nyi.freebsd.org",
 Issuer "Let's Encrypt Authority X3" (verified OK))
 by mx1.freebsd.org (Postfix) with ESMTPS id DD3CA7903D;
 Sat,  3 Mar 2018 22:10:16 +0000 (UTC) (envelope-from ian@FreeBSD.org)
Received: from repo.freebsd.org (repo.freebsd.org
 [IPv6:2610:1c1:1:6068::e6a:0])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (Client did not present a certificate)
 by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CED5346C1;
 Sat,  3 Mar 2018 22:10:16 +0000 (UTC) (envelope-from ian@FreeBSD.org)
Received: from repo.freebsd.org ([127.0.1.37])
 by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w23MAG1j083205;
 Sat, 3 Mar 2018 22:10:16 GMT (envelope-from ian@FreeBSD.org)
Received: (from ian@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id w23MAGXV083204;
 Sat, 3 Mar 2018 22:10:16 GMT (envelope-from ian@FreeBSD.org)
Message-Id: <201803032210.w23MAGXV083204@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org
 using -f
From: Ian Lepore <ian@FreeBSD.org>
Date: Sat, 3 Mar 2018 22:10:16 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r330360 - head/share/man/man9
X-SVN-Group: head
X-SVN-Commit-Author: ian
X-SVN-Commit-Paths: head/share/man/man9
X-SVN-Commit-Revision: 330360
X-SVN-Commit-Repository: base
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-head@freebsd.org
X-Mailman-Version: 2.1.25
Precedence: list
List-Id: SVN commit messages for the src tree for head/-current
 <svn-src-head.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-head/>;
List-Post: <mailto:svn-src-head@freebsd.org>
List-Help: <mailto:svn-src-head-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-head>,
 <mailto:svn-src-head-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Sat, 03 Mar 2018 22:10:17 -0000

Author: ian
Date: Sat Mar  3 22:10:16 2018
New Revision: 330360
URL: https://svnweb.freebsd.org/changeset/base/330360

Log:
  Minor (mostly) wording changes.

Modified:
  head/share/man/man9/fdt_pinctrl.9

Modified: head/share/man/man9/fdt_pinctrl.9
==============================================================================
--- head/share/man/man9/fdt_pinctrl.9	Sat Mar  3 21:50:55 2018	(r330359)
+++ head/share/man/man9/fdt_pinctrl.9	Sat Mar  3 22:10:16 2018	(r330360)
@@ -28,7 +28,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd March 2, 2018
+.Dd March 3, 2018
 .Dt fdt_pinctrl 9
 .Os
 .Sh NAME
@@ -50,15 +50,17 @@ provides an API for manipulating I/O pin configuration
 pinmux controllers and pinmux clients.
 On the controller side, the standard newbus probe and
 attach methods are implemented.
-This driver also implements the
-.Fn fdt_pinctrl_configure
-method, in which it calls the
+As part of handling attach, it calls the
 .Fn fdt_pinctrl_register
 function to register itself as a pinmux controller.
 Then
 .Fn fdt_pinctrl_configure_tree
 is used to walk the device tree and configure pins specified by the pinctrl-0
 property for all active devices.
+The driver also implements the
+.Fn fdt_pinctrl_configure
+method, which allows client devices to change their
+pin configurations after startup.
 If a client device requires a pin configuration change at some
 point of its lifecycle, it uses the
 .Fn fdt_pinctrl_configure
@@ -84,14 +86,9 @@ registers a pinctrl driver so that it can be used by o
 .Fn fdt_pinctrl_configure
 or
 .Fn fdt_pinctrl_configure_by_name .
-The
-.Fa pinprop
-argument is the name of a property that
-identifies each descendant of the pinctrl
-node.
-The pinctrl node is a pin configuration
-node whose xref phandle can be passed to
-.Fn FDT_PINCTRL_CONFIGURE .
+It also registers each child node of the pinctrl driver's node which contains
+a property with the name given in
+.Fa pinprop .
 If
 .Fa pinprop
 is



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20180304083915.E6774>