[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20211123153933.49ff8b72@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com>
Date: Tue, 23 Nov 2021 15:39:33 -0800
From: Jakub Kicinski <kuba@...nel.org>
To: Geert Uytterhoeven <geert@...ux-m68k.org>
Cc: Johannes Berg <johannes@...solutions.net>,
Tony Lindgren <tony@...mide.com>,
Russell King <linux@...linux.org.uk>,
Rajendra Nayak <rnayak@...eaurora.org>,
Paul Walmsley <paul@...an.com>,
Michael Turquette <mturquette@...libre.com>,
Stephen Boyd <sboyd@...nel.org>,
Nicolas Ferre <nicolas.ferre@...rochip.com>,
Alexandre Belloni <alexandre.belloni@...tlin.com>,
Ludovic Desroches <ludovic.desroches@...rochip.com>,
Tero Kristo <kristo@...nel.org>,
Jonathan Cameron <jic23@...nel.org>,
Lars-Peter Clausen <lars@...afoo.de>,
Lorenzo Bianconi <lorenzo.bianconi83@...il.com>,
Benoit Parrot <bparrot@...com>,
Mauro Carvalho Chehab <mchehab@...nel.org>,
Adrian Hunter <adrian.hunter@...el.com>,
Andrew Jeffery <andrew@...id.au>,
Ulf Hansson <ulf.hansson@...aro.org>,
Joel Stanley <joel@....id.au>,
Ping-Ke Shih <pkshih@...ltek.com>,
Kalle Valo <kvalo@...eaurora.org>,
"David S . Miller" <davem@...emloft.net>,
Linus Walleij <linus.walleij@...aro.org>,
Liam Girdwood <lgirdwood@...il.com>,
Mark Brown <broonie@...nel.org>,
Magnus Damm <magnus.damm@...il.com>,
Eduardo Valentin <edubezval@...il.com>,
Keerthy <j-keerthy@...com>,
"Rafael J . Wysocki" <rafael@...nel.org>,
Daniel Lezcano <daniel.lezcano@...aro.org>,
Amit Kucheria <amitk@...nel.org>,
Zhang Rui <rui.zhang@...el.com>,
Jaroslav Kysela <perex@...ex.cz>,
Takashi Iwai <tiwai@...e.com>,
linux-arm-kernel@...ts.infradead.org, linux-omap@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-clk@...r.kernel.org,
linux-renesas-soc@...r.kernel.org, linux-iio@...r.kernel.org,
linux-media@...r.kernel.org, linux-mmc@...r.kernel.org,
linux-aspeed@...ts.ozlabs.org, openbmc@...ts.ozlabs.org,
linux-wireless@...r.kernel.org, netdev@...r.kernel.org,
linux-gpio@...r.kernel.org, linux-pm@...r.kernel.org,
alsa-devel@...a-project.org
Subject: Re: [PATCH 01/17] bitfield: Add non-constant field_{prep,get}()
helpers
On Tue, 23 Nov 2021 09:36:22 +0100 Geert Uytterhoeven wrote:
> > > Also, you're using __ffs(), which doesn't work for 64-bit on 32-bit
> > > architectures (afaict), so that seems a bit awkward.
> > >
> > > Maybe we can make {u32,...}_get_bits() be doing compile-time only checks
> > > if it is indeed a constant? The __field_overflow() usage is already only
> > > done if __builtin_constant_p(v), so I guess we can do the same with
> > > __bad_mask()?
> >
> > Either that or add decomposition macros. Are compilers still really bad
> > at passing small structs by value?
>
> Sorry, I don't get what you mean by adding decomposition macros.
> Can you please elaborate?
#define DECOMPOSE(_mask) \
(struct bf){ .mask = _mask, .shf = __bf_shf(_mask), }
Then drivers can save or pass around the mask and shift params
broken apart as a small struct.
Powered by blists - more mailing lists