diff options
author | Andy Shevchenko <andriy.shevchenko@linux.intel.com> | 2022-09-22 17:32:39 +0300 |
---|---|---|
committer | Mika Westerberg <mika.westerberg@linux.intel.com> | 2022-09-24 09:22:01 +0300 |
commit | 8283fb57e46246ae998c6961c89a76ef7f14c6d9 (patch) | |
tree | 450b19420b87ed118c6bfee8c5474059286a96bf /drivers/thunderbolt/retimer.c | |
parent | 387a42cfcf92eac21b2dec2cdadd207ddae0ec78 (diff) | |
download | linux-stable-8283fb57e46246ae998c6961c89a76ef7f14c6d9.tar.gz linux-stable-8283fb57e46246ae998c6961c89a76ef7f14c6d9.tar.bz2 linux-stable-8283fb57e46246ae998c6961c89a76ef7f14c6d9.zip |
thunderbolt: Convert to use sysfs_emit()/sysfs_emit_at() APIs
Follow the advice of the Documentation/filesystems/sysfs.rst and show()
should only use sysfs_emit() or sysfs_emit_at() when formatting the value
to be returned to user space.
While at it, use Elvis operator in some cases.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Diffstat (limited to 'drivers/thunderbolt/retimer.c')
-rw-r--r-- | drivers/thunderbolt/retimer.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/thunderbolt/retimer.c b/drivers/thunderbolt/retimer.c index dd8f033b1690..81252e31014a 100644 --- a/drivers/thunderbolt/retimer.c +++ b/drivers/thunderbolt/retimer.c @@ -162,7 +162,7 @@ static ssize_t device_show(struct device *dev, struct device_attribute *attr, { struct tb_retimer *rt = tb_to_retimer(dev); - return sprintf(buf, "%#x\n", rt->device); + return sysfs_emit(buf, "%#x\n", rt->device); } static DEVICE_ATTR_RO(device); @@ -180,7 +180,7 @@ static ssize_t nvm_authenticate_show(struct device *dev, else if (rt->no_nvm_upgrade) ret = -EOPNOTSUPP; else - ret = sprintf(buf, "%#x\n", rt->auth_status); + ret = sysfs_emit(buf, "%#x\n", rt->auth_status); mutex_unlock(&rt->tb->lock); @@ -255,7 +255,7 @@ static ssize_t nvm_version_show(struct device *dev, if (!rt->nvm) ret = -EAGAIN; else - ret = sprintf(buf, "%x.%x\n", rt->nvm->major, rt->nvm->minor); + ret = sysfs_emit(buf, "%x.%x\n", rt->nvm->major, rt->nvm->minor); mutex_unlock(&rt->tb->lock); return ret; @@ -267,7 +267,7 @@ static ssize_t vendor_show(struct device *dev, struct device_attribute *attr, { struct tb_retimer *rt = tb_to_retimer(dev); - return sprintf(buf, "%#x\n", rt->vendor); + return sysfs_emit(buf, "%#x\n", rt->vendor); } static DEVICE_ATTR_RO(vendor); |