Commit 174c1dfb authored by Dan Bogdan Nechita's avatar Dan Bogdan Nechita Committed by Jiri Slaby

misc: ad525x_dpot: Fix the enabling of the "otpXen" attributes

commit 1bb850a1 upstream.

Currently writing the attributes with "echo" will result in comparing:
"enabled\n" with "enabled\0" and attribute is always set to false.

Use the sysfs_streq() instead because it treats both NUL and
new-line-then-NUL as equivalent string terminations.
Signed-off-by: default avatarDan Bogdan Nechita <dan.bogdan.nechita@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Oliver Neukum <oliver@neukum.org>
Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
parent 77b3964c
...@@ -458,7 +458,7 @@ static ssize_t sysfs_set_reg(struct device *dev, ...@@ -458,7 +458,7 @@ static ssize_t sysfs_set_reg(struct device *dev,
int err; int err;
if (reg & DPOT_ADDR_OTP_EN) { if (reg & DPOT_ADDR_OTP_EN) {
if (!strncmp(buf, "enabled", sizeof("enabled"))) if (sysfs_streq(buf, "enabled"))
set_bit(DPOT_RDAC_MASK & reg, data->otp_en_mask); set_bit(DPOT_RDAC_MASK & reg, data->otp_en_mask);
else else
clear_bit(DPOT_RDAC_MASK & reg, data->otp_en_mask); clear_bit(DPOT_RDAC_MASK & reg, data->otp_en_mask);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment