Skip to content

Commit ceecbbd

Browse files
Xuezhi Zhanggregkh
authored andcommitted
comedi: convert sysfs snprintf to sysfs_emit
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. Signed-off-by: Xuezhi Zhang <zhangxuezhi1@coolpad.com> Link: https://lore.kernel.org/r/20220901013423.418464-1-zhangxuezhi3@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 8e30538 commit ceecbbd

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

drivers/comedi/comedi_fops.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,7 @@ static ssize_t max_read_buffer_kb_show(struct device *csdev,
396396
mutex_unlock(&dev->mutex);
397397

398398
comedi_dev_put(dev);
399-
return snprintf(buf, PAGE_SIZE, "%u\n", size);
399+
return sysfs_emit(buf, "%u\n", size);
400400
}
401401

402402
static ssize_t max_read_buffer_kb_store(struct device *csdev,
@@ -452,7 +452,7 @@ static ssize_t read_buffer_kb_show(struct device *csdev,
452452
mutex_unlock(&dev->mutex);
453453

454454
comedi_dev_put(dev);
455-
return snprintf(buf, PAGE_SIZE, "%u\n", size);
455+
return sysfs_emit(buf, "%u\n", size);
456456
}
457457

458458
static ssize_t read_buffer_kb_store(struct device *csdev,
@@ -509,7 +509,7 @@ static ssize_t max_write_buffer_kb_show(struct device *csdev,
509509
mutex_unlock(&dev->mutex);
510510

511511
comedi_dev_put(dev);
512-
return snprintf(buf, PAGE_SIZE, "%u\n", size);
512+
return sysfs_emit(buf, "%u\n", size);
513513
}
514514

515515
static ssize_t max_write_buffer_kb_store(struct device *csdev,
@@ -565,7 +565,7 @@ static ssize_t write_buffer_kb_show(struct device *csdev,
565565
mutex_unlock(&dev->mutex);
566566

567567
comedi_dev_put(dev);
568-
return snprintf(buf, PAGE_SIZE, "%u\n", size);
568+
return sysfs_emit(buf, "%u\n", size);
569569
}
570570

571571
static ssize_t write_buffer_kb_store(struct device *csdev,

0 commit comments

Comments
 (0)