From: Paul Kocialkowski <paul.kocialkowski@bootlin.com>
To: Russell King - ARM Linux admin <linux@armlinux.org.uk>
Cc: megous@megous.com, mark.rutland@arm.com, arnd@arndb.de,
devicetree@vger.kernel.org, gregkh@linuxfoundation.org,
linux-kernel@vger.kernel.org,
Rikard Falkeborn <rikard.falkeborn@gmail.com>,
kishon@ti.com, linux-sunxi@googlegroups.com, robh+dt@kernel.org,
mripard@kernel.org, tglx@linutronix.de, wens@csie.org,
linux-arm-kernel@lists.infradead.org, icenowy@aosc.io
Subject: Re: [PATCH] phy: allwinner: Fix GENMASK misuse
Date: Fri, 8 Nov 2019 09:29:07 +0100 [thread overview]
Message-ID: <20191108082907.GA848664@aptenodytes> (raw)
In-Reply-To: <20191107233914.GW25745@shell.armlinux.org.uk>
[-- Attachment #1.1: Type: text/plain, Size: 1651 bytes --]
Hi,
On Thu 07 Nov 19, 23:39, Russell King - ARM Linux admin wrote:
> On Thu, Nov 07, 2019 at 09:46:45PM +0100, Rikard Falkeborn wrote:
> > Arguments are supposed to be ordered high then low.
> >
> > Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com>
> > ---
> > Spotted while trying to add compile time checks of GENMASK arguments.
> > Patch has only been compile tested.
>
> My feeling, personally, is that GENMASK() really isn't worth the pain
> it causes. Can we instead get rid of this thing and just use easier
> to understand and less error-prone hex masks please?
One advantage it has is that is matches the order in which bit fields are
usually given in datasheets, so I personally found that it makes verification
of fields much more straightforward and immediate.
My 2 cents are that it makes sense for hardware registers.
Note that I have recently introduced a SHIFT_AND_MASK_BITS macro[0] for a V4L2
driver, that I (and Mauro) would like to move to linux/bits.h eventually.
> I don't care what anyone else says, personally I'm going to stick with
> using hex masks as I find them way easier to get right first time than
> a problematical opaque macro - and I really don't want the effort of
> finding out that I've got the arguments wrong when I build it. It's
> just _way_ easier and less error prone to use a hex mask straight off.
I guess it's a matter of personal habit.
[0]: https://git.linuxtv.org/media_tree.git/commit/?id=06eff2150d4db991ca236f3d05a9dc0101475aea
Cheers,
Paul
--
Paul Kocialkowski, Bootlin
Embedded Linux and kernel engineering
https://bootlin.com
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
[-- Attachment #2: Type: text/plain, Size: 176 bytes --]
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
WARNING: multiple messages have this Message-ID (diff)
From: Paul Kocialkowski <paul.kocialkowski@bootlin.com>
To: Russell King - ARM Linux admin <linux@armlinux.org.uk>
Cc: Rikard Falkeborn <rikard.falkeborn@gmail.com>,
megous@megous.com, mark.rutland@arm.com,
devicetree@vger.kernel.org, arnd@arndb.de,
gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org,
mripard@kernel.org, kishon@ti.com, linux-sunxi@googlegroups.com,
robh+dt@kernel.org, tglx@linutronix.de, wens@csie.org,
linux-arm-kernel@lists.infradead.org, icenowy@aosc.io
Subject: Re: [PATCH] phy: allwinner: Fix GENMASK misuse
Date: Fri, 8 Nov 2019 09:29:07 +0100 [thread overview]
Message-ID: <20191108082907.GA848664@aptenodytes> (raw)
In-Reply-To: <20191107233914.GW25745@shell.armlinux.org.uk>
[-- Attachment #1: Type: text/plain, Size: 1651 bytes --]
Hi,
On Thu 07 Nov 19, 23:39, Russell King - ARM Linux admin wrote:
> On Thu, Nov 07, 2019 at 09:46:45PM +0100, Rikard Falkeborn wrote:
> > Arguments are supposed to be ordered high then low.
> >
> > Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com>
> > ---
> > Spotted while trying to add compile time checks of GENMASK arguments.
> > Patch has only been compile tested.
>
> My feeling, personally, is that GENMASK() really isn't worth the pain
> it causes. Can we instead get rid of this thing and just use easier
> to understand and less error-prone hex masks please?
One advantage it has is that is matches the order in which bit fields are
usually given in datasheets, so I personally found that it makes verification
of fields much more straightforward and immediate.
My 2 cents are that it makes sense for hardware registers.
Note that I have recently introduced a SHIFT_AND_MASK_BITS macro[0] for a V4L2
driver, that I (and Mauro) would like to move to linux/bits.h eventually.
> I don't care what anyone else says, personally I'm going to stick with
> using hex masks as I find them way easier to get right first time than
> a problematical opaque macro - and I really don't want the effort of
> finding out that I've got the arguments wrong when I build it. It's
> just _way_ easier and less error prone to use a hex mask straight off.
I guess it's a matter of personal habit.
[0]: https://git.linuxtv.org/media_tree.git/commit/?id=06eff2150d4db991ca236f3d05a9dc0101475aea
Cheers,
Paul
--
Paul Kocialkowski, Bootlin
Embedded Linux and kernel engineering
https://bootlin.com
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
next prev parent reply other threads:[~2019-11-08 8:29 UTC|newest]
Thread overview: 47+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-20 13:42 [PATCH 0/4] Add USB 3 support for H6 and Orange Pi 3 megous
2019-10-20 13:42 ` megous
2019-10-20 13:42 ` [PATCH 1/4] dt-bindings: Add bindings for USB3 phy on Allwinner H6 megous
2019-10-20 13:42 ` megous
2019-10-21 11:06 ` Maxime Ripard
2019-10-21 11:06 ` Maxime Ripard
2019-10-20 13:42 ` [PATCH 2/4] phy: allwinner: add phy driver for USB3 PHY on Allwinner H6 SoC megous
2019-10-20 13:42 ` megous
2019-10-21 11:08 ` Maxime Ripard
2019-10-21 11:08 ` Maxime Ripard
2019-11-07 20:46 ` [PATCH] phy: allwinner: Fix GENMASK misuse Rikard Falkeborn
2019-11-07 20:46 ` Rikard Falkeborn
2019-11-07 21:45 ` Ondřej Jirman
2019-11-07 21:45 ` Ondřej Jirman
2019-11-08 11:29 ` Icenowy Zheng
2019-11-08 11:29 ` Icenowy Zheng
2019-11-08 11:41 ` Ondřej Jirman
2019-11-08 11:41 ` Ondřej Jirman
2019-11-08 11:43 ` Ondřej Jirman
2019-11-08 11:43 ` Ondřej Jirman
2019-11-07 23:39 ` Russell King - ARM Linux admin
2019-11-07 23:39 ` Russell King - ARM Linux admin
2019-11-08 1:46 ` Joe Perches
2019-11-08 1:46 ` Joe Perches
2019-11-08 8:29 ` Paul Kocialkowski [this message]
2019-11-08 8:29 ` Paul Kocialkowski
2019-11-10 12:43 ` [PATCH v2] " Rikard Falkeborn
2020-02-22 23:41 ` [PATCH v2 RESEND] " Ondrej Jirman
2019-11-10 12:43 ` [PATCH v2] " Rikard Falkeborn
2019-11-24 22:10 ` Rikard Falkeborn
2019-11-24 22:10 ` Rikard Falkeborn
2019-12-09 20:18 ` Rikard Falkeborn
2019-12-09 20:18 ` Rikard Falkeborn
2020-02-23 3:23 ` [linux-sunxi] [PATCH v2 RESEND] " Chen-Yu Tsai
2020-02-23 3:23 ` Chen-Yu Tsai
2020-02-24 9:18 ` Maxime Ripard
2020-02-24 9:18 ` Maxime Ripard
2019-10-20 13:42 ` [PATCH 3/4] arm64: dts: allwinner: h6: add USB3 device nodes megous
2019-10-20 13:42 ` megous
2019-10-20 13:42 ` [PATCH 4/4] arm64: dts: allwinner: orange-pi-3: Enable USB 3.0 host support megous
2019-10-20 13:42 ` megous
2019-10-21 11:09 ` Maxime Ripard
2019-10-21 11:09 ` Maxime Ripard
2019-11-04 12:16 ` Ondřej Jirman
2019-11-04 12:16 ` Ondřej Jirman
2019-11-05 10:45 ` Maxime Ripard
2019-11-05 10:45 ` Maxime Ripard
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20191108082907.GA848664@aptenodytes \
--to=paul.kocialkowski@bootlin.com \
--cc=arnd@arndb.de \
--cc=devicetree@vger.kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=icenowy@aosc.io \
--cc=kishon@ti.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sunxi@googlegroups.com \
--cc=linux@armlinux.org.uk \
--cc=mark.rutland@arm.com \
--cc=megous@megous.com \
--cc=mripard@kernel.org \
--cc=rikard.falkeborn@gmail.com \
--cc=robh+dt@kernel.org \
--cc=tglx@linutronix.de \
--cc=wens@csie.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.