crypto: qat - simplify adf_service_mask_to_string helper
Subsystems (2)
PATCH 1/1 crypto: qat - simplify adf_service_mask_to_string helper
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 <[email protected]>
--- drivers/crypto/intel/qat/qat_common/adf_cfg_services.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/crypto/intel/qat/qat_common/adf_cfg_services.c +3 -4
@@ -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 ;
Quoted 4 lines · Thorsten Blum
Use a single
scnprintf()for each set bit and drop the offset in the else branch to simplifyadf_service_mask_to_string().Signed-off-by Thorsten Blum <[email protected]>
Acked-by Giovanni Cabiddu <[email protected]>
Quoted 22 lines
--- drivers/crypto/intel/qat/qat_common/adf_cfg_services.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)drivers/crypto/intel/qat/qat_common/adf_cfg_services.c +3
-4@@ -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 ;
Herbert Xu
maintainerQuoted 7 lines · Thorsten Blum
Use a single
scnprintf()for each set bit and drop the offset in the else branch to simplifyadf_service_mask_to_string().Signed-off-by Thorsten Blum <[email protected]>--- drivers/crypto/intel/qat/qat_common/adf_cfg_services.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
Patch applied. Thanks.
Signature · 3 lines
Email: Herbert Xu <[email protected]> Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt