diff options
author | Joe Perches <joe@perches.com> | 2020-10-07 19:36:27 -0700 |
---|---|---|
committer | Jason Gunthorpe <jgg@nvidia.com> | 2020-10-30 21:03:52 -0300 |
commit | e28bf1f03b01b135dc0052b3a195c2860e10f216 (patch) | |
tree | 0977977699135d1f0c56381e1233f248eb367f7f /drivers/infiniband/ulp/rtrs/rtrs-srv-sysfs.c | |
parent | 45808361d4491217de11cdf0661d657081f8f422 (diff) |
RDMA: Convert various random sprintf sysfs _show uses to sysfs_emit
Manual changes for sysfs_emit as cocci scripts can't easily convert them.
Link: https://lore.kernel.org/r/ecde7791467cddb570c6f6d2c908ffbab9145cac.1602122880.git.joe@perches.com
Signed-off-by: Joe Perches <joe@perches.com>
Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>
Acked-by: Jack Wang <jinpu.wang@cloud.ionos.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
Diffstat (limited to 'drivers/infiniband/ulp/rtrs/rtrs-srv-sysfs.c')
-rw-r--r-- | drivers/infiniband/ulp/rtrs/rtrs-srv-sysfs.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/drivers/infiniband/ulp/rtrs/rtrs-srv-sysfs.c b/drivers/infiniband/ulp/rtrs/rtrs-srv-sysfs.c index b7c1b37ed9a8..d2edff3b8f0d 100644 --- a/drivers/infiniband/ulp/rtrs/rtrs-srv-sysfs.c +++ b/drivers/infiniband/ulp/rtrs/rtrs-srv-sysfs.c @@ -111,12 +111,13 @@ static ssize_t rtrs_srv_dst_addr_show(struct kobject *kobj, char *page) { struct rtrs_srv_sess *sess; - int cnt; + int len; sess = container_of(kobj, struct rtrs_srv_sess, kobj); - cnt = sockaddr_to_str((struct sockaddr *)&sess->s.src_addr, - page, PAGE_SIZE); - return cnt + scnprintf(page + cnt, PAGE_SIZE - cnt, "\n"); + len = sockaddr_to_str((struct sockaddr *)&sess->s.src_addr, page, + PAGE_SIZE); + len += sysfs_emit_at(page, len, "\n"); + return len; } static struct kobj_attribute rtrs_srv_dst_addr_attr = |