[PATCH v2] power: supply: hwmon: move interface to private header

Thomas Weißschuh posted 1 patch 1 month, 1 week ago
drivers/power/supply/power_supply.h | 17 +++++++++++++++++
include/linux/power_supply.h        | 13 -------------
2 files changed, 17 insertions(+), 13 deletions(-)
[PATCH v2] power: supply: hwmon: move interface to private header
Posted by Thomas Weißschuh 1 month, 1 week ago
The interface of power_supply_hwmon.c is only meant to be used by the
psy core. Remove it from the public header file and use the private one
instead.

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
---
Changes in v2:
- Avoid duplicate #include "power_supply.h"
- Drop already applied patches
- Link to v1: https://lore.kernel.org/r/20241005-power-supply-cleanups-v1-0-45303b2d0a4d@weissschuh.net
---
 drivers/power/supply/power_supply.h | 17 +++++++++++++++++
 include/linux/power_supply.h        | 13 -------------
 2 files changed, 17 insertions(+), 13 deletions(-)

diff --git a/drivers/power/supply/power_supply.h b/drivers/power/supply/power_supply.h
index 4c558fb3db7211a610134960292790ea3584b363..7434a6f2477504ee6c0a3c7420e1444387b41180 100644
--- a/drivers/power/supply/power_supply.h
+++ b/drivers/power/supply/power_supply.h
@@ -44,3 +44,20 @@ static inline int power_supply_create_triggers(struct power_supply *psy)
 static inline void power_supply_remove_triggers(struct power_supply *psy) {}
 
 #endif /* CONFIG_LEDS_TRIGGERS */
+
+#ifdef CONFIG_POWER_SUPPLY_HWMON
+
+int power_supply_add_hwmon_sysfs(struct power_supply *psy);
+void power_supply_remove_hwmon_sysfs(struct power_supply *psy);
+
+#else
+
+static inline int power_supply_add_hwmon_sysfs(struct power_supply *psy)
+{
+	return 0;
+}
+
+static inline
+void power_supply_remove_hwmon_sysfs(struct power_supply *psy) {}
+
+#endif /* CONFIG_POWER_SUPPLY_HWMON */
diff --git a/include/linux/power_supply.h b/include/linux/power_supply.h
index c1d6cb7f4c40e7162948820e824db1ef6df9f315..b98106e1a90f34bce5129317a099f363248342b9 100644
--- a/include/linux/power_supply.h
+++ b/include/linux/power_supply.h
@@ -937,19 +937,6 @@ static inline bool power_supply_is_watt_property(enum power_supply_property psp)
 	return false;
 }
 
-#ifdef CONFIG_POWER_SUPPLY_HWMON
-int power_supply_add_hwmon_sysfs(struct power_supply *psy);
-void power_supply_remove_hwmon_sysfs(struct power_supply *psy);
-#else
-static inline int power_supply_add_hwmon_sysfs(struct power_supply *psy)
-{
-	return 0;
-}
-
-static inline
-void power_supply_remove_hwmon_sysfs(struct power_supply *psy) {}
-#endif
-
 #ifdef CONFIG_SYSFS
 ssize_t power_supply_charge_behaviour_show(struct device *dev,
 					   unsigned int available_behaviours,

---
base-commit: 1e5335d00707220b46c28ab09cd09a1837b84978
change-id: 20240922-power-supply-cleanups-7cebf4691754

Best regards,
-- 
Thomas Weißschuh <linux@weissschuh.net>

Re: [PATCH v2] power: supply: hwmon: move interface to private header
Posted by Sebastian Reichel 1 month, 1 week ago
On Thu, 17 Oct 2024 06:37:33 +0200, Thomas Weißschuh wrote:
> The interface of power_supply_hwmon.c is only meant to be used by the
> psy core. Remove it from the public header file and use the private one
> instead.
> 
> 

Applied, thanks!

[1/1] power: supply: hwmon: move interface to private header
      commit: 44fcc479a574a4055fb6aed1f786d39999466383

Best regards,
-- 
Sebastian Reichel <sebastian.reichel@collabora.com>