Re: [PATCH] hwmon: constify struct hwmon_chip_info info member harder

From: Guenter Roeck
Date: Thu Mar 09 2023 - 06:12:22 EST


On Thu, Mar 09, 2023 at 10:28:41AM +0200, Jani Nikula wrote:
> Let the struct hwmon_chip_info info member be a pointer to a const array
> of const pointers, rather than mutable array of const pointers.
>
> Cc: Jean Delvare <jdelvare@xxxxxxxx>
> Cc: Guenter Roeck <linux@xxxxxxxxxxxx>
> Cc: linux-hwmon@xxxxxxxxxxxxxxx
> Signed-off-by: Jani Nikula <jani.nikula@xxxxxxxxx>
> ---
> include/linux/hwmon.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> 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;

As pointed out by 0-day, you's also have to change each
instance where this is is assigned to another variable.

Guenter

> };
>
> /* hwmon_device_register() is deprecated */
> --
> 2.39.1
>