soc: mediatek: pwrap: Move IO pointers to new structure
authorAngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Tue, 17 May 2022 10:47:11 +0000 (12:47 +0200)
committerMatthias Brugger <matthias.bgg@gmail.com>
Tue, 7 Jun 2022 16:25:15 +0000 (18:25 +0200)
commit43406cebf06b3519d10c665e6e0228be197b534c
treea8f4a7fd9cee73db2e19ba80e78e0201d086efb7
parent56a468b5f6454aae0e32e4c6ead1abde5cc4dd23
soc: mediatek: pwrap: Move IO pointers to new structure

In the PMIC Wrapper driver each PMIC has its own regmap configuration
and its own pwrap_{read/write}() callbacks, but it's just about either
a 32 bits vs 16 bits register, and only one of them uses 32bits regs:
this means that the same ops are assigned over and over again to all
of the supported PMICs.

It is therefore possible to avoid reassigning the same things over
and over, reducing the amount of lines, without any impact on human
readability of this driver: add a pwrap_slv_regops structure and
move the callbacks and regmap_config pointer in there instead.
This allows to assign just one pointer to that shared data in the
per-pmic struct pwrap_slv_type.

Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Link: https://lore.kernel.org/r/20220517104712.24579-5-angelogioacchino.delregno@collabora.com
Signed-off-by: Matthias Brugger <matthias.bgg@gmail.com>
drivers/soc/mediatek/mtk-pmic-wrap.c