[PATCH] ACPICA: Use hweight8() and hweight16()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Replace homemade hamming weight function with hweight8() and hweight16().

Signed-off-by: Akinobu Mita <akinobu.mita@xxxxxxxxx>
Cc: Len Brown <lenb@xxxxxxxxxx>
Cc: Rafael J. Wysocki <rjw@xxxxxxx>
Cc: linux-acpi@xxxxxxxxxxxxxxx
---
 drivers/acpi/acpica/rscalc.c | 36 ++----------------------------------
 1 file changed, 2 insertions(+), 34 deletions(-)

diff --git a/drivers/acpi/acpica/rscalc.c b/drivers/acpi/acpica/rscalc.c
index de12469..bdddb7d 100644
--- a/drivers/acpi/acpica/rscalc.c
+++ b/drivers/acpi/acpica/rscalc.c
@@ -49,9 +49,6 @@
 #define _COMPONENT          ACPI_RESOURCES
 ACPI_MODULE_NAME("rscalc")
 
-/* Local prototypes */
-static u8 acpi_rs_count_set_bits(u16 bit_field);
-
 static acpi_rs_length
 acpi_rs_struct_option_length(struct acpi_resource_source *resource_source);
 
@@ -60,35 +57,6 @@ acpi_rs_stream_option_length(u32 resource_length, u32 minimum_total_length);
 
 /*******************************************************************************
  *
- * FUNCTION:    acpi_rs_count_set_bits
- *
- * PARAMETERS:  bit_field       - Field in which to count bits
- *
- * RETURN:      Number of bits set within the field
- *
- * DESCRIPTION: Count the number of bits set in a resource field. Used for
- *              (Short descriptor) interrupt and DMA lists.
- *
- ******************************************************************************/
-
-static u8 acpi_rs_count_set_bits(u16 bit_field)
-{
-	u8 bits_set;
-
-	ACPI_FUNCTION_ENTRY();
-
-	for (bits_set = 0; bit_field; bits_set++) {
-
-		/* Zero the least significant bit that is set */
-
-		bit_field &= (u16) (bit_field - 1);
-	}
-
-	return bits_set;
-}
-
-/*******************************************************************************
- *
  * FUNCTION:    acpi_rs_struct_option_length
  *
  * PARAMETERS:  resource_source     - Pointer to optional descriptor field
@@ -439,7 +407,7 @@ acpi_rs_get_list_length(u8 * aml_buffer,
 			 * Get the number of bits set in the 16-bit IRQ mask
 			 */
 			ACPI_MOVE_16_TO_16(&temp16, buffer);
-			extra_struct_bytes = acpi_rs_count_set_bits(temp16);
+			extra_struct_bytes = hweight16(temp16);
 			break;
 
 		case ACPI_RESOURCE_NAME_DMA:
@@ -447,7 +415,7 @@ acpi_rs_get_list_length(u8 * aml_buffer,
 			 * DMA Resource:
 			 * Get the number of bits set in the 8-bit DMA mask
 			 */
-			extra_struct_bytes = acpi_rs_count_set_bits(*buffer);
+			extra_struct_bytes = hweight8(*buffer);
 			break;
 
 		case ACPI_RESOURCE_NAME_VENDOR_SMALL:
-- 
1.7.11.7

--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux IBM ACPI]     [Linux Power Management]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux