Re: A question about masks in sysfs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 08/14/2016 04:56 PM, Joshua Scott wrote:
Hi,

I am wanting to add write support to the alarms mask sysfs entry for the
adt7470 driver.

Before going forward with this, I had a question about consistency in
this area.

In the other drivers I see that expose masks, it looks like they do this
as decimal numbers (adm1026.c, w83627hf.c, w83781d.c).

The adt7470 driver already exposes the alarm mask, but instead of
decimal it uses hex.

What would be the correct way of adding write support to this? Should it
be converted to decimal to be consistent with other drivers, or should
it remain in hex to prevent breaking any userspace code that may be
relying on the current behaviour?


For all of those, the attribute is non-standard (not part of the ABI), which
is bad to start with. But either case, using hex without 0x annotation
is _really_ bad, so you really picked the worst of the drivers to change.
I'd suggest to leave the show part alone for backward compliance (shudder),
and to use kstrtoul() with a base of 0 for write. This will accept an integer
unless 0x is provided, which is what it should be.

Guenter

--
To unsubscribe from this list: send the line "unsubscribe linux-hwmon" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [LM Sensors]     [Linux Sound]     [ALSA Users]     [ALSA Devel]     [Linux Audio Users]     [Linux Media]     [Kernel]     [Gimp]     [Yosemite News]     [Linux Media]

  Powered by Linux