Skip to contentSkip to conversation

Crypto : qat: Replace scnprintf with sysfs_emit function

PATCH Superseded Atharv Dubey 2 participants 3 messages Mar 20 – Mar 21

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Crypto : qat: Replace scnprintf with sysfs_emit function

Replace 3 sysfs functions in the Intel Qat Driver
to use sysfs_emit() instead of scnprintf.

- erros_correctable_show(): Replace scnprint() with sysfs_emit()
- errors_nonfatal_show(): Replace scnprint() with sysfs_emit()
- errors_fatal_show(): Replace scnprint() with sysfs_emit()

This change is in accordance with Documentation/filesystems/sysfs.rst, which recommends using sysfs_emit/sysfs_emit_at in all sysfs show() callbacks for buffer safety, clarity, and consistency.

---
 drivers/crypto/intel/qat/qat_common/adf_sysfs_ras_counters.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/crypto/intel/qat/qat_common/adf_sysfs_ras_counters.c +3 -3
index e97c67c87b3c..2ca757e13c72 100644
@@ -20,7 +20,7 @@ static ssize_t errors_correctable_show(struct device *dev,
 		return -EINVAL;
 
 	counter = ADF_RAS_ERR_CTR_READ(accel_dev->ras_errors, ADF_RAS_CORR);
-	return scnprintf(buf, PAGE_SIZE, "%ld\n", counter);
+	return sysfs_emit(buf, "%ld\n", counter);
 }
 
 static ssize_t errors_nonfatal_show(struct device *dev,
@@ -35,7 +35,7 @@ static ssize_t errors_nonfatal_show(struct device *dev,
 		return -EINVAL;
 
 	counter = ADF_RAS_ERR_CTR_READ(accel_dev->ras_errors, ADF_RAS_UNCORR);
-	return scnprintf(buf, PAGE_SIZE, "%ld\n", counter);
+	return sysfs_emit(buf, "%ld\n", counter);
 }
 
 static ssize_t errors_fatal_show(struct device *dev,
@@ -50,7 +50,7 @@ static ssize_t errors_fatal_show(struct device *dev,
 		return -EINVAL;
 
 	counter = ADF_RAS_ERR_CTR_READ(accel_dev->ras_errors, ADF_RAS_FATAL);
-	return scnprintf(buf, PAGE_SIZE, "%ld\n", counter);
+	return sysfs_emit(buf,  "%ld\n", counter);
 }
 
 static ssize_t reset_error_counters_store(struct device *dev,

---
base-commit: 8a30aeb0d1b4e4aaf7f7bae72f20f2ae75385ccb
change-id: 20260320-sysfs-7e19eeb06586

Best regards,

Signature · 1 line
Atharv Dubey <[email protected]>
maintainer
#1 lore raw

Thanks.

Can you re-submit with the headline below?

crypto: qat - replace scnprintf() with sysfs_emit()

Quoted 2 lines · Atharv Dubey

Replace 3 sysfs functions in the Intel Qat Driver
to use sysfs_emit() instead of scnprintf.

nit. scnprintf().

Quoted 5 lines

- erros_correctable_show(): Replace scnprint() with sysfs_emit()
- errors_nonfatal_show(): Replace scnprint() with sysfs_emit()
- errors_fatal_show(): Replace scnprint() with sysfs_emit()

Quoted 8 lines

This change is in accordance with Documentation/filesystems/sysfs.rst, which recommends using sysfs_emit/sysfs_emit_at in all sysfs show() callbacks for buffer safety, clarity, and consistency.

---
 drivers/crypto/intel/qat/qat_common/adf_sysfs_ras_counters.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Apart from the commit message, it looks fine.

Thanks,

Signature · 1 line
Giovanni
#2 lore raw

Sure, I will send a v2 of the patch.

Regards,
Atharv

Quoted 26 lines · Giovanni Cabiddu

Thanks.

Can you re-submit with the headline below?

crypto: qat - replace scnprintf() with sysfs_emit()

Quoted 2 lines · Atharv Dubey

Replace 3 sysfs functions in the Intel Qat Driver
to use sysfs_emit() instead of scnprintf.

nit. scnprintf().

Quoted 4 lines

- erros_correctable_show(): Replace scnprint() with sysfs_emit()
- errors_nonfatal_show(): Replace scnprint() with sysfs_emit()
- errors_fatal_show(): Replace scnprint() with sysfs_emit()

Quoted 8 lines

This change is in accordance with Documentation/filesystems/sysfs.rst, which recommends using sysfs_emit/sysfs_emit_at in all sysfs show() callbacks for buffer safety, clarity, and consistency.

---
  drivers/crypto/intel/qat/qat_common/adf_sysfs_ras_counters.c | 6 +++---
  1 file changed, 3 insertions(+), 3 deletions(-)

Apart from the commit message, it looks fine.

Thanks,