]> git.baikalelectronics.ru Git - kernel.git/commit
spi: dw: Convert to using the Bitfield access macros
authorBaikal Electronics <support@baikalelectronics.ru>
Mon, 15 Nov 2021 18:19:14 +0000 (21:19 +0300)
committerMark Brown <broonie@kernel.org>
Tue, 16 Nov 2021 14:30:06 +0000 (14:30 +0000)
commitf3472f78e7c17468e687c8d21d50d4e053ee3ae5
tree68c7577bcf61fedc2fd26cea936220a034fe2a06
parent17801c03a7b2d7f22036c672f2e433d689670211
spi: dw: Convert to using the Bitfield access macros

The driver has been using the offset/bitwise-shift-based approach for the
CSR fields R/W operations since it was merged into the kernel. It can be
simplified by using the macros defined in the linux/bitfield.h and
linux/bit.h header files like BIT(), GENMASK(), FIELD_PREP(), FIELD_GET(),
etc where it is required, for instance in the cached cr0 preparation
method. Thus in order to have the FIELD_*()-macros utilized we just need
to convert the macros with the CSR-fields offsets to the masks with the
corresponding registers fields definition. That's where the GENMASK() and
BIT() macros come in handy. After that the masks can be used in the
FIELD_*()-macros where it's appropriate.

We also need to convert the macros with the CRS-bit flags using the manual
bitwise shift operations (x << y) to using the BIT() macro. Thus we'll
have a more coherent set of the CSR-related macros.

Signed-off-by: Serge Semin <Sergey.Semin@baikalelectronics.ru>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/20211115181917.7521-5-Sergey.Semin@baikalelectronics.ru
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/spi/spi-dw-core.c
drivers/spi/spi-dw.h