Skip to contentSkip to conversation

hwmon: Use new member visible in struct hwmon_ops to simplify drivers

PATCH In review Heiner Kallweit 4 participants 12 messages Oct 11, 2024 – Oct 12, 2024

Subsystems (8)
lore
Share & tools
lore
#0 lore raw

cover hwmon: Use new member visible in struct hwmon_ops to simplify drivers

This is a follow-up to 11fb69bb15c1 ("hwmon: Add static visibility member to struct hwmon_ops") and makes use of the new struct hwmon_ops member to simplify a number of drivers.

Heiner Kallweit (8):
hwmon: i5500_temp: Simplify specifying static visibility attribute
hwmon: surface_fan: Simplify specifying static visibility attribute
hwmon: sl28cpld: Simplify specifying static visibility attribute
hwmon: gsc: Simplify specifying static visibility attribute
hwmon: powerz: Simplify specifying static visibility attribute
hwmon: raspberrypi: Simplify specifying static visibility attribute
hwmon: intel-m10-bmc: Simplify specifying static visibility attribute
hwmon: nzxt-kraken2: Simplify specifying static visibility attribute

 drivers/hwmon/gsc-hwmon.c           |  9 +--------
 drivers/hwmon/i5500_temp.c          |  8 +-------
 drivers/hwmon/intel-m10-bmc-hwmon.c |  9 +--------
 drivers/hwmon/nzxt-kraken2.c        |  9 +--------
 drivers/hwmon/powerz.c              |  8 +-------
 drivers/hwmon/raspberrypi-hwmon.c   |  8 +-------
 drivers/hwmon/sl28cpld-hwmon.c      |  9 +--------
 drivers/hwmon/surface_fan.c         | 10 +---------
 8 files changed, 8 insertions(+), 62 deletions(-)
Signature · 1 line
2.47.0
#1 lore raw

PATCH 1/8 hwmon: i5500_temp: Simplify specifying static visibility attribute

Use new member visible of struct hwmon_ops to simplify specifying the static attribute visibility.

---
 drivers/hwmon/i5500_temp.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)
drivers/hwmon/i5500_temp.c +1 -7
index 7b00b38c7..2a530da21 100644
@@ -29,12 +29,6 @@
 #define REG_CTCTRL	0xF7
 #define REG_TSTIMER	0xF8
 
-static umode_t i5500_is_visible(const void *drvdata, enum hwmon_sensor_types type, u32 attr,
-				int channel)
-{
-	return 0444;
-}
-
 static int i5500_read(struct device *dev, enum hwmon_sensor_types type, u32 attr, int channel,
 		      long *val)
 {
@@ -84,7 +78,7 @@ static int i5500_read(struct device *dev, enum hwmon_sensor_types type, u32 attr
 }
 
 static const struct hwmon_ops i5500_ops = {
-	.is_visible = i5500_is_visible,
+	.visible = 0444,
 	.read = i5500_read,
 };
 
Signature · 1 line
2.47.0
#2 lore raw

PATCH 2/8 hwmon: surface_fan: Simplify specifying static visibility attribute

In reply to Heiner Kallweit

Use new member visible of struct hwmon_ops to simplify specifying the static attribute visibility.

---
 drivers/hwmon/surface_fan.c | 10 +---------
 1 file changed, 1 insertion(+), 9 deletions(-)
drivers/hwmon/surface_fan.c +1 -9
index de3c5a240..aafb4ac92 100644
@@ -18,14 +18,6 @@ SSAM_DEFINE_SYNC_REQUEST_CL_R(__ssam_fan_rpm_get, __le16, {
 	.command_id      = 0x01,
 });
 
-// hwmon
-static umode_t surface_fan_hwmon_is_visible(const void *drvdata,
-					    enum hwmon_sensor_types type, u32 attr,
-					    int channel)
-{
-	return 0444;
-}
-
 static int surface_fan_hwmon_read(struct device *dev,
 				  enum hwmon_sensor_types type, u32 attr,
 				  int channel, long *val)
@@ -49,7 +41,7 @@ static const struct hwmon_channel_info *const surface_fan_info[] = {
 };
 
 static const struct hwmon_ops surface_fan_hwmon_ops = {
-	.is_visible = surface_fan_hwmon_is_visible,
+	.visible = 0444,
 	.read = surface_fan_hwmon_read,
 };
 
Signature · 1 line
2.47.0
#3 lore raw

PATCH 3/8 hwmon: sl28cpld: Simplify specifying static visibility attribute

In reply to Heiner Kallweit

Use new member visible of struct hwmon_ops to simplify specifying the static attribute visibility.

---
 drivers/hwmon/sl28cpld-hwmon.c | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)
drivers/hwmon/sl28cpld-hwmon.c +1 -8
index e020f25c9..454cc844f 100644
@@ -23,13 +23,6 @@ struct sl28cpld_hwmon {
 	u32 offset;
 };
 
-static umode_t sl28cpld_hwmon_is_visible(const void *data,
-					 enum hwmon_sensor_types type,
-					 u32 attr, int channel)
-{
-	return 0444;
-}
-
 static int sl28cpld_hwmon_read(struct device *dev,
 			       enum hwmon_sensor_types type, u32 attr,
 			       int channel, long *input)
@@ -73,7 +66,7 @@ static const struct hwmon_channel_info * const sl28cpld_hwmon_info[] = {
 };
 
 static const struct hwmon_ops sl28cpld_hwmon_ops = {
-	.is_visible = sl28cpld_hwmon_is_visible,
+	.visible = 0444,
 	.read = sl28cpld_hwmon_read,
 };
 
Signature · 1 line
2.47.0
#4 lore raw

PATCH 4/8 hwmon: gsc: Simplify specifying static visibility attribute

In reply to Heiner Kallweit

Use new member visible of struct hwmon_ops to simplify specifying the static attribute visibility.

---
 drivers/hwmon/gsc-hwmon.c | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)
drivers/hwmon/gsc-hwmon.c +1 -8
index 4514f3ed9..34aa17a23 100644
@@ -231,15 +231,8 @@ gsc_hwmon_read_string(struct device *dev, enum hwmon_sensor_types type,
 	return 0;
 }
 
-static umode_t
-gsc_hwmon_is_visible(const void *_data, enum hwmon_sensor_types type, u32 attr,
-		     int ch)
-{
-	return 0444;
-}
-
 static const struct hwmon_ops gsc_hwmon_ops = {
-	.is_visible = gsc_hwmon_is_visible,
+	.visible = 0444,
 	.read = gsc_hwmon_read,
 	.read_string = gsc_hwmon_read_string,
 };
Signature · 1 line
2.47.0
#5 lore raw

PATCH 5/8 hwmon: powerz: Simplify specifying static visibility attribute

In reply to Heiner Kallweit

Use new member visible of struct hwmon_ops to simplify specifying the static attribute visibility.

---
 drivers/hwmon/powerz.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)
drivers/hwmon/powerz.c +1 -7
index cfb635f94..4e663d5b4 100644
@@ -54,12 +54,6 @@ static const struct hwmon_channel_info *const powerz_info[] = {
 	NULL
 };
 
-static umode_t powerz_is_visible(const void *data, enum hwmon_sensor_types type,
-				 u32 attr, int channel)
-{
-	return 0444;
-}
-
 static int powerz_read_string(struct device *dev, enum hwmon_sensor_types type,
 			      u32 attr, int channel, const char **str)
 {
@@ -201,7 +195,7 @@ static int powerz_read(struct device *dev, enum hwmon_sensor_types type,
 }
 
 static const struct hwmon_ops powerz_hwmon_ops = {
-	.is_visible = powerz_is_visible,
+	.visible = 0444,
 	.read = powerz_read,
 	.read_string = powerz_read_string,
 };
Signature · 1 line
2.47.0
#7 lore raw

PATCH 6/8 hwmon: raspberrypi: Simplify specifying static visibility attribute

In reply to Heiner Kallweit

Use new member visible of struct hwmon_ops to simplify specifying the static attribute visibility.

---
 drivers/hwmon/raspberrypi-hwmon.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)
drivers/hwmon/raspberrypi-hwmon.c +1 -7
index 65cc52e47..10ef1e1f9 100644
@@ -81,12 +81,6 @@ static int rpi_read(struct device *dev, enum hwmon_sensor_types type,
 	return 0;
 }
 
-static umode_t rpi_is_visible(const void *_data, enum hwmon_sensor_types type,
-			      u32 attr, int channel)
-{
-	return 0444;
-}
-
 static const struct hwmon_channel_info * const rpi_info[] = {
 	HWMON_CHANNEL_INFO(in,
 			   HWMON_I_LCRIT_ALARM),
@@ -94,7 +88,7 @@ static const struct hwmon_channel_info * const rpi_info[] = {
 };
 
 static const struct hwmon_ops rpi_hwmon_ops = {
-	.is_visible = rpi_is_visible,
+	.visible = 0444,
 	.read = rpi_read,
 };
 
Signature · 1 line
2.47.0
#8 lore raw

PATCH 7/8 hwmon: intel-m10-bmc: Simplify specifying static visibility attribute

In reply to Heiner Kallweit

Use new member visible of struct hwmon_ops to simplify specifying the static attribute visibility.

---
 drivers/hwmon/intel-m10-bmc-hwmon.c | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)
drivers/hwmon/intel-m10-bmc-hwmon.c +1 -8
index 96397ae6f..e221f2c1f 100644
@@ -565,13 +565,6 @@ static const struct m10bmc_hwmon_board_data n6000bmc_hwmon_bdata = {
 	.hinfo = n6000bmc_hinfo,
 };
 
-static umode_t
-m10bmc_hwmon_is_visible(const void *data, enum hwmon_sensor_types type,
-			u32 attr, int channel)
-{
-	return 0444;
-}
-
 static const struct m10bmc_sdata *
 find_sensor_data(struct m10bmc_hwmon *hw, enum hwmon_sensor_types type,
 		 int channel)
@@ -729,7 +722,7 @@ static int m10bmc_hwmon_read_string(struct device *dev,
 }
 
 static const struct hwmon_ops m10bmc_hwmon_ops = {
-	.is_visible = m10bmc_hwmon_is_visible,
+	.visible = 0444,
 	.read = m10bmc_hwmon_read,
 	.read_string = m10bmc_hwmon_read_string,
 };
Signature · 1 line
2.47.0
#9 lore raw

PATCH 8/8 hwmon: nzxt-kraken2: Simplify specifying static visibility attribute

In reply to Heiner Kallweit

Use new member visible of struct hwmon_ops to simplify specifying the static attribute visibility.

---
 drivers/hwmon/nzxt-kraken2.c | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)
drivers/hwmon/nzxt-kraken2.c +1 -8
index ed38645a1..034698232 100644
@@ -35,13 +35,6 @@ struct kraken2_priv_data {
 	unsigned long updated; /* jiffies */
 };
 
-static umode_t kraken2_is_visible(const void *data,
-				  enum hwmon_sensor_types type,
-				  u32 attr, int channel)
-{
-	return 0444;
-}
-
 static int kraken2_read(struct device *dev, enum hwmon_sensor_types type,
 			u32 attr, int channel, long *val)
 {
@@ -81,7 +74,7 @@ static int kraken2_read_string(struct device *dev, enum hwmon_sensor_types type,
 }
 
 static const struct hwmon_ops kraken2_hwmon_ops = {
-	.is_visible = kraken2_is_visible,
+	.visible = 0444,
 	.read = kraken2_read,
 	.read_string = kraken2_read_string,
 };
Signature · 1 line
2.47.0
maintainer
#11 lore raw
In reply to Heiner Kallweit
Quoted 14 lines · Heiner Kallweit

This is a follow-up to 11fb69bb15c1 ("hwmon: Add static visibility member to struct hwmon_ops") and makes use of the new struct hwmon_ops member to simplify a number of drivers.

Heiner Kallweit (8):
hwmon: i5500_temp: Simplify specifying static visibility attribute
hwmon: surface_fan: Simplify specifying static visibility attribute
hwmon: sl28cpld: Simplify specifying static visibility attribute
hwmon: gsc: Simplify specifying static visibility attribute
hwmon: powerz: Simplify specifying static visibility attribute
hwmon: raspberrypi: Simplify specifying static visibility attribute
hwmon: intel-m10-bmc: Simplify specifying static visibility attribute
hwmon: nzxt-kraken2: Simplify specifying static visibility attribute

Quoted 10 lines
  drivers/hwmon/gsc-hwmon.c           |  9 +--------
  drivers/hwmon/i5500_temp.c          |  8 +-------
  drivers/hwmon/intel-m10-bmc-hwmon.c |  9 +--------
  drivers/hwmon/nzxt-kraken2.c        |  9 +--------
  drivers/hwmon/powerz.c              |  8 +-------
  drivers/hwmon/raspberrypi-hwmon.c   |  8 +-------
  drivers/hwmon/sl28cpld-hwmon.c      |  9 +--------
  drivers/hwmon/surface_fan.c         | 10 +---------
  8 files changed, 8 insertions(+), 62 deletions(-)

Series applied.

Thanks,
Guenter