Re: [PATCH v11 4/9] mfd: mt6397: Use MFD_CELL_* to describe sub-devices

From: Lee Jones

Date: Tue Nov 03 2026 - 10:31:49 EST


On Wed, 21 Oct 2026, Luca Leonardo Scorcia wrote:

> Use the MFD_CELL_* macros to describe sub-devices. No functional changes.
>
> Signed-off-by: Luca Leonardo Scorcia <l.scorcia@xxxxxxxxx>
> Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@xxxxxxxxxxxxx>
> ---
> drivers/mfd/mt6397-core.c | 207 ++++++++++++--------------------------
> 1 file changed, 67 insertions(+), 140 deletions(-)
>
> diff --git a/drivers/mfd/mt6397-core.c b/drivers/mfd/mt6397-core.c
> index 9ec951996588..3e08179002fa 100644
> --- a/drivers/mfd/mt6397-core.c
> +++ b/drivers/mfd/mt6397-core.c
> @@ -124,165 +124,92 @@ static const struct resource mt6323_pwrc_resources[] = {
> };
>
> static const struct mfd_cell mt6323_devs[] = {
> - {
> - .name = "mt6323-auxadc",
> - .of_compatible = "mediatek,mt6323-auxadc",
> - }, {
> - .name = "mt6323-efuse",
> - .of_compatible = "mediatek,mt6323-efuse",
> - }, {
> - .name = "mt6323-rtc",
> - .num_resources = ARRAY_SIZE(mt6323_rtc_resources),
> - .resources = mt6323_rtc_resources,
> - .of_compatible = "mediatek,mt6323-rtc",
> - }, {
> - .name = "mt6323-regulator",
> - .of_compatible = "mediatek,mt6323-regulator"
> - }, {
> - .name = "mt6323-led",
> - .of_compatible = "mediatek,mt6323-led"
> - }, {
> - .name = "mt6323-keys",
> - .num_resources = ARRAY_SIZE(mt6323_keys_resources),
> - .resources = mt6323_keys_resources,
> - .of_compatible = "mediatek,mt6323-keys"
> - }, {
> - .name = "mt6323-pwrc",
> - .num_resources = ARRAY_SIZE(mt6323_pwrc_resources),
> - .resources = mt6323_pwrc_resources,
> - .of_compatible = "mediatek,mt6323-pwrc"
> - },
> + MFD_CELL_OF("mt6323-auxadc", NULL, NULL, 0, 0,
> + "mediatek,mt6323-auxadc"),
> + MFD_CELL_OF("mt6323-efuse", NULL, NULL, 0, 0,
> + "mediatek,mt6323-efuse"),
> + MFD_CELL_OF("mt6323-rtc", mt6323_rtc_resources, NULL, 0, 0,
> + "mediatek,mt6323-rtc"),
> + MFD_CELL_OF("mt6323-regulator", NULL, NULL, 0, 0,
> + "mediatek,mt6323-regulator"),
> + MFD_CELL_OF("mt6323-led", NULL, NULL, 0, 0,
> + "mediatek,mt6323-led"),
> + MFD_CELL_OF("mt6323-keys", mt6323_keys_resources, NULL, 0, 0,
> + "mediatek,mt6323-keys"),
> + MFD_CELL_OF("mt6323-pwrc", mt6323_pwrc_resources, NULL, 0, 0,

Nit: This is non-blocking, but if you have to respin, please use the
100-char limit to keep these on single lines where possible. Same for
all the others below.

> + "mediatek,mt6323-pwrc"),
> };
>
> static const struct mfd_cell mt6328_devs[] = {
> - {
> - .name = "mt6328-regulator",
> - .of_compatible = "mediatek,mt6328-regulator"
> - }, {
> - .name = "mt6328-keys",
> - .num_resources = ARRAY_SIZE(mt6328_keys_resources),
> - .resources = mt6328_keys_resources,
> - .of_compatible = "mediatek,mt6328-keys"
> - },
> + MFD_CELL_OF("mt6328-regulator", NULL, NULL, 0, 0,
> + "mediatek,mt6328-regulator"),
> + MFD_CELL_OF("mt6328-keys", mt6328_keys_resources, NULL, 0, 0,
> + "mediatek,mt6328-keys"),
> };
>
> static const struct mfd_cell mt6357_devs[] = {
> - {
> - .name = "mt6359-auxadc",
> - .of_compatible = "mediatek,mt6357-auxadc"
> - }, {
> - .name = "mt6357-regulator",
> - }, {
> - .name = "mt6357-rtc",
> - .num_resources = ARRAY_SIZE(mt6357_rtc_resources),
> - .resources = mt6357_rtc_resources,
> - .of_compatible = "mediatek,mt6357-rtc",
> - }, {
> - .name = "mt6357-sound",
> - .of_compatible = "mediatek,mt6357-sound"
> - }, {
> - .name = "mt6357-keys",
> - .num_resources = ARRAY_SIZE(mt6357_keys_resources),
> - .resources = mt6357_keys_resources,
> - .of_compatible = "mediatek,mt6357-keys"
> - },
> + MFD_CELL_OF("mt6359-auxadc", NULL, NULL, 0, 0,
> + "mediatek,mt6357-auxadc"),
> + MFD_CELL_NAME("mt6357-regulator"),
> + MFD_CELL_OF("mt6357-rtc", mt6357_rtc_resources, NULL, 0, 0,
> + "mediatek,mt6357-rtc"),
> + MFD_CELL_OF("mt6357-sound", NULL, NULL, 0, 0,
> + "mediatek,mt6357-sound"),
> + MFD_CELL_OF("mt6357-keys", mt6357_keys_resources, NULL, 0, 0,
> + "mediatek,mt6357-keys"),
> };
>
> /* MT6331 is always used in combination with MT6332 */
> static const struct mfd_cell mt6331_mt6332_devs[] = {
> - {
> - .name = "mt6331-rtc",
> - .num_resources = ARRAY_SIZE(mt6331_rtc_resources),
> - .resources = mt6331_rtc_resources,
> - .of_compatible = "mediatek,mt6331-rtc",
> - }, {
> - .name = "mt6331-regulator",
> - .of_compatible = "mediatek,mt6331-regulator"
> - }, {
> - .name = "mt6332-regulator",
> - .of_compatible = "mediatek,mt6332-regulator"
> - }, {
> - .name = "mt6331-keys",
> - .num_resources = ARRAY_SIZE(mt6331_keys_resources),
> - .resources = mt6331_keys_resources,
> - .of_compatible = "mediatek,mt6331-keys"
> - },
> + MFD_CELL_OF("mt6331-rtc", mt6331_rtc_resources, NULL, 0, 0,
> + "mediatek,mt6331-rtc"),
> + MFD_CELL_OF("mt6331-regulator", NULL, NULL, 0, 0,
> + "mediatek,mt6331-regulator"),
> + MFD_CELL_OF("mt6332-regulator", NULL, NULL, 0, 0,
> + "mediatek,mt6332-regulator"),
> + MFD_CELL_OF("mt6331-keys", mt6331_keys_resources, NULL, 0, 0,
> + "mediatek,mt6331-keys"),
> };
>
> static const struct mfd_cell mt6358_devs[] = {
> - {
> - .name = "mt6359-auxadc",
> - .of_compatible = "mediatek,mt6358-auxadc"
> - }, {
> - .name = "mt6358-regulator",
> - .of_compatible = "mediatek,mt6358-regulator"
> - }, {
> - .name = "mt6358-rtc",
> - .num_resources = ARRAY_SIZE(mt6358_rtc_resources),
> - .resources = mt6358_rtc_resources,
> - .of_compatible = "mediatek,mt6358-rtc",
> - }, {
> - .name = "mt6358-sound",
> - .of_compatible = "mediatek,mt6358-sound"
> - }, {
> - .name = "mt6358-keys",
> - .num_resources = ARRAY_SIZE(mt6358_keys_resources),
> - .resources = mt6358_keys_resources,
> - .of_compatible = "mediatek,mt6358-keys"
> - },
> + MFD_CELL_OF("mt6359-auxadc", NULL, NULL, 0, 0,
> + "mediatek,mt6358-auxadc"),
> + MFD_CELL_OF("mt6358-regulator", NULL, NULL, 0, 0,
> + "mediatek,mt6358-regulator"),
> + MFD_CELL_OF("mt6358-rtc", mt6358_rtc_resources, NULL, 0, 0,
> + "mediatek,mt6358-rtc"),
> + MFD_CELL_OF("mt6358-sound", NULL, NULL, 0, 0,
> + "mediatek,mt6358-sound"),
> + MFD_CELL_OF("mt6358-keys", mt6358_keys_resources, NULL, 0, 0,
> + "mediatek,mt6358-keys"),
> };
>
> static const struct mfd_cell mt6359_devs[] = {
> - {
> - .name = "mt6359-auxadc",
> - .of_compatible = "mediatek,mt6359-auxadc"
> - },
> - { .name = "mt6359-regulator", },
> - {
> - .name = "mt6359-rtc",
> - .num_resources = ARRAY_SIZE(mt6358_rtc_resources),
> - .resources = mt6358_rtc_resources,
> - .of_compatible = "mediatek,mt6358-rtc",
> - },
> - { .name = "mt6359-sound", },
> - {
> - .name = "mt6359-keys",
> - .num_resources = ARRAY_SIZE(mt6359_keys_resources),
> - .resources = mt6359_keys_resources,
> - .of_compatible = "mediatek,mt6359-keys"
> - },
> - {
> - .name = "mt6359-accdet",
> - .of_compatible = "mediatek,mt6359-accdet",
> - .num_resources = ARRAY_SIZE(mt6359_accdet_resources),
> - .resources = mt6359_accdet_resources,
> - },
> + MFD_CELL_OF("mt6359-auxadc", NULL, NULL, 0, 0,
> + "mediatek,mt6359-auxadc"),
> + MFD_CELL_NAME("mt6359-regulator"),
> + MFD_CELL_OF("mt6359-rtc", mt6358_rtc_resources, NULL, 0, 0,
> + "mediatek,mt6358-rtc"),
> + MFD_CELL_NAME("mt6359-sound"),
> + MFD_CELL_OF("mt6359-keys", mt6359_keys_resources, NULL, 0, 0,
> + "mediatek,mt6359-keys"),
> + MFD_CELL_OF("mt6359-accdet", mt6359_accdet_resources, NULL, 0, 0,
> + "mediatek,mt6359-accdet"),
> };
>
> static const struct mfd_cell mt6397_devs[] = {
> - {
> - .name = "mt6397-rtc",
> - .num_resources = ARRAY_SIZE(mt6397_rtc_resources),
> - .resources = mt6397_rtc_resources,
> - .of_compatible = "mediatek,mt6397-rtc",
> - }, {
> - .name = "mt6397-regulator",
> - .of_compatible = "mediatek,mt6397-regulator",
> - }, {
> - .name = "mt6397-codec",
> - .of_compatible = "mediatek,mt6397-codec",
> - }, {
> - .name = "mt6397-clk",
> - .of_compatible = "mediatek,mt6397-clk",
> - }, {
> - .name = "mt6397-pinctrl",
> - .of_compatible = "mediatek,mt6397-pinctrl",
> - }, {
> - .name = "mt6397-keys",
> - .num_resources = ARRAY_SIZE(mt6397_keys_resources),
> - .resources = mt6397_keys_resources,
> - .of_compatible = "mediatek,mt6397-keys"
> - }
> + MFD_CELL_OF("mt6397-rtc", mt6397_rtc_resources, NULL, 0, 0,
> + "mediatek,mt6397-rtc"),
> + MFD_CELL_OF("mt6397-regulator", NULL, NULL, 0, 0,
> + "mediatek,mt6397-regulator"),
> + MFD_CELL_OF("mt6397-codec", NULL, NULL, 0, 0,
> + "mediatek,mt6397-codec"),
> + MFD_CELL_OF("mt6397-clk", NULL, NULL, 0, 0,
> + "mediatek,mt6397-clk"),
> + MFD_CELL_OF("mt6397-pinctrl", NULL, NULL, 0, 0,
> + "mediatek,mt6397-pinctrl"),
> + MFD_CELL_OF("mt6397-keys", mt6397_keys_resources, NULL, 0, 0,
> + "mediatek,mt6397-keys"),
> };
>
> struct chip_data {
> --
> 2.43.0
>

--
Lee Jones