Re: [PATCH v2] crypto: qat - replace scnprintf() with sysfs_emit()
From: Giovanni Cabiddu
Date: Tue Mar 24 2026 - 08:44:43 EST
On Sat, Mar 21, 2026 at 10:17:45AM +0530, Atharv Dubey wrote:
> Replace 3 sysfs functions in the Intel Qat Driver
> to use sysfs_emit() instead of scnprintf().
>
> - erros_correctable_show(): Replace scnprint() with sysfs_emit()
/s/erros/errors
/s/scnprint/scnprintf/g
> - errors_nonfatal_show(): Replace scnprint() with sysfs_emit()
> - errors_fatal_show(): Replace scnprint() with sysfs_emit()
...
> 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);
Remove spurious double space after "buf,".
Anyway, I just noticed that counter is declared as `unsigned long` and
scnprintf() is using %d.
As ADF_RAS_ERR_CTR_READ() expands to atomic_read() which returns an int,
I'm going to convert `unsigned long counter` in an interger.
I'm going to send a fix for the above and your patch on top (with fixes)
in a small series. No action required for you. :-)
Thanks,
--
Giovanni