Skip to contentSkip to conversation

iio: humidity: hts221: Fix checkpatch symbolic perms warning

PATCH In review Adi Nata 2 participants 3 messages Aug 2 – Aug 6

Subsystems (2)
lore
Share & tools
lore

Adi Nata

author
#0 lore raw

PATCH 1/1 iio: humidity: hts221: Fix checkpatch symbolic perms warning

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,

---
 drivers/iio/humidity/hts221_core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/iio/humidity/hts221_core.c +2 -2
index bfeb0a60d3af..bad98da100bd 100644
@@ -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);
 
Signature · 1 line
2.47.3
maintainer
#1 lore raw
Quoted 9 lines · On Sun, 2 Aug 2026 09:49:45 +0800 Adi Nata…

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,

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

Quoted 20 lines
---
 drivers/iio/humidity/hts221_core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/iio/humidity/hts221_core.c +2 -2
index bfeb0a60d3af..bad98da100bd 100644
@@ -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);
 
author
#2 lore raw
Quoted 10 lines · Jonathan Cameron

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.

Quoted 7 lines

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