mfd: ti_am335x_tscadc: Drop useless definitions from the header
authorMiquel Raynal <miquel.raynal@bootlin.com>
Fri, 15 Oct 2021 08:14:47 +0000 (10:14 +0200)
committerLee Jones <lee.jones@linaro.org>
Thu, 21 Oct 2021 08:16:18 +0000 (09:16 +0100)
commit0fd12262613116a38fd76aefa396e9bc116fbfe2
tree7229f77be6bdd5829ed5927513b206fc2aa34a39
parente967b60eb51116d2347093655e555aa036dd40d8
mfd: ti_am335x_tscadc: Drop useless definitions from the header

Drop useless definitions from the header like the "masks" definitions
which are only used by the following definition.

It could be possible to got even further by removing these definitions
entirely and use FIELD_PREP() macros from the code directly, but while I
have no troubles making these changes in the header, changing the values
in the code directly could darkening a bit the logic and
hardening future git-blames for very little added value IMHO (but this
is of course a personal taste).

Certain macros are using GENMASK() to define the value of a particular
field, while this is purely "by chance" that the value and the mask have
the same value. In this case, drop the "mask" definition, use
FIELD_PREP() and GENMASK() in the macro defining the field, and use the
new macro to define the particular value by feeding directly the actual
number advertised in the datasheet into that macro, as in:
-#define STEPCONFIG_RFM_VREFN   GENMASK(24, 23)
-#define STEPCONFIG_RFM(val)    FIELD_PREP(STEPCONFIG_RFM_VREFN, (val))
+#define STEPCONFIG_RFM(val)    FIELD_PREP(GENMASK(24, 23), (val))
+#define STEPCONFIG_RFM_VREFN   STEPCONFIG_RFM(3)

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Link: https://lore.kernel.org/r/20211015081506.933180-30-miquel.raynal@bootlin.com
include/linux/mfd/ti_am335x_tscadc.h