Re: [RESEND PATCH v16 mfd 1/8] mfd: ocelot: add helper to get regmap from a resource

Lee Jones
2022-09-08T09:41:06Z

On Mon, 05 Sep 2022, Colin Foster wrote:

> Several ocelot-related modules are designed for MMIO / regmaps. As such,
> they often use a combination of devm_platform_get_and_ioremap_resource()
> and devm_regmap_init_mmio().
>
> Operating in an MFD might be different, in that it could be memory mapped,
> or it could be SPI, I2C... In these cases a fallback to use IORESOURCE_REG
> instead of IORESOURCE_MEM becomes necessary.
>
> When this happens, there's redundant logic that needs to be implemented in
> every driver. In order to avoid this redundancy, utilize a single function
> that, if the MFD scenario is enabled, will perform this fallback logic.
>
> Signed-off-by: Colin Foster <colin.foster@in-advantage.com>
> Reviewed-by: Vladimir Oltean <vladimir.oltean@nxp.com>
> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
> ---
> v16
> * Add Andy Reviewed-by tag
>
> v15
> * Add missed errno.h and ioport.h includes
> * Add () to function references in both the commit log and comments
>
> v14
> * Add header guard
> * Change regs type from u32* to void*
> * Add Reviewed-by tag
>
> ---
> MAINTAINERS | 5 +++
> include/linux/mfd/ocelot.h | 62 ++++++++++++++++++++++++++++++++++++++
> 2 files changed, 67 insertions(+)
> create mode 100644 include/linux/mfd/ocelot.h

Applied, thanks.

--
Lee Jones [李琼斯]