On 1/21/19 1:38 AM, Sudeep Holla wrote:
On Fri, Jan 18, 2019 at 10:58:44AM -0800, Guenter Roeck wrote:
On Fri, Jan 18, 2019 at 06:21:57PM +0000, Sudeep Holla wrote:
On Fri, Jan 18, 2019 at 09:14:59AM -0800, Guenter Roeck wrote:
Use SENSOR[_DEVICE]_ATTR[_2]_{RO,RW,WO} to simplify the source code,
to improve readbility, and to reduce the chance of inconsistencies.


s/readbility/readability/

Nice catch ...

Also replace any remaining S_<PERMS> in the driver with octal values.

The conversion was done automatically with coccinelle. The semantic patches
and the scripts used to generate this commit log are available at
https://github.com/groeck/coccinelle-patches/hwmon/.

This patch does not introduce functional changes. It was verified by
compiling the old and new files and comparing text and data sizes.

Cc: Liviu Dudau <[email protected]>
Cc: Sudeep Holla <[email protected]>

Not related to this patch, just thought of asking. If the intention is
to avoid using S_<PERMS> macros and have direct values for readability,
shouldn't you consider the ones as return values mainly in is_visible
callbacks ?


Not sure I understand. Can you clarify ?


Sorry for not being clear, I was referring to these:
$ git grep "return S_.*" drivers/hwmon/ | sort | uniq

drivers/hwmon/lm75.c:                   return S_IRUGO;
drivers/hwmon/lm75.c:                   return S_IRUGO | S_IWUSR;
drivers/hwmon/lm90.c:           return S_IRUGO;
drivers/hwmon/lm90.c:                   return S_IRUGO | S_IWUSR;
drivers/hwmon/lm90.c:           return S_IRUGO | S_IWUSR;
drivers/hwmon/lm95241.c:                        return S_IRUGO;
drivers/hwmon/lm95241.c:                        return S_IRUGO | S_IWUSR;
drivers/hwmon/lm95245.c:                return S_IRUGO;
drivers/hwmon/lm95245.c:                        return S_IRUGO | S_IWUSR;
drivers/hwmon/lm95245.c:                return S_IRUGO | S_IWUSR;
drivers/hwmon/ltc4245.c:                        return S_IRUGO;
drivers/hwmon/max31790.c:                       return S_IRUGO;
drivers/hwmon/max31790.c:                       return S_IRUGO | S_IWUSR;
drivers/hwmon/nct7904.c:                                return S_IRUGO;
drivers/hwmon/nct7904.c:                return S_IRUGO;
drivers/hwmon/nct7904.c:                return S_IRUGO | S_IWUSR;
drivers/hwmon/scmi-hwmon.c:             return S_IRUGO;
drivers/hwmon/tmp102.c:         return S_IRUGO;
drivers/hwmon/tmp102.c:         return S_IRUGO | S_IWUSR;
drivers/hwmon/tmp421.c:         return S_IRUGO;


The series only includes auto-converted drivers, and the conversion
focused on auto-converting SENSOR_ attributes. While it tried to convert
various instances of the above, that was not the primary focus. I will
likely submit one or more follow-up series to address remaining
SENSOR_... attributes as well as any leftover S_<perms> definitions.

Guenter

Reply via email to