public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Crypto : qat: Replace scnprintf with sysfs_emit function
@ 2026-03-20 18:19 Atharv Dubey
  2026-03-20 21:10 ` Giovanni Cabiddu
  0 siblings, 1 reply; 3+ messages in thread
From: Atharv Dubey @ 2026-03-20 18:19 UTC (permalink / raw)
  To: Giovanni Cabiddu, Herbert Xu, David S. Miller
  Cc: qat-linux, linux-crypto, linux-kernel, Atharv Dubey

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.

Signed-off-by: Atharv Dubey <atharvd440@gmail.com>
---
 drivers/crypto/intel/qat/qat_common/adf_sysfs_ras_counters.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/crypto/intel/qat/qat_common/adf_sysfs_ras_counters.c b/drivers/crypto/intel/qat/qat_common/adf_sysfs_ras_counters.c
index e97c67c87b3c..2ca757e13c72 100644
--- a/drivers/crypto/intel/qat/qat_common/adf_sysfs_ras_counters.c
+++ b/drivers/crypto/intel/qat/qat_common/adf_sysfs_ras_counters.c
@@ -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,
-- 
Atharv Dubey <atharvd440@gmail.com>


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] Crypto : qat: Replace scnprintf with sysfs_emit function
  2026-03-20 18:19 [PATCH] Crypto : qat: Replace scnprintf with sysfs_emit function Atharv Dubey
@ 2026-03-20 21:10 ` Giovanni Cabiddu
  2026-03-21  4:44   ` Atharv Dubey
  0 siblings, 1 reply; 3+ messages in thread
From: Giovanni Cabiddu @ 2026-03-20 21:10 UTC (permalink / raw)
  To: Atharv Dubey
  Cc: Herbert Xu, David S. Miller, qat-linux, linux-crypto,
	linux-kernel

Thanks.

Can you re-submit with the headline below?

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

On Fri, Mar 20, 2026 at 11:49:28PM +0530, Atharv Dubey wrote:
> Replace 3 sysfs functions in the Intel Qat Driver
> to use sysfs_emit() instead of scnprintf.
nit. 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.
> 
> Signed-off-by: Atharv Dubey <atharvd440@gmail.com>
> ---
>  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,

-- 
Giovanni

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Crypto : qat: Replace scnprintf with sysfs_emit function
  2026-03-20 21:10 ` Giovanni Cabiddu
@ 2026-03-21  4:44   ` Atharv Dubey
  0 siblings, 0 replies; 3+ messages in thread
From: Atharv Dubey @ 2026-03-21  4:44 UTC (permalink / raw)
  To: Giovanni Cabiddu
  Cc: Herbert Xu, David S. Miller, qat-linux, linux-crypto,
	linux-kernel

Sure, I will send a v2 of the patch.

Regards,
Atharv

On 3/21/26 02:40, Giovanni Cabiddu wrote:
> Thanks.
>
> Can you re-submit with the headline below?
>
>      crypto: qat - replace scnprintf() with sysfs_emit()
>
> On Fri, Mar 20, 2026 at 11:49:28PM +0530, Atharv Dubey wrote:
>> Replace 3 sysfs functions in the Intel Qat Driver
>> to use sysfs_emit() instead of scnprintf.
> nit. 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.
>>
>> Signed-off-by: Atharv Dubey <atharvd440@gmail.com>
>> ---
>>   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,
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-03-21  4:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-20 18:19 [PATCH] Crypto : qat: Replace scnprintf with sysfs_emit function Atharv Dubey
2026-03-20 21:10 ` Giovanni Cabiddu
2026-03-21  4:44   ` Atharv Dubey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox