svn commit: r365974 - head/sys/contrib/vchiq/interface/vchiq_arm

D Scott Phillips scottph at FreeBSD.org
Mon Sep 21 22:18:10 UTC 2020


Author: scottph
Date: Mon Sep 21 22:18:09 2020
New Revision: 365974
URL: https://svnweb.freebsd.org/changeset/base/365974

Log:
  vchi: rename bitset macros to avoid collision with bitset(9)
  
  An upcoming change to include bitset(9) macros from vm_page.h
  causes a macro name collision with vchi's custom bitset macros.
  
  This change was performed mechanically by:
  
    sed -i .orig s/BITSET/VCHI_BITSET/g $(grep -rl BITSET sys/contrib/vchiq)
  
  Reviewed by:	andrew
  Approved by:	scottl (implicit)
  MFC after:	1 week
  Sponsored by:	Ampere Computing, Inc.
  Differential Revision:	https://reviews.freebsd.org/D26177

Modified:
  head/sys/contrib/vchiq/interface/vchiq_arm/vchiq_core.c
  head/sys/contrib/vchiq/interface/vchiq_arm/vchiq_core.h

Modified: head/sys/contrib/vchiq/interface/vchiq_arm/vchiq_core.c
==============================================================================
--- head/sys/contrib/vchiq/interface/vchiq_arm/vchiq_core.c	Mon Sep 21 20:02:26 2020	(r365973)
+++ head/sys/contrib/vchiq/interface/vchiq_arm/vchiq_core.c	Mon Sep 21 22:18:09 2020	(r365974)
@@ -619,7 +619,7 @@ static void
 process_free_queue(VCHIQ_STATE_T *state)
 {
 	VCHIQ_SHARED_STATE_T *local = state->local;
-	BITSET_T service_found[BITSET_SIZE(VCHIQ_MAX_SERVICES)];
+	VCHI_BITSET_T service_found[VCHI_BITSET_SIZE(VCHIQ_MAX_SERVICES)];
 	int slot_queue_available;
 
 	/* Find slots which have been freed by the other side, and return them
@@ -646,7 +646,7 @@ process_free_queue(VCHIQ_STATE_T *state)
 
 		/* Initialise the bitmask for services which have used this
 		** slot */
-		BITSET_ZERO(service_found);
+		VCHI_BITSET_ZERO(service_found);
 
 		pos = 0;
 
@@ -686,9 +686,9 @@ process_free_queue(VCHIQ_STATE_T *state)
 						header->size);
 					WARN(1, "invalid message use count\n");
 				}
-				if (!BITSET_IS_SET(service_found, port)) {
+				if (!VCHI_BITSET_IS_SET(service_found, port)) {
 					/* Set the found bit for this service */
-					BITSET_SET(service_found, port);
+					VCHI_BITSET_SET(service_found, port);
 
 					spin_lock(&quota_spinlock);
 					count = service_quota->slot_use_count;
@@ -1276,7 +1276,7 @@ poll_services(VCHIQ_STATE_T *state)
 {
 	int group, i;
 
-	for (group = 0; group < BITSET_SIZE(state->unused_service); group++) {
+	for (group = 0; group < VCHI_BITSET_SIZE(state->unused_service); group++) {
 		uint32_t flags;
 		flags = atomic_xchg(&state->poll_services[group], 0);
 		for (i = 0; flags; i++) {

Modified: head/sys/contrib/vchiq/interface/vchiq_arm/vchiq_core.h
==============================================================================
--- head/sys/contrib/vchiq/interface/vchiq_arm/vchiq_core.h	Mon Sep 21 20:02:26 2020	(r365973)
+++ head/sys/contrib/vchiq/interface/vchiq_arm/vchiq_core.h	Mon Sep 21 22:18:09 2020	(r365974)
@@ -141,17 +141,17 @@ vchiq_static_assert((unsigned int)VCHIQ_PORT_MAX <
 
 #define VCHIQ_BULK_ACTUAL_ABORTED -1
 
-typedef uint32_t BITSET_T;
+typedef uint32_t VCHI_BITSET_T;
 
-vchiq_static_assert((sizeof(BITSET_T) * 8) == 32);
+vchiq_static_assert((sizeof(VCHI_BITSET_T) * 8) == 32);
 
-#define BITSET_SIZE(b)        ((b + 31) >> 5)
-#define BITSET_WORD(b)        (b >> 5)
-#define BITSET_BIT(b)         (1 << (b & 31))
-#define BITSET_ZERO(bs)       memset(bs, 0, sizeof(bs))
-#define BITSET_IS_SET(bs, b)  (bs[BITSET_WORD(b)] & BITSET_BIT(b))
-#define BITSET_SET(bs, b)     (bs[BITSET_WORD(b)] |= BITSET_BIT(b))
-#define BITSET_CLR(bs, b)     (bs[BITSET_WORD(b)] &= ~BITSET_BIT(b))
+#define VCHI_BITSET_SIZE(b)        ((b + 31) >> 5)
+#define VCHI_BITSET_WORD(b)        (b >> 5)
+#define VCHI_BITSET_BIT(b)         (1 << (b & 31))
+#define VCHI_BITSET_ZERO(bs)       memset(bs, 0, sizeof(bs))
+#define VCHI_BITSET_IS_SET(bs, b)  (bs[VCHI_BITSET_WORD(b)] & VCHI_BITSET_BIT(b))
+#define VCHI_BITSET_SET(bs, b)     (bs[VCHI_BITSET_WORD(b)] |= VCHI_BITSET_BIT(b))
+#define VCHI_BITSET_CLR(bs, b)     (bs[VCHI_BITSET_WORD(b)] &= ~VCHI_BITSET_BIT(b))
 
 #if VCHIQ_ENABLE_STATS
 #define VCHIQ_STATS_INC(state, stat) (state->stats. stat++)
@@ -478,7 +478,7 @@ struct vchiq_state_struct {
 	unsigned short data_quota;
 
 	/* An array of bit sets indicating which services must be polled. */
-	atomic_t poll_services[BITSET_SIZE(VCHIQ_MAX_SERVICES)];
+	atomic_t poll_services[VCHI_BITSET_SIZE(VCHIQ_MAX_SERVICES)];
 
 	/* The number of the first unused service */
 	int unused_service;


More information about the svn-src-all mailing list