• Nicolin Chen's avatar
    hwmon: (ina3221) Serialize sysfs ABI accesses · 87625b24
    Nicolin Chen authored
    This change adds a mutex to serialize accesses of sysfs attributes.
    
    This is required when polling CVRF bit of the MASK/ENABLE register
    because this bit is cleared on a read of this MASK/ENABLE register
    or a write to CONFIG register, which means that this bit might be
    accidentally cleared by reading other fields like alert flags.
    
    So this patch adds a mutex lock to protect the write() and read()
    callbacks. The read_string() callback won't need the lock since it
    just returns the label without touching any hardware register.
    Signed-off-by: default avatarNicolin Chen <nicoleotsuka@gmail.com>
    Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
    87625b24
ina3221.c 17.4 KB