Skip to contentSkip to conversation

comedi: sysfs: convert sysfs snprintf to sysfs_emit

PATCH Superseded Xuezhi Zhang 3 participants 4 messages Aug 31, 2022 – Sep 1, 2022 Comedi drivers

v2 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 comedi: sysfs: convert sysfs snprintf to sysfs_emit

From: zhangxuezhi1 <[email protected]>

Fix up all sysfs show entries to use sysfs_emit

---
v2: use a proper name for the Signed-off-by line.

---
 drivers/comedi/comedi_fops.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/comedi/comedi_fops.c +4 -4
index 55a0cae04b8d..e2114bcf815a 100644
@@ -396,7 +396,7 @@ static ssize_t max_read_buffer_kb_show(struct device *csdev,
 	mutex_unlock(&dev->mutex);
 
 	comedi_dev_put(dev);
-	return snprintf(buf, PAGE_SIZE, "%u\n", size);
+	return sysfs_emit(buf, "%u\n", size);
 }
 
 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,
 	mutex_unlock(&dev->mutex);
 
 	comedi_dev_put(dev);
-	return snprintf(buf, PAGE_SIZE, "%u\n", size);
+	return sysfs_emit(buf, "%u\n", size);
 }
 
 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,
 	mutex_unlock(&dev->mutex);
 
 	comedi_dev_put(dev);
-	return snprintf(buf, PAGE_SIZE, "%u\n", size);
+	return sysfs_emit(buf, "%u\n", size);
 }
 
 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,
 	mutex_unlock(&dev->mutex);
 
 	comedi_dev_put(dev);
-	return snprintf(buf, PAGE_SIZE, "%u\n", size);
+	return sysfs_emit(buf, "%u\n", size);
 }
 
 static ssize_t write_buffer_kb_store(struct device *csdev,
Signature · 1 line
2.25.1
maintainer Reviewed-by on v2 1/1
#1 lore raw
Quoted 43 lines · Xuezhi Zhang

From: zhangxuezhi1 <[email protected]>

Fix up all sysfs show entries to use sysfs_emit

---
v2: use a proper name for the Signed-off-by line.

---
  drivers/comedi/comedi_fops.c | 8 ++++----
  1 file changed, 4 insertions(+), 4 deletions(-)
drivers/comedi/comedi_fops.c +3 -3
index 55a0cae04b8d..e2114bcf815a 100644
@@ -396,7 +396,7 @@ static ssize_t max_read_buffer_kb_show(struct device *csdev,
  	mutex_unlock(&dev->mutex);
 
  	comedi_dev_put(dev);
-	return snprintf(buf, PAGE_SIZE, "%u\n", size);
+	return sysfs_emit(buf, "%u\n", size);
  }
 
  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,
  	mutex_unlock(&dev->mutex);
 
  	comedi_dev_put(dev);
-	return snprintf(buf, PAGE_SIZE, "%u\n", size);
+	return sysfs_emit(buf, "%u\n", size);
  }
 
  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,
  	mutex_unlock(&dev->mutex);
 
  	comedi_dev_put(dev);
-	return snprintf(buf, PAGE_SIZE, "%u\n", size);
+	return sysfs_emit(buf, "%u\n", size);
  }
 
  static ssize_t max_write_buffer_kb_store(struct device *csdev,

drivers/comedi/comedi_fops.c static ssize_t write_buffer_kb_show(struct device *csdev, · line 571

Quoted 8 lines
drivers/comedi/comedi_fops.c +1 -1
@@ -565,7 +565,7 @@ static ssize_t write_buffer_kb_show(struct device *csdev,
  	mutex_unlock(&dev->mutex);
 
  	comedi_dev_put(dev);
-	return snprintf(buf, PAGE_SIZE, "%u\n", size);
+	return sysfs_emit(buf, "%u\n", size);
  }
 
  static ssize_t write_buffer_kb_store(struct device *csdev,

Looks good, thanks!

Signature · 4 lines
-=( Ian Abbott <[email protected]> || MEV Ltd. is a company  )=-
-=( registered in England & Wales.  Regd. number: 02862268.  )=-
-=( Regd. addr.: S11 & 12 Building 67, Europa Business Park, )=-
-=( Bird Hall Lane, STOCKPORT, SK3 0XA, UK. || www.mev.co.uk )=-
#3 lore raw
Quoted 15 lines · On Wed, 31 Aug 2022 16:02:11 +0200 Greg KH <[email protected]> wrote:
Quoted 3 lines · Xuezhi Zhang

From: zhangxuezhi1 <[email protected]>

Fix up all sysfs show entries to use sysfs_emit

This says "what", but not "why".

Please read the kernel documentation for how to write a good changelog text.

Quoted 4 lines

---
v2: use a proper name for the Signed-off-by line.

Quoted 6 lines

Does not match the From: line :(

thanks,

greg k-h

OK, I see.

Thanks.