mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] crypto: qat - simplify adf_service_mask_to_string helper
@ 2026-05-27 17:46 Thorsten Blum
  2026-06-04 21:15 ` Giovanni Cabiddu
  2026-06-05 11:42 ` Herbert Xu
  0 siblings, 2 replies; 3+ messages in thread
From: Thorsten Blum @ 2026-05-27 17:46 UTC (permalink / raw)
  To: Giovanni Cabiddu, Herbert Xu, David S. Miller,
	Suman Kumar Chakraborty, Karthikeyan Gopal
  Cc: Thorsten Blum, qat-linux, linux-crypto, linux-kernel

Use a single scnprintf() for each set bit and drop the offset in the
else branch to simplify adf_service_mask_to_string().

Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
---
 drivers/crypto/intel/qat/qat_common/adf_cfg_services.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/crypto/intel/qat/qat_common/adf_cfg_services.c b/drivers/crypto/intel/qat/qat_common/adf_cfg_services.c
index 21b21ac78e53..baf563c6f9b7 100644
--- a/drivers/crypto/intel/qat/qat_common/adf_cfg_services.c
+++ b/drivers/crypto/intel/qat/qat_common/adf_cfg_services.c
@@ -93,10 +93,9 @@ static int adf_service_mask_to_string(unsigned long mask, char *buf, size_t len)
 	for_each_set_bit(bit, &mask, SVC_COUNT) {
 		if (offset)
 			offset += scnprintf(buf + offset, len - offset,
-					    ADF_SERVICES_DELIMITER);
-
-		offset += scnprintf(buf + offset, len - offset, "%s",
-				    adf_cfg_services[bit]);
+				ADF_SERVICES_DELIMITER "%s", adf_cfg_services[bit]);
+		else
+			offset += scnprintf(buf, len, "%s", adf_cfg_services[bit]);
 	}
 
 	return 0;

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

* Re: [PATCH] crypto: qat - simplify adf_service_mask_to_string helper
  2026-05-27 17:46 [PATCH] crypto: qat - simplify adf_service_mask_to_string helper Thorsten Blum
@ 2026-06-04 21:15 ` Giovanni Cabiddu
  2026-06-05 11:42 ` Herbert Xu
  1 sibling, 0 replies; 3+ messages in thread
From: Giovanni Cabiddu @ 2026-06-04 21:15 UTC (permalink / raw)
  To: Thorsten Blum
  Cc: Herbert Xu, David S. Miller, Suman Kumar Chakraborty,
	Karthikeyan Gopal, qat-linux, linux-crypto, linux-kernel

On Wed, May 27, 2026 at 07:46:55PM +0200, Thorsten Blum wrote:
> Use a single scnprintf() for each set bit and drop the offset in the
> else branch to simplify adf_service_mask_to_string().
> 
> Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
Acked-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com>

> ---
>  drivers/crypto/intel/qat/qat_common/adf_cfg_services.c | 7 +++----
>  1 file changed, 3 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/crypto/intel/qat/qat_common/adf_cfg_services.c b/drivers/crypto/intel/qat/qat_common/adf_cfg_services.c
> index 21b21ac78e53..baf563c6f9b7 100644
> --- a/drivers/crypto/intel/qat/qat_common/adf_cfg_services.c
> +++ b/drivers/crypto/intel/qat/qat_common/adf_cfg_services.c
> @@ -93,10 +93,9 @@ static int adf_service_mask_to_string(unsigned long mask, char *buf, size_t len)
>  	for_each_set_bit(bit, &mask, SVC_COUNT) {
>  		if (offset)
>  			offset += scnprintf(buf + offset, len - offset,
> -					    ADF_SERVICES_DELIMITER);
> -
> -		offset += scnprintf(buf + offset, len - offset, "%s",
> -				    adf_cfg_services[bit]);
> +				ADF_SERVICES_DELIMITER "%s", adf_cfg_services[bit]);
> +		else
> +			offset += scnprintf(buf, len, "%s", adf_cfg_services[bit]);
>  	}
>  
>  	return 0;

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

* Re: [PATCH] crypto: qat - simplify adf_service_mask_to_string helper
  2026-05-27 17:46 [PATCH] crypto: qat - simplify adf_service_mask_to_string helper Thorsten Blum
  2026-06-04 21:15 ` Giovanni Cabiddu
@ 2026-06-05 11:42 ` Herbert Xu
  1 sibling, 0 replies; 3+ messages in thread
From: Herbert Xu @ 2026-06-05 11:42 UTC (permalink / raw)
  To: Thorsten Blum
  Cc: Giovanni Cabiddu, David S. Miller, Suman Kumar Chakraborty,
	Karthikeyan Gopal, qat-linux, linux-crypto, linux-kernel

On Wed, May 27, 2026 at 07:46:55PM +0200, Thorsten Blum wrote:
> Use a single scnprintf() for each set bit and drop the offset in the
> else branch to simplify adf_service_mask_to_string().
> 
> Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
> ---
>  drivers/crypto/intel/qat/qat_common/adf_cfg_services.c | 7 +++----
>  1 file changed, 3 insertions(+), 4 deletions(-)

Patch applied.  Thanks.
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

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

end of thread, other threads:[~2026-06-05 11:42 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-05-27 17:46 [PATCH] crypto: qat - simplify adf_service_mask_to_string helper Thorsten Blum
2026-06-04 21:15 ` Giovanni Cabiddu
2026-06-05 11:42 ` Herbert Xu

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

all inboxes | Powered by JetHome®