Re: [PATCH v4 1/2] mfd: syscon: Support physical regmap bus

From: Arnd Bergmann
Date: Tue May 19 2020 - 09:19:14 EST


On Sat, May 16, 2020 at 12:13 PM Baolin Wang <baolin.wang7@xxxxxxxxx> wrote:
>
> Some platforms such as Spreadtrum platform, define a special method to
> update bits of the registers instead of reading and writing, which means
> we should use a physical regmap bus to define the reg_update_bits()
> operation instead of the MMIO regmap bus.
>
> Thus add a a __weak function for the syscon driver to allow to register
> a physical regmap bus to support this new requirement.
>
> };
>
> +struct regmap * __weak syscon_regmap_init(struct device_node *np,
> + void __iomem *base,
> + struct regmap_config *syscon_config)
> +{
> + return regmap_init_mmio(NULL, base, syscon_config);
> +}
> +

Sorry, I don't think the __weak function is going to help here. I'm not
sure whether it actually does what you want when both syscon and
sprd_syscon are loadable modules (I would guess not), but it clearly
won't work when syscon is built-in and sprd_syscon is a module, and
even if the module loader knows how to resolve __weak symbols,
I would not want to rely on module load ordering to make it behave
the right way.

Arnd