Re: [PATCH] iio: humidity: hts221: Fix checkpatch symbolic perms warning

Jonathan Cameron <[email protected]> Sun, 2 Aug 2026 18:14:49 +0100
Newsgroups dev.linux.lists.linux-kernel-mentees,org.kernel.vger.linux-iio,org.kernel.vger.linux-kernel
Message-ID <20260802181449.12b7e117@jic23-huawei>
On Sun,  2 Aug 2026 09:49:45 +0800
Adi Nata <[email protected]> wrote:

> Checkpatch warning:
> 
> WARNING:SYMBOLIC_PERMS: Symbolic permissions 'S_IRUGO' are not preferred. Consider using octal permissions '0444'.
> +static IIO_DEVICE_ATTR(in_humidity_oversampling_ratio_available, S_IRUGO,
> 
> WARNING:SYMBOLIC_PERMS: Symbolic permissions 'S_IRUGO' are not preferred. Consider using octal permissions '0444'.
> +static IIO_DEVICE_ATTR(in_temp_oversampling_ratio_available, S_IRUGO,
> 
> Signed-off-by: Adi Nata <[email protected]>

Hi Adi,

Rather than doing this minor change please take on making these
report via the read_avail() callback.

This is a reasonably old driver, so some of that infrastructure may
not have existed back then.  Moving to the callback makes the
available info accessible to in kernel consumers and ensures correct
formatting etc.

To make that sort of change you'll need to work out how to test it.
Probably just commenting out accesses to the device and reading only
the files you are affecting will be enough here.

Thanks,

Jonathan

> ---
>  drivers/iio/humidity/hts221_core.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/iio/humidity/hts221_core.c b/drivers/iio/humidity/hts221_core.c
> index bfeb0a60d3af..bad98da100bd 100644
> --- a/drivers/iio/humidity/hts221_core.c
> +++ b/drivers/iio/humidity/hts221_core.c
> @@ -521,9 +521,9 @@ static int hts221_validate_trigger(struct iio_dev *iio_dev,
>  	return hw->trig == trig ? 0 : -EINVAL;
>  }
>  
> -static IIO_DEVICE_ATTR(in_humidity_oversampling_ratio_available, S_IRUGO,
> +static IIO_DEVICE_ATTR(in_humidity_oversampling_ratio_available, 0444,
>  		       hts221_sysfs_rh_oversampling_avail, NULL, 0);
> -static IIO_DEVICE_ATTR(in_temp_oversampling_ratio_available, S_IRUGO,
> +static IIO_DEVICE_ATTR(in_temp_oversampling_ratio_available, 0444,
>  		       hts221_sysfs_temp_oversampling_avail, NULL, 0);
>  static IIO_DEV_ATTR_SAMP_FREQ_AVAIL(hts221_sysfs_sampling_freq);
>