crust-firmware / crust

SCP (power management) firmware for sunxi SoCs
Other
150 stars 34 forks source link

Issue #171 - regulator #175

Closed vincele closed 4 years ago

vincele commented 4 years ago

This is only a RFC, if this is OK, I'll do the other items mentionned in the issue.

It compiles but otherwise untested (I've no suitable HW)

See #171

vincele commented 4 years ago

It looks like the spelling mistake in include/common/system.h that makes the check-format fail is not related to this PR...

smaeul commented 4 years ago

Thanks for the PR!

Oh, thanks for pointing the spelling error out. codespell doesn't actually cause the build to fail. The error is earlier (line 412 of the log):

FAIL: include/drivers/regulator.h (File size changed from 4619 to 4660)

because the return type is only followed by a newline for function definitions, not prototypes (this is what make format would change):

diff --git a/include/drivers/regulator.h b/include/drivers/regulator.h
index 611049f..af1aeab 100644
--- a/include/drivers/regulator.h
+++ b/include/drivers/regulator.h
@@ -63,8 +63,7 @@ int regulator_disable(const struct device *dev, uint8_t id);
  * @param id    The device-specific identifier for this regulator.
  * @return      Zero on success; a defined error code on failure.
  */
-int
-regulator_enable(const struct device *dev, uint8_t id);
+int regulator_enable(const struct device *dev, uint8_t id);

 /**
  * Get generic information about a regulator.
@@ -75,8 +74,8 @@ regulator_enable(const struct device *dev, uint8_t id);
  * @param id    The device-specific identifier for this regulator.
  * @return      A pointer to the information structure.
  */
-struct regulator_info *
-regulator_get_info(const struct device *dev, uint8_t id);
+struct regulator_info *regulator_get_info(const struct device *dev,
+                                          uint8_t id);

 /**
  * Get the current state of a regulator, as determined from the hardware.
@@ -89,8 +88,7 @@ regulator_get_info(const struct device *dev, uint8_t id);
  * @return      On success, boolean true or false for if the regulator is
  *              enabled; a defined error code on failure.
  */
-int
-regulator_get_state(const struct device *dev, uint8_t id);
+int regulator_get_state(const struct device *dev, uint8_t id);

 /**
  * Get the current value of a regulator. If the regulator is disabled, this
vincele commented 4 years ago

Ah yes, the red in codespell made me stop looking further, also it was late.

I formatted the code with make format before resending, and made a better commit message.

Does it look good now ?

smaeul commented 4 years ago

Merged as c766a17905e050a714fc6ca16a05e13bccac1118