Re: [PATCH v2 03/15] spi: Replace if-else-if by bitops and multiplications
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
- Subject: Re: [PATCH v2 03/15] spi: Replace if-else-if by bitops and multiplications
- From: Mark Brown <broonie@xxxxxxxxxx>
- Date: Mon, 10 Jul 2023 17:56:59 +0100
- Cc: Cristian Ciocaltea <cristian.ciocaltea@xxxxxxxxxxxxx>, Yang Yingliang <yangyingliang@xxxxxxxxxx>, Amit Kumar Mahapatra via Alsa-devel <alsa-devel@xxxxxxxxxxxxxxxx>, Neil Armstrong <neil.armstrong@xxxxxxxxxx>, Tharun Kumar P <tharunkumar.pasumarthi@xxxxxxxxxxxxx>, Vijaya Krishna Nivarthi <quic_vnivarth@xxxxxxxxxxx>, Uwe Kleine-König <u.kleine-koenig@xxxxxxxxxxxxxx>, linux-spi@xxxxxxxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx, linux-arm-kernel@xxxxxxxxxxxxxxxxxxx, linux-amlogic@xxxxxxxxxxxxxxxxxxx, linux-mediatek@xxxxxxxxxxxxxxxxxxx, linux-arm-msm@xxxxxxxxxxxxxxx, linux-rockchip@xxxxxxxxxxxxxxxxxxx, linux-riscv@xxxxxxxxxxxxxxxxxxx, linux-stm32@xxxxxxxxxxxxxxxxxxxxxxxxxxxx, linux-trace-kernel@xxxxxxxxxxxxxxx, netdev@xxxxxxxxxxxxxxx, Sanjay R Mehta <sanju.mehta@xxxxxxx>, Radu Pirea <radu_nicolae.pirea@xxxxxx>, Nicolas Ferre <nicolas.ferre@xxxxxxxxxxxxx>, Alexandre Belloni <alexandre.belloni@xxxxxxxxxxx>, Claudiu Beznea <claudiu.beznea@xxxxxxxxxxxxx>, Tudor Ambarus <tudor.ambarus@xxxxxxxxxx>, Serge Semin <fancer.lancer@xxxxxxxxx>, Shawn Guo <shawnguo@xxxxxxxxxx>, Sascha Hauer <s.hauer@xxxxxxxxxxxxxx>, Pengutronix Kernel Team <kernel@xxxxxxxxxxxxxx>, Fabio Estevam <festevam@xxxxxxxxx>, NXP Linux Team <linux-imx@xxxxxxx>, Kevin Hilman <khilman@xxxxxxxxxxxx>, Jerome Brunet <jbrunet@xxxxxxxxxxxx>, Martin Blumenstingl <martin.blumenstingl@xxxxxxxxxxxxxx>, Matthias Brugger <matthias.bgg@xxxxxxxxx>, AngeloGioacchino Del Regno <angelogioacchino.delregno@xxxxxxxxxxxxx>, Andy Gross <agross@xxxxxxxxxx>, Bjorn Andersson <andersson@xxxxxxxxxx>, Konrad Dybcio <konrad.dybcio@xxxxxxxxxx>, Heiko Stuebner <heiko@xxxxxxxxx>, Palmer Dabbelt <palmer@xxxxxxxxxxx>, Paul Walmsley <paul.walmsley@xxxxxxxxxx>, Orson Zhai <orsonzhai@xxxxxxxxx>, Baolin Wang <baolin.wang@xxxxxxxxxxxxxxxxx>, Chunyan Zhang <zhang.lyra@xxxxxxxxx>, Alain Volmat <alain.volmat@xxxxxxxxxxx>, Maxime Coquelin <mcoquelin.stm32@xxxxxxxxx>, Alexandre Torgue <alexandre.torgue@xxxxxxxxxxx>, Max Filippov <jcmvbkbc@xxxxxxxxx>, Steven Rostedt <rostedt@xxxxxxxxxxx>, Masami Hiramatsu <mhiramat@xxxxxxxxxx>, Richard Cochran <richardcochran@xxxxxxxxx>
- In-reply-to: <20230710154932.68377-4-andriy.shevchenko@linux.intel.com>
- References: <20230710154932.68377-1-andriy.shevchenko@linux.intel.com> <20230710154932.68377-4-andriy.shevchenko@linux.intel.com>
On Mon, Jul 10, 2023 at 06:49:20PM +0300, Andy Shevchenko wrote:
> - if (xfer->bits_per_word <= 8)
> - maxsize = maxwords;
> - else if (xfer->bits_per_word <= 16)
> - maxsize = 2 * maxwords;
> - else
> - maxsize = 4 * maxwords;
> -
> + maxsize = maxwords * roundup_pow_of_two(BITS_TO_BYTES(xfer->bits_per_word));
This will change the behaviour if bits_per_word is more than 32. That
is validated out elsewhere but I shouldn't have had to go around
checking the code to confirm that this is the case. This is the sort of
thing that should be highlighted when doing this sort of edge case
stylistic change.
Attachment:
signature.asc
Description: PGP signature
[Index of Archives]
[Linux Kernel]
[Linux ARM (vger)]
[Linux ARM MSM]
[Linux Omap]
[Linux Arm]
[Linux Tegra]
[Fedora ARM]
[Linux for Samsung SOC]
[eCos]
[Linux Fastboot]
[Gcc Help]
[Git]
[DCCP]
[IETF Announce]
[Security]
[Linux MIPS]
[Yosemite Campsites]
|