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

Adi Nata posted 1 patch 2 months ago
drivers/iio/humidity/hts221_core.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
[PATCH] iio: humidity: hts221: Fix checkpatch symbolic perms warning
Posted by Adi Nata 2 months ago
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 <adinata.softwareengineer@gmail.com>
---
 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);
 
-- 
2.47.3
Re: [PATCH] iio: humidity: hts221: Fix checkpatch symbolic perms warning
Posted by Jonathan Cameron 2 months ago
On Sun,  2 Aug 2026 09:49:45 +0800
Adi Nata <adinata.softwareengineer@gmail.com> 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 <adinata.softwareengineer@gmail.com>

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);
>
Re: [PATCH] iio: humidity: hts221: Fix checkpatch symbolic perms warning
Posted by Adi 1 month, 3 weeks ago
On Mon, Aug 3, 2026 at 1:14 AM Jonathan Cameron <jic23@kernel.org> wrote:
> 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

Hi Jonathan,

Thank you for the suggestion and feedback. I will create a new patch series
with a cover letter for this hts221 driver.

Regards,
Adi Nata