All of lore.kernel.org
 help / color / mirror / Atom feed
From: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
To: "Jean Delvare" <jdelvare@suse.com>,
	"Guenter Roeck" <linux@roeck-us.net>,
	"Jonathan Corbet" <corbet@lwn.net>,
	"Oded Gabbay" <ogabbay@kernel.org>,
	"Michael Hennerich" <Michael.Hennerich@analog.com>,
	"Aleksa Savic" <savicaleksa83@gmail.com>,
	"Jack Doan" <me@jackdoan.com>, "Nuno Sá" <nuno.sa@analog.com>,
	"Marius Zachmann" <mail@mariuszachmann.de>,
	"Wilken Gottwalt" <wilken.gottwalt@posteo.net>,
	"Pali Rohár" <pali@kernel.org>,
	"Jean-Marie Verdun" <verdun@hpe.com>,
	"Nick Hawkins" <nick.hawkins@hpe.com>,
	"Xu Yilun" <yilun.xu@intel.com>, "Tom Rix" <trix@redhat.com>,
	"Clemens Ladisch" <clemens@ladisch.de>,
	"Rudolf Marek" <r.marek@assembler.cz>,
	"Charles Keepax" <ckeepax@opensource.cirrus.com>,
	"Richard Fitzgerald" <rf@opensource.cirrus.com>,
	"Ibrahim Tilki" <Ibrahim.Tilki@analog.com>,
	"Avi Fishman" <avifishman70@gmail.com>,
	"Tomer Maimon" <tmaimon77@gmail.com>,
	"Tali Perry" <tali.perry1@gmail.com>,
	"Patrick Venture" <venture@google.com>,
	"Nancy Yuen" <yuenn@google.com>,
	"Benjamin Fair" <benjaminfair@google.com>,
	"Jonas Malaco" <jonas@protocubo.io>,
	"Aleksandr Mezin" <mezin.alexander@gmail.com>,
	"Derek John Clark" <derekjohn.clark@gmail.com>,
	"Joaquín Ignacio Aramendía" <samsagax@gmail.com>,
	"Iwona Winiarska" <iwona.winiarska@intel.com>,
	"Florian Fainelli" <f.fainelli@gmail.com>,
	"Broadcom internal kernel review list"
	<bcm-kernel-feedback-list@broadcom.com>,
	"Hans de Goede" <hdegoede@redhat.com>,
	"Michael Walle" <michael@walle.cc>,
	"Lars Povlsen" <lars.povlsen@microchip.com>,
	"Steen Hegelund" <Steen.Hegelund@microchip.com>,
	"Daniel Machon" <daniel.machon@microchip.com>,
	UNGLinuxDriver@microchip.com,
	"Agathe Porte" <agathe.porte@nokia.com>,
	"Eric Tremblay" <etremblay@distech-controls.com>,
	"Robert Marko" <robert.marko@sartura.hr>,
	"Luka Perkov" <luka.perkov@sartura.hr>,
	linux-hwmon@vger.kernel.org, linux-doc@vger.kernel.org,
	linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org,
	patches@opensource.cirrus.com, openbmc@lists.ozlabs.org,
	linux-rpi-kernel@lists.infradead.org,
	linux-arm-kernel@lists.infradead.org
Cc: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Subject: [PATCH 01/68] hwmon: constify pointers to hwmon_channel_info
Date: Thu,  6 Apr 2023 22:29:56 +0200	[thread overview]
Message-ID: <20230406203103.3011503-2-krzysztof.kozlowski@linaro.org> (raw)
In-Reply-To: <20230406203103.3011503-1-krzysztof.kozlowski@linaro.org>

HWmon core receives an array of pointers to hwmon_channel_info and it
does not modify it, thus it can be array of const pointers for safety.
This allows drivers to make them also const.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
---
 Documentation/hwmon/hwmon-kernel-api.rst | 6 +++---
 drivers/accel/habanalabs/common/hwmon.c  | 2 +-
 drivers/hwmon/hwmon.c                    | 4 ++--
 include/linux/hwmon.h                    | 2 +-
 4 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/Documentation/hwmon/hwmon-kernel-api.rst b/Documentation/hwmon/hwmon-kernel-api.rst
index dbd68d7b033a..c2d1e0299d8d 100644
--- a/Documentation/hwmon/hwmon-kernel-api.rst
+++ b/Documentation/hwmon/hwmon-kernel-api.rst
@@ -107,7 +107,7 @@ The hwmon_chip_info structure looks as follows::
 
 	struct hwmon_chip_info {
 		const struct hwmon_ops *ops;
-		const struct hwmon_channel_info **info;
+		const struct hwmon_channel_info * const *info;
 	};
 
 It contains the following fields:
@@ -203,7 +203,7 @@ register (HWMON_T_MAX) as well as a maximum temperature hysteresis register
 		.config = lm75_temp_config,
 	};
 
-	static const struct hwmon_channel_info *lm75_info[] = {
+	static const struct hwmon_channel_info * const lm75_info[] = {
 		&lm75_chip,
 		&lm75_temp,
 		NULL
@@ -212,7 +212,7 @@ register (HWMON_T_MAX) as well as a maximum temperature hysteresis register
 	The HWMON_CHANNEL_INFO() macro can and should be used when possible.
 	With this macro, the above example can be simplified to
 
-	static const struct hwmon_channel_info *lm75_info[] = {
+	static const struct hwmon_channel_info * const lm75_info[] = {
 		HWMON_CHANNEL_INFO(chip,
 				HWMON_C_REGISTER_TZ | HWMON_C_UPDATE_INTERVAL),
 		HWMON_CHANNEL_INFO(temp,
diff --git a/drivers/accel/habanalabs/common/hwmon.c b/drivers/accel/habanalabs/common/hwmon.c
index 55eb0203817f..8598056216e7 100644
--- a/drivers/accel/habanalabs/common/hwmon.c
+++ b/drivers/accel/habanalabs/common/hwmon.c
@@ -914,7 +914,7 @@ void hl_hwmon_fini(struct hl_device *hdev)
 
 void hl_hwmon_release_resources(struct hl_device *hdev)
 {
-	const struct hwmon_channel_info **channel_info_arr;
+	const struct hwmon_channel_info * const *channel_info_arr;
 	int i = 0;
 
 	if (!hdev->hl_chip_info->info)
diff --git a/drivers/hwmon/hwmon.c b/drivers/hwmon/hwmon.c
index dc2e3646f943..573b83b6c08c 100644
--- a/drivers/hwmon/hwmon.c
+++ b/drivers/hwmon/hwmon.c
@@ -173,7 +173,7 @@ static int hwmon_thermal_set_trips(struct thermal_zone_device *tz, int low, int
 	struct hwmon_thermal_data *tdata = thermal_zone_device_priv(tz);
 	struct hwmon_device *hwdev = to_hwmon_device(tdata->dev);
 	const struct hwmon_chip_info *chip = hwdev->chip;
-	const struct hwmon_channel_info **info = chip->info;
+	const struct hwmon_channel_info * const *info = chip->info;
 	unsigned int i;
 	int err;
 
@@ -252,7 +252,7 @@ static int hwmon_thermal_register_sensors(struct device *dev)
 {
 	struct hwmon_device *hwdev = to_hwmon_device(dev);
 	const struct hwmon_chip_info *chip = hwdev->chip;
-	const struct hwmon_channel_info **info = chip->info;
+	const struct hwmon_channel_info * const *info = chip->info;
 	void *drvdata = dev_get_drvdata(dev);
 	int i;
 
diff --git a/include/linux/hwmon.h b/include/linux/hwmon.h
index c1b62384b6ee..492dd27a5dd8 100644
--- a/include/linux/hwmon.h
+++ b/include/linux/hwmon.h
@@ -430,7 +430,7 @@ struct hwmon_channel_info {
  */
 struct hwmon_chip_info {
 	const struct hwmon_ops *ops;
-	const struct hwmon_channel_info **info;
+	const struct hwmon_channel_info * const *info;
 };
 
 /* hwmon_device_register() is deprecated */
-- 
2.34.1


  reply	other threads:[~2023-04-06 20:31 UTC|newest]

Thread overview: 79+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-06 20:29 [PATCH 00/68] hwmon: constify pointers to hwmon_channel_info Krzysztof Kozlowski
2023-04-06 20:29 ` Krzysztof Kozlowski [this message]
2023-04-06 20:29 ` [PATCH 02/68] hwmon: adm1177: " Krzysztof Kozlowski
2023-04-06 20:29 ` [PATCH 03/68] hwmon: adm9240: " Krzysztof Kozlowski
2023-04-06 20:29 ` [PATCH 04/68] hwmon: adt7411: " Krzysztof Kozlowski
2023-04-06 20:30 ` [PATCH 05/68] hwmon: adt7470: " Krzysztof Kozlowski
2023-04-06 20:30 ` [PATCH 06/68] hwmon: adt7x10: " Krzysztof Kozlowski
2023-04-06 20:30 ` [PATCH 07/68] hwmon: aht10: " Krzysztof Kozlowski
2023-04-06 20:30 ` [PATCH 08/68] hwmon: aquacomputer: " Krzysztof Kozlowski
2023-04-06 20:30 ` [PATCH 09/68] hwmon: as370: " Krzysztof Kozlowski
2023-04-06 20:30 ` [PATCH 10/68] hwmon: axi-fan: " Krzysztof Kozlowski
2023-04-06 20:30 ` [PATCH 11/68] hwmon: bt1-pvt: " Krzysztof Kozlowski
2023-04-06 20:30 ` [PATCH 12/68] hwmon: corsair: " Krzysztof Kozlowski
2023-04-09  8:21   ` Wilken Gottwalt
2023-04-09  8:21     ` Wilken Gottwalt
2023-04-06 20:30 ` [PATCH 13/68] hwmon: dell-smm: " Krzysztof Kozlowski
2023-04-06 20:30 ` [PATCH 14/68] hwmon: drivetemp: " Krzysztof Kozlowski
2023-04-06 20:30 ` [PATCH 15/68] hwmon: emc2305: " Krzysztof Kozlowski
2023-04-06 20:30 ` [PATCH 16/68] hwmon: ftsteutates: " Krzysztof Kozlowski
2023-04-06 20:30 ` [PATCH 17/68] hwmon: gxp-fan: " Krzysztof Kozlowski
2023-04-06 20:30 ` [PATCH 18/68] hwmon: i5500_temp: " Krzysztof Kozlowski
2023-04-06 20:30 ` [PATCH 19/68] hwmon: ina238: " Krzysztof Kozlowski
2023-04-06 20:30 ` [PATCH 20/68] hwmon: ina3221: " Krzysztof Kozlowski
2023-04-06 20:30 ` [PATCH 21/68] hwmon: intel-m10-bmc: " Krzysztof Kozlowski
2023-04-06 20:30 ` [PATCH 22/68] hwmon: jc42: " Krzysztof Kozlowski
2023-04-06 20:30 ` [PATCH 23/68] hwmon: k10temp: " Krzysztof Kozlowski
2023-04-06 20:30 ` [PATCH 24/68] hwmon: k8temp: " Krzysztof Kozlowski
2023-04-06 20:30 ` [PATCH 25/68] hwmon: lan966x: " Krzysztof Kozlowski
2023-04-06 20:30 ` [PATCH 26/68] hwmon: lm75: " Krzysztof Kozlowski
2023-04-06 20:30 ` [PATCH 27/68] hwmon: lm83: " Krzysztof Kozlowski
2023-04-06 20:30 ` [PATCH 28/68] hwmon: lm95241: " Krzysztof Kozlowski
2023-04-06 20:30 ` [PATCH 29/68] hwmon: lm95245: " Krzysztof Kozlowski
2023-04-06 20:30 ` [PATCH 30/68] hwmon: lochnagar: " Krzysztof Kozlowski
2023-04-10  9:36   ` Charles Keepax
2023-04-10  9:36     ` Charles Keepax
2023-04-06 20:30 ` [PATCH 31/68] hwmon: ltc2947: " Krzysztof Kozlowski
2023-04-06 20:30 ` [PATCH 32/68] hwmon: ltc2992: " Krzysztof Kozlowski
2023-04-06 20:30 ` [PATCH 33/68] hwmon: ltc4245: " Krzysztof Kozlowski
2023-04-06 20:30 ` [PATCH 34/68] hwmon: ltq-cputemp: " Krzysztof Kozlowski
2023-04-06 20:30 ` [PATCH 35/68] hwmon: max127: " Krzysztof Kozlowski
2023-04-06 20:30 ` [PATCH 36/68] hwmon: max31730: " Krzysztof Kozlowski
2023-04-06 20:30 ` [PATCH 37/68] hwmon: max31760: " Krzysztof Kozlowski
2023-04-06 20:30 ` [PATCH 38/68] hwmon: max31790: " Krzysztof Kozlowski
2023-04-06 20:30 ` [PATCH 39/68] hwmon: max6620: " Krzysztof Kozlowski
2023-04-06 20:30 ` [PATCH 40/68] hwmon: max6621: " Krzysztof Kozlowski
2023-04-06 20:30 ` [PATCH 41/68] hwmon: max6650: " Krzysztof Kozlowski
2023-04-06 20:35 ` [PATCH 42/68] hwmon: mc34vr500: " Krzysztof Kozlowski
2023-04-06 20:35 ` [PATCH 43/68] hwmon: mcp3021: " Krzysztof Kozlowski
2023-04-06 20:35 ` [PATCH 44/68] hwmon: mlxreg: " Krzysztof Kozlowski
2023-04-06 20:35 ` [PATCH 45/68] hwmon: nct7904: " Krzysztof Kozlowski
2023-04-06 20:35 ` [PATCH 46/68] hwmon: npcm750-pwm: " Krzysztof Kozlowski
2023-04-06 20:35 ` [PATCH 47/68] hwmon: ntc_thermistor: " Krzysztof Kozlowski
2023-04-06 20:35 ` [PATCH 48/68] hwmon: nzxt: " Krzysztof Kozlowski
2023-04-08  3:14   ` Aleksandr Mezin
2023-04-08  3:14     ` Aleksandr Mezin
2023-04-08 10:33     ` Jonas Malaco
2023-04-08 10:33       ` Jonas Malaco
2023-04-06 20:35 ` [PATCH 49/68] hwmon: oxp-sensors: " Krzysztof Kozlowski
2023-04-06 20:38 ` [PATCH 50/68] hwmon: peci: " Krzysztof Kozlowski
2023-04-06 20:38 ` [PATCH 51/68] hwmon: powr1220: " Krzysztof Kozlowski
2023-04-06 20:38 ` [PATCH 52/68] hwmon: raspberrypi: " Krzysztof Kozlowski
2023-04-06 20:38 ` [PATCH 53/68] hwmon: sbrmi: " Krzysztof Kozlowski
2023-04-06 20:38 ` [PATCH 54/68] hwmon: sbtsi_temp: " Krzysztof Kozlowski
2023-04-06 20:38 ` [PATCH 55/68] hwmon: sch5627: " Krzysztof Kozlowski
2023-04-06 20:38 ` [PATCH 56/68] hwmon: sht4x: " Krzysztof Kozlowski
2023-04-06 20:38 ` [PATCH 57/68] hwmon: sl28cpld: " Krzysztof Kozlowski
2023-04-06 20:38 ` [PATCH 58/68] hwmon: smpro: " Krzysztof Kozlowski
2023-04-06 20:38 ` [PATCH 59/68] hwmon: sparx5-temp: " Krzysztof Kozlowski
2023-04-06 20:40 ` [PATCH 60/68] hwmon: sy7636a: " Krzysztof Kozlowski
2023-04-06 20:40 ` [PATCH 61/68] hwmon: tmp102: " Krzysztof Kozlowski
2023-04-06 20:40 ` [PATCH 62/68] hwmon: tmp103: " Krzysztof Kozlowski
2023-04-06 20:40 ` [PATCH 63/68] hwmon: tmp108: " Krzysztof Kozlowski
2023-04-06 20:40 ` [PATCH 64/68] hwmon: tmp464: " Krzysztof Kozlowski
2023-04-06 20:40 ` [PATCH 65/68] hwmon: tmp513: " Krzysztof Kozlowski
2023-04-06 20:40 ` [PATCH 66/68] hwmon: tps23861: " Krzysztof Kozlowski
2023-04-06 20:40 ` [PATCH 67/68] hwmon: w83627ehf: " Krzysztof Kozlowski
2023-04-06 20:40 ` [PATCH 68/68] hwmon: w83773g: " Krzysztof Kozlowski
2023-04-07 15:47 [PATCH 01/68] hwmon: " Guenter Roeck
2023-04-07 15:47 ` Guenter Roeck

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230406203103.3011503-2-krzysztof.kozlowski@linaro.org \
    --to=krzysztof.kozlowski@linaro.org \
    --cc=Ibrahim.Tilki@analog.com \
    --cc=Michael.Hennerich@analog.com \
    --cc=Steen.Hegelund@microchip.com \
    --cc=UNGLinuxDriver@microchip.com \
    --cc=agathe.porte@nokia.com \
    --cc=avifishman70@gmail.com \
    --cc=bcm-kernel-feedback-list@broadcom.com \
    --cc=benjaminfair@google.com \
    --cc=ckeepax@opensource.cirrus.com \
    --cc=clemens@ladisch.de \
    --cc=corbet@lwn.net \
    --cc=daniel.machon@microchip.com \
    --cc=derekjohn.clark@gmail.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=etremblay@distech-controls.com \
    --cc=f.fainelli@gmail.com \
    --cc=hdegoede@redhat.com \
    --cc=iwona.winiarska@intel.com \
    --cc=jdelvare@suse.com \
    --cc=jonas@protocubo.io \
    --cc=lars.povlsen@microchip.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rpi-kernel@lists.infradead.org \
    --cc=linux@roeck-us.net \
    --cc=luka.perkov@sartura.hr \
    --cc=mail@mariuszachmann.de \
    --cc=me@jackdoan.com \
    --cc=mezin.alexander@gmail.com \
    --cc=michael@walle.cc \
    --cc=nick.hawkins@hpe.com \
    --cc=nuno.sa@analog.com \
    --cc=ogabbay@kernel.org \
    --cc=openbmc@lists.ozlabs.org \
    --cc=pali@kernel.org \
    --cc=patches@opensource.cirrus.com \
    --cc=r.marek@assembler.cz \
    --cc=rf@opensource.cirrus.com \
    --cc=robert.marko@sartura.hr \
    --cc=samsagax@gmail.com \
    --cc=savicaleksa83@gmail.com \
    --cc=tali.perry1@gmail.com \
    --cc=tmaimon77@gmail.com \
    --cc=trix@redhat.com \
    --cc=venture@google.com \
    --cc=verdun@hpe.com \
    --cc=wilken.gottwalt@posteo.net \
    --cc=yilun.xu@intel.com \
    --cc=yuenn@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.