Skip to contentSkip to conversation

hwmon: Drop unused platform data support and max197 driver

PATCH In review Guenter Roeck 3 participants 42 messages Nov 10 – Nov 12

Subsystems (4)
lore
Share & tools
lore

Guenter Roeck

author maintainer
#0 lore raw

cover hwmon: Drop unused platform data support and max197 driver

Several drivers in drivers/hwmon still support configuration through platform data structures even though no in-tree platform or board code ever instantiates or supplies that platform data.

Audit all hwmon drivers using dev_get_platdata(), dev->platform_data, or headers under include/linux/platform_data/ and drop dead platform data support where it is never provided in-tree:

- ads7828, emc2305, g762, gsc-hwmon, ltc4245, mcp3021, and shtc1 already support configuring the respective parameters via devicetree / fwnode properties (and/or hardware registers). Drop platform data support, remove the unused platform data headers, and update documentation and MAINTAINERS entries accordingly.

- f75375s already initializes PWM mode and enable state from chip registers during probe and exposes pwm and pwm_enable via standard hwmon sysfs attributes. Drop platform data support and remove include/linux/f75375s.h.

- ds620 clears PO2 by default when no platform data is provided, keeping the thermostat output pin low as a valid default configuration. Drop platform data support and remove include/linux/platform_data/ds620.h.

- max197 requires platform data supplying a convert() callback function pointer and fails to probe without it. Since no in-tree user ever instantiates the device or provides max197_platform_data, remove the unused driver along with its platform data header, Kconfig/Makefile entries, and documentation.

Tooling and Testing Notes
-------------------------
Per Documentation/process/generated-content.rst:
- Tool used: Jetski AI coding assistant (Gemini).
- Prompt summary: Identify all drivers in drivers/hwmon whose platform data is never supplied in-tree; remove platform data support and unused platform data headers where an alternate configuration means exists (including ds620's default PO2 configuration), and remove both the driver and header where platform data is mandatory.
- Scope of generated content: Code changes, documentation/Kconfig/ MAINTAINERS updates, commit descriptions, and this cover letter.
- Testing: Verified with out-of-tree W=1 builds of drivers/hwmon/ under both allmodconfig (CONFIG_OF=y) and CONFIG_OF=n, as well as scripts/checkpatch.pl --strict. Not runtime-tested on hardware.

Cc Tim Harvey <[email protected]>
Cc Nuno Sá <[email protected]>
Cc Riku Voipio <[email protected]>

Guenter Roeck (10):
hwmon: (ads7828) Drop platform data support
hwmon: (emc2305) Drop platform data support
hwmon: (g762) Drop platform data support
hwmon: (gsc-hwmon) Drop platform data support
hwmon: (ltc4245) Drop platform data support
hwmon: (mcp3021) Drop platform data support
hwmon: (shtc1) Drop platform data support
hwmon: (max197) Remove driver
hwmon: (f75375s) Drop platform data support
hwmon: (ds620) Drop platform data support

 Documentation/hwmon/ads7828.rst         |  21 --
 Documentation/hwmon/ds620.rst           |  12 +-
 Documentation/hwmon/g762.rst            |   4 +-
 Documentation/hwmon/index.rst           |   1 -
 Documentation/hwmon/ltc4245.rst         |   6 +-
 Documentation/hwmon/max197.rst          |  70 -----
 Documentation/hwmon/shtc1.rst           |   3 +-
 MAINTAINERS                             |   2 -
 drivers/hwmon/Kconfig                   |   9 -
 drivers/hwmon/Makefile                  |   1 -
 drivers/hwmon/ads7828.c                 |  13 +-
 drivers/hwmon/ds620.c                   |  13 +-
 drivers/hwmon/emc2305.c                 |  44 +--
 drivers/hwmon/f75375s.c                 | 100 +++----
 drivers/hwmon/g762.c                    |  50 +---
 drivers/hwmon/gsc-hwmon.c               |  72 +++--
 drivers/hwmon/ltc4245.c                 |  21 +-
 drivers/hwmon/max197.c                  | 341 ------------------------
 drivers/hwmon/mcp3021.c                 |  18 +-
 drivers/hwmon/shtc1.c                   |  23 +-
 include/linux/f75375s.h                 |  21 --
 include/linux/platform_data/ads7828.h   |  26 --
 include/linux/platform_data/ds620.h     |  22 --
 include/linux/platform_data/emc2305.h   |  28 --
 include/linux/platform_data/g762.h      |  24 --
 include/linux/platform_data/gsc_hwmon.h |  45 ----
 include/linux/platform_data/ltc4245.h   |  17 --
 include/linux/platform_data/max197.h    |  23 --
 include/linux/platform_data/shtc1.h     |  14 -
 29 files changed, 121 insertions(+), 923 deletions(-)
 delete mode 100644 Documentation/hwmon/max197.rst
 delete mode 100644 drivers/hwmon/max197.c
 delete mode 100644 include/linux/f75375s.h
 delete mode 100644 include/linux/platform_data/ads7828.h
 delete mode 100644 include/linux/platform_data/ds620.h
 delete mode 100644 include/linux/platform_data/emc2305.h
 delete mode 100644 include/linux/platform_data/g762.h
 delete mode 100644 include/linux/platform_data/gsc_hwmon.h
 delete mode 100644 include/linux/platform_data/ltc4245.h
 delete mode 100644 include/linux/platform_data/max197.h
 delete mode 100644 include/linux/platform_data/shtc1.h
Signature · 1 line
2.56.0
author maintainer
#1 lore raw

PATCH 1/10 hwmon: (ads7828) Drop platform data support

There are no in-tree users of ads7828_platform_data. The driver already supports configuring differential input mode and external reference voltage via devicetree properties ("ti,differential-input" and the "vref" regulator supply).

Drop platform data support from the driver, remove the unused platform_data header file, and update the driver documentation.

---
 Documentation/hwmon/ads7828.rst       | 21 ---------------------
 drivers/hwmon/ads7828.c               | 13 +------------
 include/linux/platform_data/ads7828.h | 26 --------------------------
 3 files changed, 1 insertion(+), 59 deletions(-)
 delete mode 100644 include/linux/platform_data/ads7828.h
Documentation/hwmon/ads7828.rst +0 -21
index b830b490cfe4..7aaafa489e4f 100644
@@ -24,27 +24,6 @@ Authors:
 	- Vivien Didelot <[email protected]>
 	- Guillaume Roguez <[email protected]>
 
-Platform data
--------------
-
-The ads7828 driver accepts an optional ads7828_platform_data structure (defined
-in include/linux/platform_data/ads7828.h). The structure fields are:
-
-* diff_input: (bool) Differential operation
-    set to true for differential mode, false for default single ended mode.
-
-* ext_vref: (bool) External reference
-    set to true if it operates with an external reference, false for default
-    internal reference.
-
-* vref_mv: (unsigned int) Voltage reference
-    if using an external reference, set this to the reference voltage in mV,
-    otherwise it will default to the internal value (2500mV). This value will be
-    bounded with limits accepted by the chip, described in the datasheet.
-
- If no structure is provided, the configuration defaults to single ended
- operation and internal voltage reference (2.5V).
-
 Description
 -----------
 
drivers/hwmon/ads7828.c +1 -12
index 261978af17c5..7cc379192375 100644
@@ -19,7 +19,6 @@
 #include <linux/init.h>
 #include <linux/module.h>
 #include <linux/of.h>
-#include <linux/platform_data/ads7828.h>
 #include <linux/regmap.h>
 #include <linux/slab.h>
 #include <linux/regulator/consumer.h>
@@ -102,7 +101,6 @@ static const struct regmap_config ads2830_regmap_config = {
 static int ads7828_probe(struct i2c_client *client)
 {
 	struct device *dev = &client->dev;
-	struct ads7828_platform_data *pdata = dev_get_platdata(dev);
 	struct ads7828_data *data;
 	struct device *hwmon_dev;
 	unsigned int vref_mv = ADS7828_INT_VREF_MV;
@@ -116,12 +114,7 @@ static int ads7828_probe(struct i2c_client *client)
 	if (!data)
 		return -ENOMEM;
 
-	if (pdata) {
-		diff_input = pdata->diff_input;
-		ext_vref = pdata->ext_vref;
-		if (ext_vref && pdata->vref_mv)
-			vref_mv = pdata->vref_mv;
-	} else if (dev->of_node) {
+	if (dev->of_node) {
 		diff_input = of_property_read_bool(dev->of_node,
 						   "ti,differential-input");
 		vref_uv = devm_regulator_get_enable_read_voltage(dev, "vref");
@@ -139,10 +132,6 @@ static int ads7828_probe(struct i2c_client *client)
 
 	chip = (uintptr_t)i2c_get_match_data(client);
 
-	/* Bound Vref with min/max values */
-	vref_mv = clamp_val(vref_mv, ADS7828_EXT_VREF_MV_MIN,
-			    ADS7828_EXT_VREF_MV_MAX);
-
 	/* ADS7828 uses 12-bit samples, while ADS7830 is 8-bit */
 	if (chip == ads7828) {
 		data->lsb_resol = DIV_ROUND_CLOSEST(vref_mv * 1000, 4096);
include/linux/platform_data/ads7828.h deleted +0 -26
deleted file mode 100644
index 0fa4186c6171..000000000000
@@ -1,26 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-only */
-/*
- * TI ADS7828 A/D Converter platform data definition
- *
- * Copyright (c) 2012 Savoir-faire Linux Inc.
- *          Vivien Didelot <[email protected]>
- *
- * For further information, see the Documentation/hwmon/ads7828.rst file.
- */
-
-#ifndef _PDATA_ADS7828_H
-#define _PDATA_ADS7828_H
-
-/**
- * struct ads7828_platform_data - optional ADS7828 connectivity info
- * @diff_input:		Differential input mode.
- * @ext_vref:		Use an external voltage reference.
- * @vref_mv:		Voltage reference value, if external.
- */
-struct ads7828_platform_data {
-	bool diff_input;
-	bool ext_vref;
-	unsigned int vref_mv;
-};
-
-#endif /* _PDATA_ADS7828_H */
Signature · 1 line
2.45.2
Acked-by on v1 1/10
#2 lore raw

Re: [PATCH 01/10] hwmon: (ads7828) Drop platform data support

Quoted 9 lines · Guenter Roeck

There are no in-tree users of ads7828_platform_data. The driver already supports configuring differential input mode and external reference voltage via devicetree properties ("ti,differential-input" and the "vref" regulator supply).

Drop platform data support from the driver, remove the unused platform_data header file, and update the driver documentation.

My patch is almost the same, with two minor differences:

https://git.kernel.org/pub/scm/linux/kernel/git/arnd/playground.git/commit/?h=board-remove-7.4&id=94ec070cdb5fdfbcd22d5533970423ecaf7b3e4a

drivers/hwmon/ads7828.c static int ads7828_probe(struct i2c_client *client) · line 119

Quoted 4 lines
drivers/hwmon/ads7828.c +1 -1
-	} else if (dev->of_node) {
+	if (dev->of_node) {
 		diff_input = of_property_read_bool(dev->of_node,
 						   "ti,differential-input");

Since only DT support remains, I removed the check for of_node here, and also the conditional on the match table:

@@ -199,7 +190,7 @@ MODULE_DEVICE_TABLE(of, ads7828_of_match);

 static struct i2c_driver ads7828_driver = {
        .driver = {
                .name = "ads7828",
-               .of_match_table = of_match_ptr(ads7828_of_match),
+               .of_match_table = ads7828_of_match,
        },
 
        .id_table = ads7828_device_ids,

I hope to eventually remove all of those, but there is no need to respin your patch just for that.

Arnd

author maintainer
#3 lore raw

Re: [PATCH 01/10] hwmon: (ads7828) Drop platform data support

Quoted 6 lines · Arnd Bergmann
Quoted 5 lines · Guenter Roeck

There are no in-tree users of ads7828_platform_data. The driver already supports configuring differential input mode and external reference voltage via devicetree properties ("ti,differential-input" and the "vref" regulator supply).

Quoted 9 lines
Quoted 4 lines

Drop platform data support from the driver, remove the unused platform_data header file, and update the driver documentation.

My patch is almost the same, with two minor differences:

Did you copy me (or linux-hwmon) on your series ? I don't recall seeing it. Sorry, I didn't mean to duplicate your work. I'll look it up and apply your patches instead where possible.

Guenter

Quoted 24 lines

https://git.kernel.org/pub/scm/linux/kernel/git/arnd/playground.git/commit/?h=board-remove-7.4&id=94ec070cdb5fdfbcd22d5533970423ecaf7b3e4a

drivers/hwmon/ads7828.c static int ads7828_probe(struct i2c_client *client) · line 119

Quoted 4 lines
drivers/hwmon/ads7828.c +1 -1
-	} else if (dev->of_node) {
+	if (dev->of_node) {
  		diff_input = of_property_read_bool(dev->of_node,
  						   "ti,differential-input");

Since only DT support remains, I removed the check for of_node here, and also the conditional on the match table:

(quoted diff) +1 -1
@@ -199,7 +190,7 @@ MODULE_DEVICE_TABLE(of, ads7828_of_match);
  static struct i2c_driver ads7828_driver = {
         .driver = {
                 .name = "ads7828",
-               .of_match_table = of_match_ptr(ads7828_of_match),
+               .of_match_table = ads7828_of_match,
         },
 
         .id_table = ads7828_device_ids,

I hope to eventually remove all of those, but there is no need to respin your patch just for that.

Arnd

#4 lore raw

Re: [PATCH 01/10] hwmon: (ads7828) Drop platform data support

Quoted 12 lines · Guenter Roeck
Quoted 11 lines · Arnd Bergmann
Quoted 9 lines · Guenter Roeck

There are no in-tree users of ads7828_platform_data. The driver already supports configuring differential input mode and external reference voltage via devicetree properties ("ti,differential-input" and the "vref" regulator supply).

Drop platform data support from the driver, remove the unused platform_data header file, and update the driver documentation.

Quoted 8 lines
Quoted 4 lines

My patch is almost the same, with two minor differences:

Did you copy me (or linux-hwmon) on your series ? I don't recall seeing it. Sorry, I didn't mean to duplicate your work. I'll look it up and apply your patches instead where possible.

I have been slow with posting these, so none of the hwmon patches have made it to the list so far.

My plan was to start with just the board removal in 7.4, and that is now pushed back to 7.5.

Arnd

author maintainer
#5 lore raw

Re: [PATCH 01/10] hwmon: (ads7828) Drop platform data support

In reply to Arnd Bergmann
Quoted 35 lines · Arnd Bergmann
Quoted 9 lines · Guenter Roeck

There are no in-tree users of ads7828_platform_data. The driver already supports configuring differential input mode and external reference voltage via devicetree properties ("ti,differential-input" and the "vref" regulator supply).

Drop platform data support from the driver, remove the unused platform_data header file, and update the driver documentation.

My patch is almost the same, with two minor differences:

https://git.kernel.org/pub/scm/linux/kernel/git/arnd/playground.git/commit/?h=board-remove-7.4&id=94ec070cdb5fdfbcd22d5533970423ecaf7b3e4a

drivers/hwmon/ads7828.c static int ads7828_probe(struct i2c_client *client) · line 119

Quoted 4 lines
drivers/hwmon/ads7828.c +1 -1
-	} else if (dev->of_node) {
+	if (dev->of_node) {
  		diff_input = of_property_read_bool(dev->of_node,
  						   "ti,differential-input");

Since only DT support remains, I removed the check for of_node here, and also the conditional on the match table:

(quoted diff) +1 -1
@@ -199,7 +190,7 @@ MODULE_DEVICE_TABLE(of, ads7828_of_match);
  static struct i2c_driver ads7828_driver = {
         .driver = {
                 .name = "ads7828",
-               .of_match_table = of_match_ptr(ads7828_of_match),
+               .of_match_table = ads7828_of_match,
         },
 
         .id_table = ads7828_device_ids,
Quoted 3 lines

I hope to eventually remove all of those, but there is no need to respin your patch just for that.

I picked your patch, with two changes: Fixed subject (ads instead of asd), and pre-initializing diff_input is no longer necessary.

Thanks,
Guenter

author maintainer
#6 lore raw

PATCH 2/10 hwmon: (emc2305) Drop platform data support

In reply to Guenter Roeck

There are no in-tree users of emc2305_platform_data. Active PWM channel count is detected from the chip product ID register, and per-channel PWM and thermal cooling parameters are configurable via devicetree child nodes.

Move EMC2305_PWM_MAX into the driver, drop platform data support, and remove the unused platform_data header file.

---
 drivers/hwmon/emc2305.c               | 44 +++++----------------------
 include/linux/platform_data/emc2305.h | 28 -----------------
 2 files changed, 8 insertions(+), 64 deletions(-)
 delete mode 100644 include/linux/platform_data/emc2305.h
drivers/hwmon/emc2305.c +8 -36
index 434e70e76f5f..4eee52ae38ca 100644
@@ -9,7 +9,6 @@
 #include <linux/hwmon.h>
 #include <linux/i2c.h>
 #include <linux/module.h>
-#include <linux/platform_data/emc2305.h>
 #include <linux/thermal.h>
 #include <linux/pwm.h>
 #include <linux/of_device.h>
@@ -20,6 +19,7 @@
 #define EMC2305_FAN_MAX			0xff
 #define EMC2305_FAN_MIN			0x00
 #define EMC2305_FAN_MAX_STATE		10
+#define EMC2305_PWM_MAX			5
 #define EMC2305_DEVICE			0x34
 #define EMC2305_VENDOR			0x5d
 #define EMC2305_REG_PRODUCT_ID		0xfd
@@ -627,7 +627,6 @@ static int emc2305_probe(struct i2c_client *client)
 	struct i2c_adapter *adapter = client->adapter;
 	struct device *dev = &client->dev;
 	struct emc2305_data *data;
-	struct emc2305_platform_data *pdata;
 	int vendor;
 	int ret;
 	int i;
@@ -657,43 +656,16 @@ static int emc2305_probe(struct i2c_client *client)
 
 	pwm_childs = emc2305_probe_childs_from_dt(dev);
 
-	pdata = dev_get_platdata(&client->dev);
+	data->max_state = EMC2305_FAN_MAX_STATE;
+	data->pwm_separate = false;
+	for (i = 0; i < EMC2305_PWM_MAX; i++)
+		data->pwm_min[i] = EMC2305_FAN_MIN;
 
 	if (!pwm_childs) {
-		if (pdata) {
-			if (!pdata->max_state || pdata->max_state > EMC2305_FAN_MAX_STATE)
-				return -EINVAL;
-			data->max_state = pdata->max_state;
-			/*
-			 * Validate a number of active PWM channels. Note that
-			 * configured number can be less than the actual maximum
-			 * supported by the device.
-			 */
-			if (!pdata->pwm_num || pdata->pwm_num > EMC2305_PWM_MAX)
-				return -EINVAL;
-			data->pwm_num = pdata->pwm_num;
-			data->pwm_output_mask = pdata->pwm_output_mask;
-			data->pwm_polarity_mask = pdata->pwm_polarity_mask;
-			data->pwm_separate = pdata->pwm_separate;
-			for (i = 0; i < EMC2305_PWM_MAX; i++) {
-				data->pwm_min[i] = pdata->pwm_min[i];
-				data->pwm_freq[i] = pdata->pwm_freq[i];
-			}
-		} else {
-			data->max_state = EMC2305_FAN_MAX_STATE;
-			data->pwm_separate = false;
-			data->pwm_output_mask = EMC2305_DEFAULT_OUTPUT;
-			data->pwm_polarity_mask = EMC2305_DEFAULT_POLARITY;
-			for (i = 0; i < EMC2305_PWM_MAX; i++) {
-				data->pwm_min[i] = EMC2305_FAN_MIN;
-				data->pwm_freq[i] = base_freq_table[3];
-			}
-		}
-	} else {
-		data->max_state = EMC2305_FAN_MAX_STATE;
-		data->pwm_separate = false;
+		data->pwm_output_mask = EMC2305_DEFAULT_OUTPUT;
+		data->pwm_polarity_mask = EMC2305_DEFAULT_POLARITY;
 		for (i = 0; i < EMC2305_PWM_MAX; i++)
-			data->pwm_min[i] = EMC2305_FAN_MIN;
+			data->pwm_freq[i] = base_freq_table[3];
 	}
 
 	data->hwmon_dev = devm_hwmon_device_register_with_info(dev, "emc2305", data,
include/linux/platform_data/emc2305.h deleted +0 -28
deleted file mode 100644
index 76043a97f975..000000000000
@@ -1,28 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-
-#ifndef __LINUX_PLATFORM_DATA_EMC2305__
-#define __LINUX_PLATFORM_DATA_EMC2305__
-
-#define EMC2305_PWM_MAX	5
-
-/**
- * struct emc2305_platform_data - EMC2305 driver platform data
- * @max_state: maximum cooling state of the cooling device;
- * @pwm_num: number of active channels;
- * @pwm_output_mask: PWM output mask
- * @pwm_polarity_mask: PWM polarity mask
- * @pwm_separate: separate PWM settings for every channel;
- * @pwm_min: array of minimum PWM per channel;
- * @pwm_freq: array of PWM frequency per channel
- */
-struct emc2305_platform_data {
-	u8 max_state;
-	u8 pwm_num;
-	u8 pwm_output_mask;
-	u8 pwm_polarity_mask;
-	bool pwm_separate;
-	u8 pwm_min[EMC2305_PWM_MAX];
-	u16 pwm_freq[EMC2305_PWM_MAX];
-};
-
-#endif
Signature · 1 line
2.45.2
Acked-by on v1 2/10
#7 lore raw

Re: [PATCH 02/10] hwmon: (emc2305) Drop platform data support

Quoted 9 lines · Guenter Roeck

There are no in-tree users of emc2305_platform_data. Active PWM channel count is detected from the chip product ID register, and per-channel PWM and thermal cooling parameters are configurable via devicetree child nodes.

Move EMC2305_PWM_MAX into the driver, drop platform data support, and remove the unused platform_data header file.

Again, your patch is very similar to mine, but yours is a little nicer.

Arnd

author maintainer
#8 lore raw

Re: [PATCH 02/10] hwmon: (emc2305) Drop platform data support

Quoted 6 lines · Arnd Bergmann
Quoted 5 lines · Guenter Roeck

There are no in-tree users of emc2305_platform_data. Active PWM channel count is detected from the chip product ID register, and per-channel PWM and thermal cooling parameters are configurable via devicetree child nodes.

Quoted 9 lines
Quoted 4 lines

Move EMC2305_PWM_MAX into the driver, drop platform data support, and remove the unused platform_data header file.

Again, your patch is very similar to mine, but yours is a little nicer.

Taking mine.

Thanks,
Guenter

author maintainer
#9 lore raw

PATCH 3/10 hwmon: (g762) Drop platform data support

In reply to Guenter Roeck

There are no in-tree users of g762_platform_data. All hardware parameters configurable through platform data (input clock, fan gear mode, PWM polarity, and fan startup voltage) are already configurable via devicetree properties.

Drop platform data support and the now-unnecessary CONFIG_OF guards from the driver, remove the unused platform_data header file, and update the driver documentation.

---
 Documentation/hwmon/g762.rst       |  4 +--
 drivers/hwmon/g762.c               | 50 ++----------------------------
 include/linux/platform_data/g762.h | 24 --------------
 3 files changed, 3 insertions(+), 75 deletions(-)
 delete mode 100644 include/linux/platform_data/g762.h
Documentation/hwmon/g762.rst +1 -3
index f224552a2d3c..6c95040870b6 100644
@@ -17,9 +17,7 @@ done via a userland daemon like fancontrol.
 Note that those entries do not provide ways to setup the specific
 hardware characteristics of the system (reference clock, pulses per
 fan revolution, ...); Those can be modified via devicetree bindings
-documented in Documentation/devicetree/bindings/hwmon/gmt,g762.yaml or
-using a specific platform_data structure in board initialization
-file (see include/linux/platform_data/g762.h).
+documented in Documentation/devicetree/bindings/hwmon/gmt,g762.yaml.
 
   fan1_target:
 	    set desired fan speed. This only makes sense in closed-loop
drivers/hwmon/g762.c +2 -48

86 lines not on this page · raw message

include/linux/platform_data/g762.h deleted +0 -24
deleted file mode 100644
index 249257ee2132..000000000000
@@ -1,24 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-or-later */
-/*
- * Platform data structure for g762 fan controller driver
- *
- * Copyright (C) 2013, Arnaud EBALARD <[email protected]>
- */
-#ifndef __LINUX_PLATFORM_DATA_G762_H__
-#define __LINUX_PLATFORM_DATA_G762_H__
-
-/*
- * Following structure can be used to set g762 driver platform specific data
- * during board init. Note that passing a sparse structure is possible but
- * will result in non-specified attributes to be set to default value, hence
- * overloading those installed during boot (e.g. by u-boot).
- */
-
-struct g762_platform_data {
-	u32 fan_startv;
-	u32 fan_gear_mode;
-	u32 pwm_polarity;
-	u32 clk_freq;
-};
-
-#endif /* __LINUX_PLATFORM_DATA_G762_H__ */
Signature · 1 line
2.45.2
Reviewed-by on v1 3/10
#10 lore raw

Re: [PATCH 03/10] hwmon: (g762) Drop platform data support

Quoted 10 lines · Guenter Roeck

There are no in-tree users of g762_platform_data. All hardware parameters configurable through platform data (input clock, fan gear mode, PWM polarity, and fan startup voltage) are already configurable via devicetree properties.

Drop platform data support and the now-unnecessary CONFIG_OF guards from the driver, remove the unused platform_data header file, and update the driver documentation.

My patch is entirely identical except that your changelog text is a bit nicer.

Arnd

author maintainer
#11 lore raw

Re: [PATCH 03/10] hwmon: (g762) Drop platform data support

Quoted 10 lines · Arnd Bergmann
Quoted 9 lines · Guenter Roeck

There are no in-tree users of g762_platform_data. All hardware parameters configurable through platform data (input clock, fan gear mode, PWM polarity, and fan startup voltage) are already configurable via devicetree properties.

Drop platform data support and the now-unnecessary CONFIG_OF guards from the driver, remove the unused platform_data header file, and update the driver documentation.

Quoted 7 lines
Quoted 1 line

My patch is entirely identical except that your changelog text is a bit nicer.

Picking the nicer change log, i.e., mine.

Thanks,
Guenter

author maintainer
#12 lore raw

PATCH 4/10 hwmon: (gsc-hwmon) Drop platform data support

In reply to Guenter Roeck

There are no in-tree users providing gsc_hwmon_platform_data. Channel descriptions and the fan controller base address are already obtained from devicetree / fwnode properties.

Move enum gsc_hwmon_mode and struct gsc_hwmon_channel into the driver, fold the channel array and fan_base into struct gsc_hwmon_data, drop platform data support, and remove the unused platform_data header file.

---
 MAINTAINERS                             |  1 -
 drivers/hwmon/gsc-hwmon.c               | 72 +++++++++++++++----------
 include/linux/platform_data/gsc_hwmon.h | 45 ----------------
 3 files changed, 45 insertions(+), 73 deletions(-)
 delete mode 100644 include/linux/platform_data/gsc_hwmon.h
MAINTAINERS +0 -1
index 476bcd5d0e1c..15d70b72d9a2 100644
@@ -11169,7 +11169,6 @@ F:	Documentation/hwmon/gsc-hwmon.rst
 F:	drivers/hwmon/gsc-hwmon.c
 F:	drivers/mfd/gateworks-gsc.c
 F:	include/linux/mfd/gsc.h
-F:	include/linux/platform_data/gsc_hwmon.h
 
 GCC PLUGINS
 M:	Kees Cook <[email protected]>
drivers/hwmon/gsc-hwmon.c +45 -27

162 lines not on this page · raw message

include/linux/platform_data/gsc_hwmon.h deleted +0 -45

45 lines not on this page · raw message

Signature · 1 line
2.45.2
Reviewed-by on v1 4/10
#13 lore raw

Re: [PATCH 04/10] hwmon: (gsc-hwmon) Drop platform data support

Quoted 10 lines · Guenter Roeck

There are no in-tree users providing gsc_hwmon_platform_data. Channel descriptions and the fan controller base address are already obtained from devicetree / fwnode properties.

Move enum gsc_hwmon_mode and struct gsc_hwmon_channel into the driver, fold the channel array and fan_base into struct gsc_hwmon_data, drop platform data support, and remove the unused platform_data header file.

My patch is a little simpler here as I kept the platform_data definition and just moved it into the .c file, so yours is a nice cleanup on top.

Arnd

author maintainer
#14 lore raw

Re: [PATCH 04/10] hwmon: (gsc-hwmon) Drop platform data support

Quoted 9 lines · Arnd Bergmann
Quoted 8 lines · Guenter Roeck

There are no in-tree users providing gsc_hwmon_platform_data. Channel descriptions and the fan controller base address are already obtained from devicetree / fwnode properties.

Move enum gsc_hwmon_mode and struct gsc_hwmon_channel into the driver, fold the channel array and fan_base into struct gsc_hwmon_data, drop platform data support, and remove the unused platform_data header file.

Quoted 9 lines
Quoted 2 lines

My patch is a little simpler here as I kept the platform_data definition and just moved it into the .c file, so yours is a nice cleanup on top.

Taking mine.

Thanks,
Guenter

author maintainer
#15 lore raw

PATCH 5/10 hwmon: (ltc4245) Drop platform data support

In reply to Guenter Roeck

There are no in-tree users of ltc4245_platform_data. Sampling all GPIO pins as analog voltages is already configurable via the "ltc4245,use-extra-gpios" devicetree property.

Drop platform data support from the driver, remove the unused platform_data header file, and update the driver documentation.

---
 Documentation/hwmon/ltc4245.rst       |  6 ++----
 drivers/hwmon/ltc4245.c               | 21 +++------------------
 include/linux/platform_data/ltc4245.h | 17 -----------------
 3 files changed, 5 insertions(+), 39 deletions(-)
 delete mode 100644 include/linux/platform_data/ltc4245.h
Documentation/hwmon/ltc4245.rst +2 -4
index 3dafd08a4e87..0c3b823169b9 100644
@@ -103,9 +103,7 @@ then they will be sampled in round-robin fashion. If userspace reads too
 slowly, -EAGAIN will be returned when you read the sysfs attribute containing
 the sensor reading.
 
-The LTC4245 chip can be configured to sample all GPIO pins with two methods:
-
-1) platform data -- see include/linux/platform_data/ltc4245.h
-2) OF device tree -- add the "ltc4245,use-extra-gpios" property to each chip
+The LTC4245 chip can be configured to sample all GPIO pins by adding the
+"ltc4245,use-extra-gpios" OF device tree property to each chip.
 
 The default mode of operation is to sample a single GPIO pin.
drivers/hwmon/ltc4245.c +3 -18
index e7fcf607a05e..7425c801cfe5 100644
@@ -19,7 +19,7 @@
 #include <linux/i2c.h>
 #include <linux/hwmon.h>
 #include <linux/jiffies.h>
-#include <linux/platform_data/ltc4245.h>
+#include <linux/of.h>
 
 /* Here are names of the chip's registers (a.k.a. commands) */
 enum ltc4245_cmd {
@@ -418,22 +418,6 @@ static const struct hwmon_chip_info ltc4245_chip_info = {
 	.info = ltc4245_info,
 };
 
-static bool ltc4245_use_extra_gpios(struct i2c_client *client)
-{
-	struct ltc4245_platform_data *pdata = dev_get_platdata(&client->dev);
-	struct device_node *np = client->dev.of_node;
-
-	/* prefer platform data */
-	if (pdata)
-		return pdata->use_extra_gpios;
-
-	/* fallback on OF */
-	if (of_property_read_bool(np, "ltc4245,use-extra-gpios"))
-		return true;
-
-	return false;
-}
-
 static int ltc4245_probe(struct i2c_client *client)
 {
 	struct i2c_adapter *adapter = client->adapter;
@@ -448,7 +432,8 @@ static int ltc4245_probe(struct i2c_client *client)
 		return -ENOMEM;
 
 	data->client = client;
-	data->use_extra_gpios = ltc4245_use_extra_gpios(client);
+	data->use_extra_gpios = of_property_read_bool(client->dev.of_node,
+						      "ltc4245,use-extra-gpios");
 
 	/* Initialize the LTC4245 chip */
 	i2c_smbus_write_byte_data(client, LTC4245_FAULT1, 0x00);
include/linux/platform_data/ltc4245.h deleted +0 -17
deleted file mode 100644
index f07fa05ea6c4..000000000000
@@ -1,17 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-or-later */
-/*
- * Platform Data for LTC4245 hardware monitor chip
- *
- * Copyright (c) 2010 Ira W. Snyder <[email protected]>
- */
-
-#ifndef LINUX_LTC4245_H
-#define LINUX_LTC4245_H
-
-#include <linux/types.h>
-
-struct ltc4245_platform_data {
-	bool use_extra_gpios;
-};
-
-#endif /* LINUX_LTC4245_H */
Signature · 1 line
2.45.2
Reviewed-by on v1 5/10
#16 lore raw

Re: [PATCH 05/10] hwmon: (ltc4245) Drop platform data support

Quoted 9 lines · Guenter Roeck

There are no in-tree users of ltc4245_platform_data. Sampling all GPIO pins as analog voltages is already configurable via the "ltc4245,use-extra-gpios" devicetree property.

Drop platform data support from the driver, remove the unused platform_data header file, and update the driver documentation.

Mine is the functionally the same, but I missed the documentation change and did not open-code ltc4245_use_extra_gpios(), so your version is better.

Arnd

author maintainer
#17 lore raw

Re: [PATCH 05/10] hwmon: (ltc4245) Drop platform data support

Quoted 8 lines · Arnd Bergmann
Quoted 7 lines · Guenter Roeck

There are no in-tree users of ltc4245_platform_data. Sampling all GPIO pins as analog voltages is already configurable via the "ltc4245,use-extra-gpios" devicetree property.

Drop platform data support from the driver, remove the unused platform_data header file, and update the driver documentation.

Quoted 9 lines
Quoted 2 lines

Mine is the functionally the same, but I missed the documentation change and did not open-code ltc4245_use_extra_gpios(), so your version is better.

Taking mine.

Thanks,
Guenter

Reviewed-by on v1 5/10
#18 lore raw

Re: [PATCH 05/10] hwmon: (ltc4245) Drop platform data support

In reply to Guenter Roeck
Quoted 10 lines · Guenter Roeck

There are no in-tree users of ltc4245_platform_data. Sampling all GPIO pins as analog voltages is already configurable via the "ltc4245,use-extra-gpios" devicetree property.

Drop platform data support from the driver, remove the unused platform_data header file, and update the driver documentation.

---

Thanks!

Quoted 94 lines
 Documentation/hwmon/ltc4245.rst       |  6 ++----
 drivers/hwmon/ltc4245.c               | 21 +++------------------
 include/linux/platform_data/ltc4245.h | 17 -----------------
 3 files changed, 5 insertions(+), 39 deletions(-)
 delete mode 100644 include/linux/platform_data/ltc4245.h
Documentation/hwmon/ltc4245.rst +2 -4
index 3dafd08a4e87..0c3b823169b9 100644
@@ -103,9 +103,7 @@ then they will be sampled in round-robin fashion. If userspace reads too
 slowly, -EAGAIN will be returned when you read the sysfs attribute containing
 the sensor reading.
 
-The LTC4245 chip can be configured to sample all GPIO pins with two methods:
-
-1) platform data -- see include/linux/platform_data/ltc4245.h
-2) OF device tree -- add the "ltc4245,use-extra-gpios" property to each chip
+The LTC4245 chip can be configured to sample all GPIO pins by adding the
+"ltc4245,use-extra-gpios" OF device tree property to each chip.
 
 The default mode of operation is to sample a single GPIO pin.
drivers/hwmon/ltc4245.c +3 -18
index e7fcf607a05e..7425c801cfe5 100644
@@ -19,7 +19,7 @@
 #include <linux/i2c.h>
 #include <linux/hwmon.h>
 #include <linux/jiffies.h>
-#include <linux/platform_data/ltc4245.h>
+#include <linux/of.h>
 
 /* Here are names of the chip's registers (a.k.a. commands) */
 enum ltc4245_cmd {
@@ -418,22 +418,6 @@ static const struct hwmon_chip_info ltc4245_chip_info = {
 	.info = ltc4245_info,
 };
 
-static bool ltc4245_use_extra_gpios(struct i2c_client *client)
-{
-	struct ltc4245_platform_data *pdata = dev_get_platdata(&client->dev);
-	struct device_node *np = client->dev.of_node;
-
-	/* prefer platform data */
-	if (pdata)
-		return pdata->use_extra_gpios;
-
-	/* fallback on OF */
-	if (of_property_read_bool(np, "ltc4245,use-extra-gpios"))
-		return true;
-
-	return false;
-}
-
 static int ltc4245_probe(struct i2c_client *client)
 {
 	struct i2c_adapter *adapter = client->adapter;
@@ -448,7 +432,8 @@ static int ltc4245_probe(struct i2c_client *client)
 		return -ENOMEM;
 
 	data->client = client;
-	data->use_extra_gpios = ltc4245_use_extra_gpios(client);
+	data->use_extra_gpios = of_property_read_bool(client->dev.of_node,
+						      "ltc4245,use-extra-gpios");
 
 	/* Initialize the LTC4245 chip */
 	i2c_smbus_write_byte_data(client, LTC4245_FAULT1, 0x00);
include/linux/platform_data/ltc4245.h deleted +0 -17
deleted file mode 100644
index f07fa05ea6c4..000000000000
@@ -1,17 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-or-later */
-/*
- * Platform Data for LTC4245 hardware monitor chip
- *
- * Copyright (c) 2010 Ira W. Snyder <[email protected]>
- */
-
-#ifndef LINUX_LTC4245_H
-#define LINUX_LTC4245_H
-
-#include <linux/types.h>
-
-struct ltc4245_platform_data {
-	bool use_extra_gpios;
-};
-
-#endif /* LINUX_LTC4245_H */
Signature · 1 line
2.45.2
author maintainer
#19 lore raw

PATCH 6/10 hwmon: (mcp3021) Drop platform data support

In reply to Guenter Roeck

No in-tree boards supply platform data to the mcp3021 driver. Reference voltage is already configurable via the "reference-voltage-microvolt" devicetree property, defaulting to 3300 mV otherwise.

Drop platform data handling from mcp3021_probe().

---
 drivers/hwmon/mcp3021.c | 18 ++++--------------
 1 file changed, 4 insertions(+), 14 deletions(-)
drivers/hwmon/mcp3021.c +4 -14
index 087b595bf5ad..82b1363ab1c6 100644
@@ -132,20 +132,10 @@ static int mcp3021_probe(struct i2c_client *client)
 
 	i2c_set_clientdata(client, data);
 
-	if (np) {
-		if (!of_property_read_u32(np, "reference-voltage-microvolt",
-					  &data->vdd))
-			data->vdd /= 1000;
-		else
-			data->vdd = MCP3021_VDD_REF_DEFAULT;
-	} else {
-		u32 *pdata = dev_get_platdata(&client->dev);
-
-		if (pdata)
-			data->vdd = *pdata;
-		else
-			data->vdd = MCP3021_VDD_REF_DEFAULT;
-	}
+	if (!of_property_read_u32(np, "reference-voltage-microvolt", &data->vdd))
+		data->vdd /= 1000;
+	else
+		data->vdd = MCP3021_VDD_REF_DEFAULT;
 
 	type = (uintptr_t)i2c_get_match_data(client);
 	switch (type) {
Signature · 1 line
2.45.2
Reviewed-by on v1 6/10
#20 lore raw

Re: [PATCH 06/10] hwmon: (mcp3021) Drop platform data support

Quoted 7 lines · Guenter Roeck

No in-tree boards supply platform data to the mcp3021 driver. Reference voltage is already configurable via the "reference-voltage-microvolt" devicetree property, defaulting to 3300 mV otherwise.

Drop platform data handling from mcp3021_probe().

but I would suggest including this extra bit from my version:

drivers/hwmon/mcp3021.c +1 -3
index d6b0ebf27941..b0839b2c2e53 100644
@@ -183,19 +174,17 @@ static const struct i2c_device_id mcp3021_id[] = {
 };
 MODULE_DEVICE_TABLE(i2c, mcp3021_id);
 
-#ifdef CONFIG_OF
 static const struct of_device_id of_mcp3021_match[] = {
 	{ .compatible = "microchip,mcp3021", .data = (void *)mcp3021 },
 	{ .compatible = "microchip,mcp3221", .data = (void *)mcp3221 },
 	{ }
 };
 MODULE_DEVICE_TABLE(of, of_mcp3021_match);
-#endif
 
 static struct i2c_driver mcp3021_driver = {
 	.driver = {
 		.name = "mcp3021",
-		.of_match_table = of_match_ptr(of_mcp3021_match),
+		.of_match_table = of_mcp3021_match,
 	},
 	.probe = mcp3021_probe,
 	.id_table = mcp3021_id,
author maintainer
#21 lore raw

Re: [PATCH 06/10] hwmon: (mcp3021) Drop platform data support

Quoted 5 lines · Arnd Bergmann
Quoted 4 lines · Guenter Roeck

No in-tree boards supply platform data to the mcp3021 driver. Reference voltage is already configurable via the "reference-voltage-microvolt" devicetree property, defaulting to 3300 mV otherwise.

Quoted 8 lines
Quoted 3 lines

Drop platform data handling from mcp3021_probe().

but I would suggest including this extra bit from my version:

I picked your version.

Thanks,

Guenter

Quoted 25 lines
drivers/hwmon/mcp3021.c +1 -3
index d6b0ebf27941..b0839b2c2e53 100644
@@ -183,19 +174,17 @@ static const struct i2c_device_id mcp3021_id[] = {
  };
  MODULE_DEVICE_TABLE(i2c, mcp3021_id);
 
-#ifdef CONFIG_OF
  static const struct of_device_id of_mcp3021_match[] = {
  	{ .compatible = "microchip,mcp3021", .data = (void *)mcp3021 },
  	{ .compatible = "microchip,mcp3221", .data = (void *)mcp3221 },
  	{ }
  };
  MODULE_DEVICE_TABLE(of, of_mcp3021_match);
-#endif
 
  static struct i2c_driver mcp3021_driver = {
  	.driver = {
  		.name = "mcp3021",
-		.of_match_table = of_match_ptr(of_mcp3021_match),
+		.of_match_table = of_mcp3021_match,
  	},
  	.probe = mcp3021_probe,
  	.id_table = mcp3021_id,
author maintainer
#22 lore raw

PATCH 7/10 hwmon: (shtc1) Drop platform data support

In reply to Guenter Roeck

There are no in-tree users of shtc1_platform_data. Blocking I/O and measurement precision modes are already configurable via the "sensirion,blocking-io" and "sensirion,low-precision" devicetree properties.

Move blocking_io and high_precision directly into struct shtc1_data, drop platform data support, remove the unused platform_data header file, and update the driver documentation.

---
 Documentation/hwmon/shtc1.rst       |  3 ++-
 drivers/hwmon/shtc1.c               | 23 ++++++++++-------------
 include/linux/platform_data/shtc1.h | 14 --------------
 3 files changed, 12 insertions(+), 28 deletions(-)
 delete mode 100644 include/linux/platform_data/shtc1.h
Documentation/hwmon/shtc1.rst +2 -1
index f38c4c9d2f74..d2c6d9b8f0e0 100644
@@ -48,7 +48,8 @@ The device communicates with the I2C protocol. All sensors are set to I2C
 address 0x70. See Documentation/i2c/instantiating-devices.rst for methods to
 instantiate the device.
 
-There are two options configurable by means of shtc1_platform_data:
+There are two options configurable via devicetree properties (see
+Documentation/devicetree/bindings/hwmon/sensirion,shtc1.yaml):
 
 1. blocking (pull the I2C clock line down while performing the measurement) or
    non-blocking mode. Blocking mode will guarantee the fastest result but
drivers/hwmon/shtc1.c +10 -13
index 54c240ca66f7..73613c882933 100644
@@ -14,7 +14,6 @@
 #include <linux/err.h>
 #include <linux/delay.h>
 #include <linux/ktime.h>
-#include <linux/platform_data/shtc1.h>
 #include <linux/of.h>
 
 /* commands (high precision mode) */
@@ -62,7 +61,8 @@ struct shtc1_data {
 	const unsigned char *command;
 	unsigned int nonblocking_wait_time; /* in us */
 
-	struct shtc1_platform_data setup;
+	bool blocking_io;
+	bool high_precision;
 	enum shtcx_chips chip;
 
 	int temperature; /* 1000 * temperature in dgr C */
@@ -85,7 +85,7 @@ static int shtc1_update_values(struct i2c_client *client,
 	 * will wait until the data is ready. For non blocking mode, we
 	 * have to wait ourselves.
 	 */
-	if (!data->setup.blocking_io)
+	if (!data->blocking_io)
 		usleep_range(data->nonblocking_wait_time,
 			     data->nonblocking_wait_time + 1000);
 
@@ -171,15 +171,15 @@ ATTRIBUTE_GROUPS(shtc1);
 
 static void shtc1_select_command(struct shtc1_data *data)
 {
-	if (data->setup.high_precision) {
-		data->command = data->setup.blocking_io ?
+	if (data->high_precision) {
+		data->command = data->blocking_io ?
 				shtc1_cmd_measure_blocking_hpm :
 				shtc1_cmd_measure_nonblocking_hpm;
 		data->nonblocking_wait_time = (data->chip == shtc1) ?
 				SHTC1_NONBLOCKING_WAIT_TIME_HPM :
 				SHTC3_NONBLOCKING_WAIT_TIME_HPM;
 	} else {
-		data->command = data->setup.blocking_io ?
+		data->command = data->blocking_io ?
 				shtc1_cmd_measure_blocking_lpm :
 				shtc1_cmd_measure_nonblocking_lpm;
 		data->nonblocking_wait_time = (data->chip == shtc1) ?
@@ -231,17 +231,14 @@ static int shtc1_probe(struct i2c_client *client)
 	if (!data)
 		return -ENOMEM;
 
-	data->setup.blocking_io = false;
-	data->setup.high_precision = true;
+	data->blocking_io = false;
+	data->high_precision = true;
 	data->client = client;
 	data->chip = chip;
 
 	if (np) {
-		data->setup.blocking_io = of_property_read_bool(np, "sensirion,blocking-io");
-		data->setup.high_precision = !of_property_read_bool(np, "sensirion,low-precision");
-	} else {
-		if (client->dev.platform_data)
-			data->setup = *(struct shtc1_platform_data *)dev->platform_data;
+		data->blocking_io = of_property_read_bool(np, "sensirion,blocking-io");
+		data->high_precision = !of_property_read_bool(np, "sensirion,low-precision");
 	}
 
 	shtc1_select_command(data);
include/linux/platform_data/shtc1.h deleted +0 -14
deleted file mode 100644
index 5ba6f8f9a9a1..000000000000
@@ -1,14 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-only */
-/*
- * Copyright (C) 2014 Sensirion AG, Switzerland
- * Author: Johannes Winkelmann <[email protected]>
- */
-
-#ifndef __SHTC1_H_
-#define __SHTC1_H_
-
-struct shtc1_platform_data {
-	bool blocking_io;
-	bool high_precision;
-};
-#endif /* __SHTC1_H_ */
Signature · 1 line
2.45.2
Reviewed-by on v1 7/10
#23 lore raw

Re: [PATCH 07/10] hwmon: (shtc1) Drop platform data support

Quoted 10 lines · Guenter Roeck

There are no in-tree users of shtc1_platform_data. Blocking I/O and measurement precision modes are already configurable via the "sensirion,blocking-io" and "sensirion,low-precision" devicetree properties.

Move blocking_io and high_precision directly into struct shtc1_data, drop platform data support, remove the unused platform_data header file, and update the driver documentation.

Quoted 5 lines
(quoted diff) +0 -1
 	if (np) {
-		data->setup.blocking_io = of_property_read_bool(np, 

"sensirion,blocking-io");

(quoted diff) +0 -1
-		data->setup.high_precision = !of_property_read_bool(np, 

"sensirion,low-precision");

The only difference in my patch is that I removed the redundant 'if (np) {}' check.

Arnd

author maintainer
#24 lore raw

Re: [PATCH 07/10] hwmon: (shtc1) Drop platform data support

Quoted 14 lines · Arnd Bergmann
Quoted 10 lines · Guenter Roeck

There are no in-tree users of shtc1_platform_data. Blocking I/O and measurement precision modes are already configurable via the "sensirion,blocking-io" and "sensirion,low-precision" devicetree properties.

Move blocking_io and high_precision directly into struct shtc1_data, drop platform data support, remove the unused platform_data header file, and update the driver documentation.

Quoted 9 lines
Quoted 5 lines
  	if (np) {
(quoted diff) +0 -1
-		data->setup.blocking_io = of_property_read_bool(np,

"sensirion,blocking-io");

(quoted diff) +0 -1
-		data->setup.high_precision = !of_property_read_bool(np,

"sensirion,low-precision");

The only difference in my patch is that I removed the redundant 'if (np) {}' check.

Your patch wins.

Thanks,
Guenter

author maintainer
#25 lore raw

PATCH 8/10 hwmon: (max197) Remove driver

In reply to Guenter Roeck

The max197 driver requires platform data providing a convert() callback function pointer and fails to probe without it. No in-tree platform ever instantiates max197 or supplies struct max197_platform_data, and there is no alternative mechanism to access the chip.

Remove the unused driver, its platform_data header file, Kconfig/Makefile entries, and documentation.

---
 Documentation/hwmon/index.rst        |   1 -
 Documentation/hwmon/max197.rst       |  70 ------
 drivers/hwmon/Kconfig                |   9 -
 drivers/hwmon/Makefile               |   1 -
 drivers/hwmon/max197.c               | 341 ---------------------------
 include/linux/platform_data/max197.h |  23 --
 6 files changed, 445 deletions(-)
 delete mode 100644 Documentation/hwmon/max197.rst
 delete mode 100644 drivers/hwmon/max197.c
 delete mode 100644 include/linux/platform_data/max197.h
Documentation/hwmon/index.rst +0 -1
index 7ce1a6f42ddc..e364e051457f 100644
@@ -168,7 +168,6 @@ Hardware Monitoring Kernel Drivers
    max16601
    max1668
    max17616
-   max197
    max20730
    max20751
    max20826
Documentation/hwmon/max197.rst deleted +0 -70

70 lines not on this page · raw message

drivers/hwmon/Kconfig +0 -9
index 9979958a59a2..1612a408c287 100644
@@ -1342,15 +1342,6 @@ config SENSORS_MAX1668
 	  This driver can also be built as a module. If so, the module
 	  will be called max1668.
 
-config SENSORS_MAX197
-	tristate "Maxim MAX197 and compatibles"
-	help
-	  Support for the Maxim MAX197 A/D converter.
-	  Support will include, but not be limited to, MAX197, and MAX199.
-
-	  This driver can also be built as a module. If so, the module
-	  will be called max197.
-
 config SENSORS_MAX31722
 	tristate "MAX31722 temperature sensor"
 	depends on SPI
drivers/hwmon/Makefile +0 -1
index ec4b0de8cf47..56776df17cfd 100644
@@ -164,7 +164,6 @@ obj-$(CONFIG_SENSORS_MAX127)	+= max127.o
 obj-$(CONFIG_SENSORS_MAX16065)	+= max16065.o
 obj-$(CONFIG_SENSORS_MAX1619)	+= max1619.o
 obj-$(CONFIG_SENSORS_MAX1668)	+= max1668.o
-obj-$(CONFIG_SENSORS_MAX197)	+= max197.o
 obj-$(CONFIG_SENSORS_MAX31722)	+= max31722.o
 obj-$(CONFIG_SENSORS_MAX31730)	+= max31730.o
 obj-$(CONFIG_SENSORS_MAX31760)  += max31760.o
drivers/hwmon/max197.c deleted +0 -341

341 lines not on this page · raw message

include/linux/platform_data/max197.h deleted +0 -23
deleted file mode 100644
index 03ef46f9cd65..000000000000
@@ -1,23 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-only */
-/*
- * Maxim MAX197 A/D Converter Driver
- *
- * Copyright (c) 2012 Savoir-faire Linux Inc.
- *          Vivien Didelot <[email protected]>
- *
- * For further information, see the Documentation/hwmon/max197.rst file.
- */
-
-#ifndef _PDATA_MAX197_H
-#define _PDATA_MAX197_H
-
-/**
- * struct max197_platform_data - MAX197 connectivity info
- * @convert:	Function used to start a conversion with control byte ctrl.
- *		It must return the raw data, or a negative error code.
- */
-struct max197_platform_data {
-	int (*convert)(u8 ctrl);
-};
-
-#endif /* _PDATA_MAX197_H */
Signature · 1 line
2.45.2
Reviewed-by on v1 8/10
#26 lore raw

Re: [PATCH 08/10] hwmon: (max197) Remove driver

Quoted 10 lines · Guenter Roeck

The max197 driver requires platform data providing a convert() callback function pointer and fails to probe without it. No in-tree platform ever instantiates max197 or supplies struct max197_platform_data, and there is no alternative mechanism to access the chip.

Remove the unused driver, its platform_data header file, Kconfig/Makefile entries, and documentation.

My patch is identical, though your changelog text is slightly inaccurate, as there actually was an in-tree user in arch/x86/platform/ts5500/ts5500.c until linux-7.1.

Arnd

author maintainer
#27 lore raw

Re: [PATCH 08/10] hwmon: (max197) Remove driver

Quoted 9 lines · Arnd Bergmann
Quoted 8 lines · Guenter Roeck

The max197 driver requires platform data providing a convert() callback function pointer and fails to probe without it. No in-tree platform ever instantiates max197 or supplies struct max197_platform_data, and there is no alternative mechanism to access the chip.

Remove the unused driver, its platform_data header file, Kconfig/Makefile entries, and documentation.

Quoted 9 lines
Quoted 2 lines

My patch is identical, though your changelog text is slightly inaccurate, as there actually was an in-tree user in arch/x86/platform/ts5500/ts5500.c until linux-7.1.

I applied my patch with updated description from yours.

Thanks,
Guenter

Reviewed-by on v1 8/10
#28 lore raw

Re: [PATCH 08/10] hwmon: (max197) Remove driver

In reply to Guenter Roeck
Quoted 11 lines · Guenter Roeck

The max197 driver requires platform data providing a convert() callback function pointer and fails to probe without it. No in-tree platform ever instantiates max197 or supplies struct max197_platform_data, and there is no alternative mechanism to access the chip.

Remove the unused driver, its platform_data header file, Kconfig/Makefile entries, and documentation.

---

This one is still in production but looking at it I agree it would be not so straight to make this driver usable. Hence,

Quoted 510 lines
 Documentation/hwmon/index.rst        |   1 -
 Documentation/hwmon/max197.rst       |  70 ------
 drivers/hwmon/Kconfig                |   9 -
 drivers/hwmon/Makefile               |   1 -
 drivers/hwmon/max197.c               | 341 ---------------------------
 include/linux/platform_data/max197.h |  23 --
 6 files changed, 445 deletions(-)
 delete mode 100644 Documentation/hwmon/max197.rst
 delete mode 100644 drivers/hwmon/max197.c
 delete mode 100644 include/linux/platform_data/max197.h
Documentation/hwmon/index.rst +0 -1
index 7ce1a6f42ddc..e364e051457f 100644
@@ -168,7 +168,6 @@ Hardware Monitoring Kernel Drivers
    max16601
    max1668
    max17616
-   max197
    max20730
    max20751
    max20826
Documentation/hwmon/max197.rst deleted +0 -70
deleted file mode 100644
index 00e16056823f..000000000000
@@ -1,70 +0,0 @@
-Kernel driver max197
-====================
-
-Author:
-
-  * Vivien Didelot <[email protected]>
-
-Supported chips:
-
-  * Maxim MAX197
-
-    Prefix: 'max197'
-
-    Datasheet: https://www.analog.com/media/en/technical-documentation/data-sheets/MAX197.pdf
-
-  * Maxim MAX199
-
-    Prefix: 'max199'
-
-    Datasheet: https://www.analog.com/media/en/technical-documentation/data-sheets/MAX199.pdf
-
-Description
------------
-
-The A/D converters MAX197, and MAX199 are both 8-Channel, Multi-Range, 5V,
-12-Bit DAS with 8+4 Bus Interface and Fault Protection.
-
-The available ranges for the MAX197 are {0,-5V} to 5V, and {0,-10V} to 10V,
-while they are {0,-2V} to 2V, and {0,-4V} to 4V on the MAX199.
-
-Platform data
--------------
-
-The MAX197 platform data (defined in linux/platform_data/max197.h) should be
-filled with a pointer to a conversion function, defined like::
-
-    int convert(u8 ctrl);
-
-ctrl is the control byte to write to start a new conversion.
-On success, the function must return the 12-bit raw value read from the chip,
-or a negative error code otherwise.
-
-Control byte format:
-
-======= ========== ============================================
-Bit     Name       Description
-7,6     PD1,PD0    Clock and Power-Down modes
-5       ACQMOD     Internal or External Controlled Acquisition
-4       RNG        Full-scale voltage magnitude at the input
-3       BIP        Unipolar or Bipolar conversion mode
-2,1,0   A2,A1,A0   Channel
-======= ========== ============================================
-
-Sysfs interface
----------------
-
-  ============== ==============================================================
-  in[0-7]_input  The conversion value for the corresponding channel.
-		 RO
-
-  in[0-7]_min    The lower limit (in mV) for the corresponding channel.
-		 For the MAX197, it will be adjusted to -10000, -5000, or 0.
-		 For the MAX199, it will be adjusted to -4000, -2000, or 0.
-		 RW
-
-  in[0-7]_max    The higher limit (in mV) for the corresponding channel.
-		 For the MAX197, it will be adjusted to 0, 5000, or 10000.
-		 For the MAX199, it will be adjusted to 0, 2000, or 4000.
-		 RW
-  ============== ==============================================================
drivers/hwmon/Kconfig +0 -9
index 9979958a59a2..1612a408c287 100644
@@ -1342,15 +1342,6 @@ config SENSORS_MAX1668
 	  This driver can also be built as a module. If so, the module
 	  will be called max1668.
 
-config SENSORS_MAX197
-	tristate "Maxim MAX197 and compatibles"
-	help
-	  Support for the Maxim MAX197 A/D converter.
-	  Support will include, but not be limited to, MAX197, and MAX199.
-
-	  This driver can also be built as a module. If so, the module
-	  will be called max197.
-
 config SENSORS_MAX31722
 	tristate "MAX31722 temperature sensor"
 	depends on SPI
drivers/hwmon/Makefile +0 -1
index ec4b0de8cf47..56776df17cfd 100644
@@ -164,7 +164,6 @@ obj-$(CONFIG_SENSORS_MAX127)	+= max127.o
 obj-$(CONFIG_SENSORS_MAX16065)	+= max16065.o
 obj-$(CONFIG_SENSORS_MAX1619)	+= max1619.o
 obj-$(CONFIG_SENSORS_MAX1668)	+= max1668.o
-obj-$(CONFIG_SENSORS_MAX197)	+= max197.o
 obj-$(CONFIG_SENSORS_MAX31722)	+= max31722.o
 obj-$(CONFIG_SENSORS_MAX31730)	+= max31730.o
 obj-$(CONFIG_SENSORS_MAX31760)  += max31760.o
drivers/hwmon/max197.c deleted +0 -341
deleted file mode 100644
index a613abfdc2db..000000000000
@@ -1,341 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-only
-/*
- * Maxim MAX197 A/D Converter driver
- *
- * Copyright (c) 2012 Savoir-faire Linux Inc.
- *          Vivien Didelot <[email protected]>
- *
- * For further information, see the Documentation/hwmon/max197.rst file.
- */
-
-#include <linux/kernel.h>
-#include <linux/module.h>
-#include <linux/init.h>
-#include <linux/err.h>
-#include <linux/slab.h>
-#include <linux/mutex.h>
-#include <linux/device.h>
-#include <linux/sysfs.h>
-#include <linux/hwmon.h>
-#include <linux/hwmon-sysfs.h>
-#include <linux/platform_device.h>
-#include <linux/platform_data/max197.h>
-
-#define MAX199_LIMIT	4000		/* 4V */
-#define MAX197_LIMIT	10000		/* 10V */
-
-#define MAX197_NUM_CH	8		/* 8 Analog Input Channels */
-
-/* Control byte format */
-#define MAX197_BIP	(1 << 3)	/* Bipolarity */
-#define MAX197_RNG	(1 << 4)	/* Full range */
-
-#define MAX197_SCALE	12207		/* Scale coefficient for raw data */
-
-/* List of supported chips */
-enum max197_chips { max197, max199 };
-
-/**
- * struct max197_data - device instance specific data
- * @pdata:		Platform data.
- * @hwmon_dev:		The hwmon device.
- * @lock:		Read/Write mutex.
- * @limit:		Max range value (10V for MAX197, 4V for MAX199).
- * @scale:		Need to scale.
- * @ctrl_bytes:		Channels control byte.
- */
-struct max197_data {
-	struct max197_platform_data *pdata;
-	struct device *hwmon_dev;
-	struct mutex lock;
-	int limit;
-	bool scale;
-	u8 ctrl_bytes[MAX197_NUM_CH];
-};
-
-static inline void max197_set_unipolarity(struct max197_data *data, int channel)
-{
-	data->ctrl_bytes[channel] &= ~MAX197_BIP;
-}
-
-static inline void max197_set_bipolarity(struct max197_data *data, int channel)
-{
-	data->ctrl_bytes[channel] |= MAX197_BIP;
-}
-
-static inline void max197_set_half_range(struct max197_data *data, int channel)
-{
-	data->ctrl_bytes[channel] &= ~MAX197_RNG;
-}
-
-static inline void max197_set_full_range(struct max197_data *data, int channel)
-{
-	data->ctrl_bytes[channel] |= MAX197_RNG;
-}
-
-static inline bool max197_is_bipolar(struct max197_data *data, int channel)
-{
-	return data->ctrl_bytes[channel] & MAX197_BIP;
-}
-
-static inline bool max197_is_full_range(struct max197_data *data, int channel)
-{
-	return data->ctrl_bytes[channel] & MAX197_RNG;
-}
-
-/* Function called on read access on in{0,1,2,3,4,5,6,7}_{min,max} */
-static ssize_t max197_show_range(struct device *dev,
-				 struct device_attribute *devattr, char *buf)
-{
-	struct max197_data *data = dev_get_drvdata(dev);
-	struct sensor_device_attribute_2 *attr = to_sensor_dev_attr_2(devattr);
-	int channel = attr->index;
-	bool is_min = attr->nr;
-	int range;
-
-	if (mutex_lock_interruptible(&data->lock))
-		return -ERESTARTSYS;
-
-	range = max197_is_full_range(data, channel) ?
-		data->limit : data->limit / 2;
-	if (is_min) {
-		if (max197_is_bipolar(data, channel))
-			range = -range;
-		else
-			range = 0;
-	}
-
-	mutex_unlock(&data->lock);
-
-	return sprintf(buf, "%d\n", range);
-}
-
-/* Function called on write access on in{0,1,2,3,4,5,6,7}_{min,max} */
-static ssize_t max197_store_range(struct device *dev,
-				  struct device_attribute *devattr,
-				  const char *buf, size_t count)
-{
-	struct max197_data *data = dev_get_drvdata(dev);
-	struct sensor_device_attribute_2 *attr = to_sensor_dev_attr_2(devattr);
-	int channel = attr->index;
-	bool is_min = attr->nr;
-	long value;
-	int half = data->limit / 2;
-	int full = data->limit;
-
-	if (kstrtol(buf, 10, &value))
-		return -EINVAL;
-
-	if (is_min) {
-		if (value <= -full)
-			value = -full;
-		else if (value < 0)
-			value = -half;
-		else
-			value = 0;
-	} else {
-		if (value >= full)
-			value = full;
-		else
-			value = half;
-	}
-
-	if (mutex_lock_interruptible(&data->lock))
-		return -ERESTARTSYS;
-
-	if (value == 0) {
-		/* We can deduce only the polarity */
-		max197_set_unipolarity(data, channel);
-	} else if (value == -half) {
-		max197_set_bipolarity(data, channel);
-		max197_set_half_range(data, channel);
-	} else if (value == -full) {
-		max197_set_bipolarity(data, channel);
-		max197_set_full_range(data, channel);
-	} else if (value == half) {
-		/* We can deduce only the range */
-		max197_set_half_range(data, channel);
-	} else if (value == full) {
-		/* We can deduce only the range */
-		max197_set_full_range(data, channel);
-	}
-
-	mutex_unlock(&data->lock);
-
-	return count;
-}
-
-/* Function called on read access on in{0,1,2,3,4,5,6,7}_input */
-static ssize_t max197_show_input(struct device *dev,
-				 struct device_attribute *devattr,
-				 char *buf)
-{
-	struct max197_data *data = dev_get_drvdata(dev);
-	struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
-	int channel = attr->index;
-	s32 value;
-	int ret;
-
-	if (mutex_lock_interruptible(&data->lock))
-		return -ERESTARTSYS;
-
-	ret = data->pdata->convert(data->ctrl_bytes[channel]);
-	if (ret < 0) {
-		dev_err(dev, "conversion failed\n");
-		goto unlock;
-	}
-	value = ret;
-
-	/*
-	 * Coefficient to apply on raw value.
-	 * See Table 1. Full Scale and Zero Scale in the MAX197 datasheet.
-	 */
-	if (data->scale) {
-		value *= MAX197_SCALE;
-		if (max197_is_full_range(data, channel))
-			value *= 2;
-		value /= 10000;
-	}
-
-	ret = sprintf(buf, "%d\n", value);
-
-unlock:
-	mutex_unlock(&data->lock);
-	return ret;
-}
-
-static ssize_t name_show(struct device *dev, struct device_attribute *attr,
-			 char *buf)
-{
-	struct platform_device *pdev = to_platform_device(dev);
-	return sprintf(buf, "%s\n", pdev->name);
-}
-
-#define MAX197_SENSOR_DEVICE_ATTR_CH(chan)				\
-	static SENSOR_DEVICE_ATTR(in##chan##_input, S_IRUGO,		\
-				  max197_show_input, NULL, chan);	\
-	static SENSOR_DEVICE_ATTR_2(in##chan##_min, S_IRUGO | S_IWUSR,	\
-				    max197_show_range,			\
-				    max197_store_range,			\
-				    true, chan);			\
-	static SENSOR_DEVICE_ATTR_2(in##chan##_max, S_IRUGO | S_IWUSR,	\
-				    max197_show_range,			\
-				    max197_store_range,			\
-				    false, chan)
-
-#define MAX197_SENSOR_DEV_ATTR_IN(chan)					\
-	&sensor_dev_attr_in##chan##_input.dev_attr.attr,		\
-	&sensor_dev_attr_in##chan##_max.dev_attr.attr,			\
-	&sensor_dev_attr_in##chan##_min.dev_attr.attr
-
-static DEVICE_ATTR_RO(name);
-
-MAX197_SENSOR_DEVICE_ATTR_CH(0);
-MAX197_SENSOR_DEVICE_ATTR_CH(1);
-MAX197_SENSOR_DEVICE_ATTR_CH(2);
-MAX197_SENSOR_DEVICE_ATTR_CH(3);
-MAX197_SENSOR_DEVICE_ATTR_CH(4);
-MAX197_SENSOR_DEVICE_ATTR_CH(5);
-MAX197_SENSOR_DEVICE_ATTR_CH(6);
-MAX197_SENSOR_DEVICE_ATTR_CH(7);
-
-static const struct attribute_group max197_sysfs_group = {
-	.attrs = (struct attribute *[]) {
-		&dev_attr_name.attr,
-		MAX197_SENSOR_DEV_ATTR_IN(0),
-		MAX197_SENSOR_DEV_ATTR_IN(1),
-		MAX197_SENSOR_DEV_ATTR_IN(2),
-		MAX197_SENSOR_DEV_ATTR_IN(3),
-		MAX197_SENSOR_DEV_ATTR_IN(4),
-		MAX197_SENSOR_DEV_ATTR_IN(5),
-		MAX197_SENSOR_DEV_ATTR_IN(6),
-		MAX197_SENSOR_DEV_ATTR_IN(7),
-		NULL
-	},
-};
-
-static int max197_probe(struct platform_device *pdev)
-{
-	int ch, ret;
-	struct max197_data *data;
-	struct max197_platform_data *pdata = dev_get_platdata(&pdev->dev);
-	enum max197_chips chip = platform_get_device_id(pdev)->driver_data;
-
-	if (pdata == NULL) {
-		dev_err(&pdev->dev, "no platform data supplied\n");
-		return -EINVAL;
-	}
-
-	if (pdata->convert == NULL) {
-		dev_err(&pdev->dev, "no convert function supplied\n");
-		return -EINVAL;
-	}
-
-	data = devm_kzalloc_obj(&pdev->dev, struct max197_data);
-	if (!data)
-		return -ENOMEM;
-
-	data->pdata = pdata;
-	mutex_init(&data->lock);
-
-	if (chip == max197) {
-		data->limit = MAX197_LIMIT;
-		data->scale = true;
-	} else {
-		data->limit = MAX199_LIMIT;
-		data->scale = false;
-	}
-
-	for (ch = 0; ch < MAX197_NUM_CH; ch++)
-		data->ctrl_bytes[ch] = (u8) ch;
-
-	platform_set_drvdata(pdev, data);
-
-	ret = sysfs_create_group(&pdev->dev.kobj, &max197_sysfs_group);
-	if (ret) {
-		dev_err(&pdev->dev, "sysfs create group failed\n");
-		return ret;
-	}
-
-	data->hwmon_dev = hwmon_device_register(&pdev->dev);
-	if (IS_ERR(data->hwmon_dev)) {
-		ret = PTR_ERR(data->hwmon_dev);
-		dev_err(&pdev->dev, "hwmon device register failed\n");
-		goto error;
-	}
-
-	return 0;
-
-error:
-	sysfs_remove_group(&pdev->dev.kobj, &max197_sysfs_group);
-	return ret;
-}
-
-static void max197_remove(struct platform_device *pdev)
-{
-	struct max197_data *data = platform_get_drvdata(pdev);
-
-	hwmon_device_unregister(data->hwmon_dev);
-	sysfs_remove_group(&pdev->dev.kobj, &max197_sysfs_group);
-}
-
-static const struct platform_device_id max197_device_ids[] = {
-	{ .name = "max197", .driver_data = max197 },
-	{ .name = "max199", .driver_data = max199 },
-	{ }
-};
-MODULE_DEVICE_TABLE(platform, max197_device_ids);
-
-static struct platform_driver max197_driver = {
-	.driver = {
-		.name = "max197",
-	},
-	.probe = max197_probe,
-	.remove = max197_remove,
-	.id_table = max197_device_ids,
-};
-module_platform_driver(max197_driver);
-
-MODULE_LICENSE("GPL");
-MODULE_AUTHOR("Savoir-faire Linux Inc. <[email protected]>");
-MODULE_DESCRIPTION("Maxim MAX197 A/D Converter driver");
include/linux/platform_data/max197.h deleted +0 -23
deleted file mode 100644
index 03ef46f9cd65..000000000000
@@ -1,23 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-only */
-/*
- * Maxim MAX197 A/D Converter Driver
- *
- * Copyright (c) 2012 Savoir-faire Linux Inc.
- *          Vivien Didelot <[email protected]>
- *
- * For further information, see the Documentation/hwmon/max197.rst file.
- */
-
-#ifndef _PDATA_MAX197_H
-#define _PDATA_MAX197_H
-
-/**
- * struct max197_platform_data - MAX197 connectivity info
- * @convert:	Function used to start a conversion with control byte ctrl.
- *		It must return the raw data, or a negative error code.
- */
-struct max197_platform_data {
-	int (*convert)(u8 ctrl);
-};
-
-#endif /* _PDATA_MAX197_H */
Signature · 1 line
2.45.2
author maintainer
#29 lore raw

PATCH 9/10 hwmon: (f75375s) Drop platform data support

In reply to Guenter Roeck

There are no in-tree users of f75375s_platform_data. Initial PWM mode and enable settings are read from the chip registers during probe, and both pwm and pwm_enable are configurable through standard hwmon sysfs attributes.

Drop platform data support from the driver and remove include/linux/f75375s.h.

---
 MAINTAINERS             |  1 -
 drivers/hwmon/f75375s.c | 94 ++++++++++++++++-------------------------
 include/linux/f75375s.h | 21 ---------
 3 files changed, 37 insertions(+), 79 deletions(-)
 delete mode 100644 include/linux/f75375s.h
MAINTAINERS +0 -1
index 15d70b72d9a2..8d103c0b86b7 100644
@@ -10415,7 +10415,6 @@ M:	Riku Voipio <[email protected]>
 L:	[email protected]
 S:	Maintained
 F:	drivers/hwmon/f75375s.c
-F:	include/linux/f75375s.h
 
 FINTEK F81604 USB to 2xCANBUS DEVICE DRIVER
 M:	Ji-Ze Hong (Peter Hong) <[email protected]>
drivers/hwmon/f75375s.c +37 -57

126 lines not on this page · raw message

include/linux/f75375s.h deleted +0 -21
deleted file mode 100644
index e99e22500668..000000000000
@@ -1,21 +0,0 @@
-/*
- * f75375s.h - platform data structure for f75375s sensor
- *
- * This file is subject to the terms and conditions of the GNU General Public
- * License.  See the file "COPYING" in the main directory of this archive
- * for more details.
- *
- * Copyright (C) 2007, Riku Voipio <[email protected]>
- */
-
-#ifndef __LINUX_F75375S_H
-#define __LINUX_F75375S_H
-
-/* We want to set fans spinning on systems where there is no
- * BIOS to do that for us */
-struct f75375s_platform_data {
-	u8 pwm[2];
-	u8 pwm_enable[2];
-};
-
-#endif /* __LINUX_F75375S_H */
Signature · 1 line
2.45.2
#30 lore raw

Re: [PATCH 09/10] hwmon: (f75375s) Drop platform data support

Quoted 10 lines · Guenter Roeck

There are no in-tree users of f75375s_platform_data. Initial PWM mode and enable settings are read from the chip registers during probe, and both pwm and pwm_enable are configurable through standard hwmon sysfs attributes.

Drop platform data support from the driver and remove include/linux/f75375s.h.

Once more, I took a different route here and removed the whole driver. Here is my explanation:

hwmon: remove unused f75375s

This was used on the iop32x platform but has no references left in the kernel and has no devicetree support, so there is no longer a way to use it.

Note also that f75375_init() runs into a NULL pointer dereference when there is no platdata. Your patch fixes this, but I don't see how this would help anyone.

Arnd

author maintainer
#31 lore raw

Re: [PATCH 09/10] hwmon: (f75375s) Drop platform data support

Quoted 21 lines · Arnd Bergmann
Quoted 10 lines · Guenter Roeck

There are no in-tree users of f75375s_platform_data. Initial PWM mode and enable settings are read from the chip registers during probe, and both pwm and pwm_enable are configurable through standard hwmon sysfs attributes.

Drop platform data support from the driver and remove include/linux/f75375s.h.

Once more, I took a different route here and removed the whole driver. Here is my explanation:

hwmon: remove unused f75375s

This was used on the iop32x platform but has no references left in the kernel and has no devicetree support, so there is no longer a way to use it.

Quoted 6 lines

Note also that f75375_init() runs into a NULL pointer dereference when there is no platdata. Your patch fixes this, but I don't see how this would help anyone.

Makes sense. FWIW, I am all for removing drivers, and if this one crashed without platform data I think we have a good argument for removing it.

Thanks,
Guenter

author maintainer
#32 lore raw

Re: [PATCH 09/10] hwmon: (f75375s) Drop platform data support

In reply to Arnd Bergmann
Quoted 21 lines · Arnd Bergmann
Quoted 10 lines · Guenter Roeck

There are no in-tree users of f75375s_platform_data. Initial PWM mode and enable settings are read from the chip registers during probe, and both pwm and pwm_enable are configurable through standard hwmon sysfs attributes.

Drop platform data support from the driver and remove include/linux/f75375s.h.

Once more, I took a different route here and removed the whole driver. Here is my explanation:

hwmon: remove unused f75375s

This was used on the iop32x platform but has no references left in the kernel and has no devicetree support, so there is no longer a way to use it.

Quoted 6 lines

Note also that f75375_init() runs into a NULL pointer dereference when there is no platdata. Your patch fixes this, but I don't see how this would help anyone.

I applied your patch.

Thanks,
Guenter

author maintainer
#33 lore raw

PATCH 10/10 hwmon: (ds620) Drop platform data support

In reply to Guenter Roeck

There are no in-tree users of ds620_platform_data. Without platform data, the driver clears PO2 to keep the thermostat output pin low, which is the default valid configuration.

Drop platform data support from the driver, remove the unused platform_data header file, and update the driver documentation.

---
 Documentation/hwmon/ds620.rst       | 12 +-----------
 drivers/hwmon/ds620.c               | 13 ++-----------
 include/linux/platform_data/ds620.h | 22 ----------------------
 3 files changed, 3 insertions(+), 44 deletions(-)
 delete mode 100644 include/linux/platform_data/ds620.h
Documentation/hwmon/ds620.rst +1 -11
index e2d915a988a2..6a18ecea5c4f 100644
@@ -25,14 +25,4 @@ into non-volatile on-chip registers). Temperature range is -55 degree Celsius
 to +125. Between 0 and 70 degree Celsius, accuracy is 0.5 Kelvin. The value
 returned via sysfs displays post decimal positions.
 
-The thermostat function works as follows: When configured via platform_data
-(struct ds620_platform_data) .pomode == 0 (default), the thermostat output pin
-PO is always low. If .pomode == 1, the thermostat is in PO_LOW mode. I.e., the
-output pin PO becomes active when the temperature falls below temp1_min and
-stays active until the temperature goes above temp1_max.
-
-Likewise, with .pomode == 2, the thermostat is in PO_HIGH mode. I.e., the PO
-output pin becomes active when the temperature goes above temp1_max and stays
-active until the temperature falls below temp1_min.
-
-The PO output pin of the DS620 operates active-low.
+The thermostat output pin PO is configured to be always low.
drivers/hwmon/ds620.c +2 -11
index efb005bedabb..17ae9cc72761 100644
@@ -17,7 +17,6 @@
 #include <linux/err.h>
 #include <linux/mutex.h>
 #include <linux/sysfs.h>
-#include <linux/platform_data/ds620.h>
 
 /*
  * Many DS620 constants specified below
@@ -64,7 +63,6 @@ struct ds620_data {
 
 static void ds620_init_client(struct i2c_client *client)
 {
-	struct ds620_platform_data *ds620_info = dev_get_platdata(&client->dev);
 	u16 conf, new_conf;
 
 	new_conf = conf =
@@ -72,15 +70,8 @@ static void ds620_init_client(struct i2c_client *client)
 
 	/* switch to continuous conversion mode */
 	new_conf &= ~DS620_REG_CONFIG_1SHOT;
-	/* already high at power-on, but don't trust the BIOS! */
-	new_conf |= DS620_REG_CONFIG_PO2;
-	/* thermostat mode according to platform data */
-	if (ds620_info && ds620_info->pomode == 1)
-		new_conf &= ~DS620_REG_CONFIG_PO1; /* PO_LOW */
-	else if (ds620_info && ds620_info->pomode == 2)
-		new_conf |= DS620_REG_CONFIG_PO1; /* PO_HIGH */
-	else
-		new_conf &= ~DS620_REG_CONFIG_PO2; /* always low */
+	/* thermostat output pin always low */
+	new_conf &= ~DS620_REG_CONFIG_PO2;
 	/* with highest precision */
 	new_conf |= DS620_REG_CONFIG_R1 | DS620_REG_CONFIG_R0;
 
include/linux/platform_data/ds620.h deleted +0 -22
deleted file mode 100644
index f0ce22a78bb8..000000000000
@@ -1,22 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-#ifndef _LINUX_DS620_H
-#define _LINUX_DS620_H
-
-#include <linux/types.h>
-#include <linux/i2c.h>
-
-/* platform data for the DS620 temperature sensor and thermostat */
-
-struct ds620_platform_data {
-	/*
-	 *  Thermostat output pin PO mode:
-	 *  0 = always low (default)
-	 *  1 = PO_LOW
-	 *  2 = PO_HIGH
-	 *
-	 * (see Documentation/hwmon/ds620.rst)
-	 */
-	int pomode;
-};
-
-#endif /* _LINUX_DS620_H */
Signature · 1 line
2.45.2
Acked-by on v1 10/10
#34 lore raw

Re: [PATCH 10/10] hwmon: (ds620) Drop platform data support

Quoted 9 lines · Guenter Roeck

There are no in-tree users of ds620_platform_data. Without platform data, the driver clears PO2 to keep the thermostat output pin low, which is the default valid configuration.

Drop platform data support from the driver, remove the unused platform_data header file, and update the driver documentation.

My patch here was different, as I concluded that this was likely never used upstream and removed the whole thing.

Your patch looks fine though, so if you want to keep the driver:

author maintainer
#35 lore raw

Re: [PATCH 10/10] hwmon: (ds620) Drop platform data support

Quoted 11 lines · Arnd Bergmann
Quoted 9 lines · Guenter Roeck

There are no in-tree users of ds620_platform_data. Without platform data, the driver clears PO2 to keep the thermostat output pin low, which is the default valid configuration.

Drop platform data support from the driver, remove the unused platform_data header file, and update the driver documentation.

Quoted 6 lines

My patch here was different, as I concluded that this was likely never used upstream and removed the whole thing.

Your patch looks fine though, so if you want to keep the driver:

The Analog web site states that the chip is still in production, so I didn't just want to remove the driver. Let's wait to see if Nuno has a comment.

Thanks,
Guenter

author maintainer
#36 lore raw

Re: [PATCH 10/10] hwmon: (ds620) Drop platform data support

In reply to Arnd Bergmann
Quoted 11 lines · Arnd Bergmann
Quoted 9 lines · Guenter Roeck

There are no in-tree users of ds620_platform_data. Without platform data, the driver clears PO2 to keep the thermostat output pin low, which is the default valid configuration.

Drop platform data support from the driver, remove the unused platform_data header file, and update the driver documentation.

Quoted 6 lines

My patch here was different, as I concluded that this was likely never used upstream and removed the whole thing.

Your patch looks fine though, so if you want to keep the driver:

I took your removal patch.

Thanks,
Guenter

Reviewed-by on v1 10/10
#37 lore raw

Re: [PATCH 10/10] hwmon: (ds620) Drop platform data support

In reply to Guenter Roeck
Quoted 10 lines · Guenter Roeck

There are no in-tree users of ds620_platform_data. Without platform data, the driver clears PO2 to keep the thermostat output pin low, which is the default valid configuration.

Drop platform data support from the driver, remove the unused platform_data header file, and update the driver documentation.

---

For whatever patch you end up applying...

Quoted 95 lines
 Documentation/hwmon/ds620.rst       | 12 +-----------
 drivers/hwmon/ds620.c               | 13 ++-----------
 include/linux/platform_data/ds620.h | 22 ----------------------
 3 files changed, 3 insertions(+), 44 deletions(-)
 delete mode 100644 include/linux/platform_data/ds620.h
Documentation/hwmon/ds620.rst +1 -11
index e2d915a988a2..6a18ecea5c4f 100644
@@ -25,14 +25,4 @@ into non-volatile on-chip registers). Temperature range is -55 degree Celsius
 to +125. Between 0 and 70 degree Celsius, accuracy is 0.5 Kelvin. The value
 returned via sysfs displays post decimal positions.
 
-The thermostat function works as follows: When configured via platform_data
-(struct ds620_platform_data) .pomode == 0 (default), the thermostat output pin
-PO is always low. If .pomode == 1, the thermostat is in PO_LOW mode. I.e., the
-output pin PO becomes active when the temperature falls below temp1_min and
-stays active until the temperature goes above temp1_max.
-
-Likewise, with .pomode == 2, the thermostat is in PO_HIGH mode. I.e., the PO
-output pin becomes active when the temperature goes above temp1_max and stays
-active until the temperature falls below temp1_min.
-
-The PO output pin of the DS620 operates active-low.
+The thermostat output pin PO is configured to be always low.
drivers/hwmon/ds620.c +2 -11
index efb005bedabb..17ae9cc72761 100644
@@ -17,7 +17,6 @@
 #include <linux/err.h>
 #include <linux/mutex.h>
 #include <linux/sysfs.h>
-#include <linux/platform_data/ds620.h>
 
 /*
  * Many DS620 constants specified below
@@ -64,7 +63,6 @@ struct ds620_data {
 
 static void ds620_init_client(struct i2c_client *client)
 {
-	struct ds620_platform_data *ds620_info = dev_get_platdata(&client->dev);
 	u16 conf, new_conf;
 
 	new_conf = conf =
@@ -72,15 +70,8 @@ static void ds620_init_client(struct i2c_client *client)
 
 	/* switch to continuous conversion mode */
 	new_conf &= ~DS620_REG_CONFIG_1SHOT;
-	/* already high at power-on, but don't trust the BIOS! */
-	new_conf |= DS620_REG_CONFIG_PO2;
-	/* thermostat mode according to platform data */
-	if (ds620_info && ds620_info->pomode == 1)
-		new_conf &= ~DS620_REG_CONFIG_PO1; /* PO_LOW */
-	else if (ds620_info && ds620_info->pomode == 2)
-		new_conf |= DS620_REG_CONFIG_PO1; /* PO_HIGH */
-	else
-		new_conf &= ~DS620_REG_CONFIG_PO2; /* always low */
+	/* thermostat output pin always low */
+	new_conf &= ~DS620_REG_CONFIG_PO2;
 	/* with highest precision */
 	new_conf |= DS620_REG_CONFIG_R1 | DS620_REG_CONFIG_R0;
 
include/linux/platform_data/ds620.h deleted +0 -22
deleted file mode 100644
index f0ce22a78bb8..000000000000
@@ -1,22 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-#ifndef _LINUX_DS620_H
-#define _LINUX_DS620_H
-
-#include <linux/types.h>
-#include <linux/i2c.h>
-
-/* platform data for the DS620 temperature sensor and thermostat */
-
-struct ds620_platform_data {
-	/*
-	 *  Thermostat output pin PO mode:
-	 *  0 = always low (default)
-	 *  1 = PO_LOW
-	 *  2 = PO_HIGH
-	 *
-	 * (see Documentation/hwmon/ds620.rst)
-	 */
-	int pomode;
-};
-
-#endif /* _LINUX_DS620_H */
Signature · 1 line
2.45.2
#38 lore raw
In reply to Guenter Roeck
Quoted 7 lines · Guenter Roeck

Several drivers in drivers/hwmon still support configuration through platform data structures even though no in-tree platform or board code ever instantiates or supplies that platform data.

Audit all hwmon drivers using dev_get_platdata(), dev->platform_data, or headers under include/linux/platform_data/ and drop dead platform data support where it is never provided in-tree:

Hi Guenter,

I already commented on the individual patches, and this looks all ok to me as I did almost exactly the same thing.

Obviously it's a bit unfortunate that we duplicated the work, but it does give the chance to compare both and find possible mistakes.

My patches are in
https://git.kernel.org/pub/scm/linux/kernel/git/arnd/playground.git/log/?h=board-remove-7.4

337dd938a3b0 hwmon: shtc1: remove platform_data based probing ab1c9ff391ad hwmon: emc2305: remove platform_data based probing 985a7d241616 hwmon: ltc4245: remove platform data probing 8b300deafa72 hwmon: g762: remove pdata based probing 489bafe5cfb8 hwmon: gsc: remove pdata based probing 94ec070cdb5f hwmon: asd7828: remove pdata based probing 296048203f0b hwmon: mcp3021: remove platform_data probe support 93ce98eff9b5 hwmon: remove unused max1111 driver 9d4791700bb8 hwmon: remove unused max197 driver 190ba99436ff hwmon: remove unused ds620 driver 157784eaf3df hwmon: remove unused f75375s

The main difference was that I ended up being a little more aggressive about removing drivers entirely.

The max1111 driver is technically still used in mainline, but I remove the last reference from the pxa board files earlier in that branch.

Arnd

author maintainer
#39 lore raw
Quoted 9 lines · Arnd Bergmann
Quoted 7 lines · Guenter Roeck

Several drivers in drivers/hwmon still support configuration through platform data structures even though no in-tree platform or board code ever instantiates or supplies that platform data.

Audit all hwmon drivers using dev_get_platdata(), dev->platform_data, or headers under include/linux/platform_data/ and drop dead platform data support where it is never provided in-tree:

Quoted 8 lines

Hi Guenter,

I already commented on the individual patches, and this looks all ok to me as I did almost exactly the same thing.

Obviously it's a bit unfortunate that we duplicated the work, but it does give the chance to compare both and find possible mistakes.

At least on my side it took maybe 30 minutes, so not much time lost. All I did was to ask Gemini to do the work for me (see the Summary patch).

Quoted 15 lines

My patches are in
https://git.kernel.org/pub/scm/linux/kernel/git/arnd/playground.git/log/?h=board-remove-7.4

337dd938a3b0 hwmon: shtc1: remove platform_data based probing ab1c9ff391ad hwmon: emc2305: remove platform_data based probing 985a7d241616 hwmon: ltc4245: remove platform data probing 8b300deafa72 hwmon: g762: remove pdata based probing 489bafe5cfb8 hwmon: gsc: remove pdata based probing 94ec070cdb5f hwmon: asd7828: remove pdata based probing 296048203f0b hwmon: mcp3021: remove platform_data probe support 93ce98eff9b5 hwmon: remove unused max1111 driver 9d4791700bb8 hwmon: remove unused max197 driver 190ba99436ff hwmon: remove unused ds620 driver 157784eaf3df hwmon: remove unused f75375s

Quoted 7 lines

The main difference was that I ended up being a little more aggressive about removing drivers entirely.

The max1111 driver is technically still used in mainline, but I remove the last reference from the pxa board files earlier in that branch.

I'll look into your patches later and pick the ones I like better (including the removals).

Again, sorry, I did not intend to duplicate your work.

Thanks,
Guenter

#40 lore raw
Quoted 10 lines · Guenter Roeck
Quoted 5 lines · Arnd Bergmann

On Tue, Nov 10, 2026, at 19:34, Guenter Roeck wrote:

Obviously it's a bit unfortunate that we duplicated the work, but it does give the chance to compare both and find possible mistakes.

At least on my side it took maybe 30 minutes, so not much time lost. All I did was to ask Gemini to do the work for me (see the Summary patch).

I probably took me a little longer for these, but I also did 300 patches in total, and a lot of these were more complex.

Quoted 23 lines
Quoted 15 lines

My patches are in
https://git.kernel.org/pub/scm/linux/kernel/git/arnd/playground.git/log/?h=board-remove-7.4

337dd938a3b0 hwmon: shtc1: remove platform_data based probing ab1c9ff391ad hwmon: emc2305: remove platform_data based probing 985a7d241616 hwmon: ltc4245: remove platform data probing 8b300deafa72 hwmon: g762: remove pdata based probing 489bafe5cfb8 hwmon: gsc: remove pdata based probing 94ec070cdb5f hwmon: asd7828: remove pdata based probing 296048203f0b hwmon: mcp3021: remove platform_data probe support 93ce98eff9b5 hwmon: remove unused max1111 driver 9d4791700bb8 hwmon: remove unused max197 driver 190ba99436ff hwmon: remove unused ds620 driver 157784eaf3df hwmon: remove unused f75375s

Quoted 7 lines

The main difference was that I ended up being a little more aggressive about removing drivers entirely.

The max1111 driver is technically still used in mainline, but I remove the last reference from the pxa board files earlier in that branch.

Quoted 4 lines

I'll look into your patches later and pick the ones I like better (including the removals).

Again, sorry, I did not intend to duplicate your work.

No worries, I'm mainly glad to see the patches get merged, no matter which version. It is very nice to see that we arrived at essentially the same list of drivers.

Arnd

author maintainer
#41 lore raw
In reply to Arnd Bergmann

Hi Arnd,

Quoted 32 lines · Arnd Bergmann
Quoted 7 lines · Guenter Roeck

Several drivers in drivers/hwmon still support configuration through platform data structures even though no in-tree platform or board code ever instantiates or supplies that platform data.

Audit all hwmon drivers using dev_get_platdata(), dev->platform_data, or headers under include/linux/platform_data/ and drop dead platform data support where it is never provided in-tree:

Hi Guenter,

I already commented on the individual patches, and this looks all ok to me as I did almost exactly the same thing.

Obviously it's a bit unfortunate that we duplicated the work, but it does give the chance to compare both and find possible mistakes.

My patches are in
https://git.kernel.org/pub/scm/linux/kernel/git/arnd/playground.git/log/?h=board-remove-7.4

337dd938a3b0 hwmon: shtc1: remove platform_data based probing ab1c9ff391ad hwmon: emc2305: remove platform_data based probing 985a7d241616 hwmon: ltc4245: remove platform data probing 8b300deafa72 hwmon: g762: remove pdata based probing 489bafe5cfb8 hwmon: gsc: remove pdata based probing 94ec070cdb5f hwmon: asd7828: remove pdata based probing 296048203f0b hwmon: mcp3021: remove platform_data probe support 93ce98eff9b5 hwmon: remove unused max1111 driver 9d4791700bb8 hwmon: remove unused max197 driver 190ba99436ff hwmon: remove unused ds620 driver 157784eaf3df hwmon: remove unused f75375s

Quoted 7 lines

The main difference was that I ended up being a little more aggressive about removing drivers entirely.

The max1111 driver is technically still used in mainline, but I remove the last reference from the pxa board files earlier in that branch.

All patches are now in hwmon-next (either your or my patch), except for the max1111 driver removal.

Thanks,
Guenter