mirror of
				git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
				synced 2025-10-31 08:44:41 +00:00 
			
		
		
		
	crypto: qat - use hweight for bit counting
Replace homegrown bit counting logic in adf_gen2_get_num_accels() and adf_gen2_get_num_aes() with the functions hweight16() and hweight32(), respectively. Signed-off-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com> Reviewed-by: Marco Chiappero <marco.chiappero@intel.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
This commit is contained in:
		
							parent
							
								
									b79c7532dc
								
							
						
					
					
						commit
						c3878a786b
					
				
					 1 changed files with 2 additions and 14 deletions
				
			
		|  | @ -54,31 +54,19 @@ EXPORT_SYMBOL_GPL(adf_gen2_disable_vf2pf_interrupts); | |||
| 
 | ||||
| u32 adf_gen2_get_num_accels(struct adf_hw_device_data *self) | ||||
| { | ||||
| 	u32 i, ctr = 0; | ||||
| 
 | ||||
| 	if (!self || !self->accel_mask) | ||||
| 		return 0; | ||||
| 
 | ||||
| 	for (i = 0; i < self->num_accel; i++) | ||||
| 		if (self->accel_mask & (1 << i)) | ||||
| 			ctr++; | ||||
| 
 | ||||
| 	return ctr; | ||||
| 	return hweight16(self->accel_mask); | ||||
| } | ||||
| EXPORT_SYMBOL_GPL(adf_gen2_get_num_accels); | ||||
| 
 | ||||
| u32 adf_gen2_get_num_aes(struct adf_hw_device_data *self) | ||||
| { | ||||
| 	u32 i, ctr = 0; | ||||
| 
 | ||||
| 	if (!self || !self->ae_mask) | ||||
| 		return 0; | ||||
| 
 | ||||
| 	for (i = 0; i < self->num_engines; i++) | ||||
| 		if (self->ae_mask & (1 << i)) | ||||
| 			ctr++; | ||||
| 
 | ||||
| 	return ctr; | ||||
| 	return hweight32(self->ae_mask); | ||||
| } | ||||
| EXPORT_SYMBOL_GPL(adf_gen2_get_num_aes); | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
	Add table
		
		Reference in a new issue
	
	 Giovanni Cabiddu
						Giovanni Cabiddu