Re: [PATCH 2/2] regulator: Add support for stm32 power regulators

From: Mark Brown
Date: Wed Apr 10 2019 - 06:39:05 EST


On Mon, Apr 08, 2019 at 03:24:08PM +0000, Pascal PAILLET-LME wrote:

> +config REGULATOR_STM32_PWR
> + bool "STMicroelectronics STM32 PWR"
> + depends on ARCH_STM32

There's no build time dependency here, please also add an || COMPILE_TEST to
help with build coverage.

> +int stm32_pwr_reg_is_enabled(struct regulator_dev *rdev)
> +{
> + struct stm32_pwr_reg *priv = rdev_get_drvdata(rdev);
> + u32 val;
> +
> + val = readl_relaxed(priv->base + REG_PWR_CR3);
> +
> + return (val & priv->ready_mask);
> +}

This looks like it's reading back a status bit from the hardware not the
state requested by software - I'd expect an _is_enabled() to reference
the same bit that's updated by the enable/disable functions. This looks
like a better fit for _get_status().

> + of_regulator_match(&pdev->dev, np, stm32_pwr_reg_matches,
> + STM32PWR_REG_NUM_REGS);

You don't need to open code the matching any more, just set of_match and
regulators_node in the regulator_desc and the core will do it for you.

> +MODULE_DESCRIPTION("STM32MP1 PWR voltage regulator driver");
> +MODULE_AUTHOR("Gabriel Fernandez <gabriel.fernandez@xxxxxx>");
> +MODULE_LICENSE("GPL v2");

No signoff from Gabriel?

Attachment: signature.asc
Description: PGP signature