]> www.infradead.org Git - users/jedix/linux-maple.git/commit
hwmon: (ina2xx) Mark regmap_config as const
authorGuenter Roeck <linux@roeck-us.net>
Thu, 1 Aug 2024 23:43:03 +0000 (16:43 -0700)
committerGuenter Roeck <linux@roeck-us.net>
Fri, 30 Aug 2024 15:34:23 +0000 (08:34 -0700)
commit2bb476524c61f43e6e89aeacaee6599ce5dd3505
treeac7191885694a67e7738089b096bffbe1ed8e283
parent232177a37b90d76d3616f28fb47636d81c02fe8b
hwmon: (ina2xx) Mark regmap_config as const

Recent versions of checkpatch complain that struct regmap_config
should be declared as const.

WARNING: struct regmap_config should normally be const

Doing so reveals a potential problem in the driver: If both supported
chips are present in a single system, the maximum number of registers
may race when devices are instantiated since max_registers is updated
in the probe function. Solve the problem by setting .max_registers to the
maximum register address of all supported chips. This does not make a
practical difference while fixing the potential race condition and reducing
code complexity.

Reviewed-by: Tzung-Bi Shih <tzungbi@kernel.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
drivers/hwmon/ina2xx.c