[PATCH 03/19] staging: unisys: visorchipset: Get rid of ugly BOOL/TRUE/FALSE usage

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

 



From: Jes Sorensen <Jes.Sorensen@xxxxxxxxxx>

Signed-off-by: Jes Sorensen <Jes.Sorensen@xxxxxxxxxx>
Tested-by: Benjamin Romer <benjamin.romer@xxxxxxxxxx>
---
 drivers/staging/unisys/visorchipset/parser.c       | 24 +++---
 drivers/staging/unisys/visorchipset/parser.h       |  8 +-
 drivers/staging/unisys/visorchipset/visorchipset.h | 10 +--
 .../unisys/visorchipset/visorchipset_main.c        | 98 +++++++++++-----------
 4 files changed, 70 insertions(+), 70 deletions(-)

diff --git a/drivers/staging/unisys/visorchipset/parser.c b/drivers/staging/unisys/visorchipset/parser.c
index d8a2d6f..b30e4c1 100644
--- a/drivers/staging/unisys/visorchipset/parser.c
+++ b/drivers/staging/unisys/visorchipset/parser.c
@@ -36,13 +36,13 @@ struct parser_context {
 	ulong param_bytes;
 	u8 *curr;
 	ulong bytes_remaining;
-	BOOL byte_stream;
+	bool byte_stream;
 	char data[0];
 };
 
 static struct parser_context *
-parser_init_guts(u64 addr, u32 bytes, BOOL local,
-		 BOOL standard_payload_header, BOOL *retry)
+parser_init_guts(u64 addr, u32 bytes, bool local,
+		 bool standard_payload_header, bool *retry)
 {
 	int allocbytes = sizeof(struct parser_context) + bytes;
 	struct parser_context *rc = NULL;
@@ -51,7 +51,7 @@ parser_init_guts(u64 addr, u32 bytes, BOOL local,
 	struct spar_controlvm_parameters_header *phdr = NULL;
 
 	if (retry)
-		*retry = FALSE;
+		*retry = false;
 	if (!standard_payload_header)
 		/* alloc and 0 extra byte to ensure payload is
 		 * '\0'-terminated
@@ -60,14 +60,14 @@ parser_init_guts(u64 addr, u32 bytes, BOOL local,
 	if ((controlvm_payload_bytes_buffered + bytes)
 	    > MAX_CONTROLVM_PAYLOAD_BYTES) {
 		if (retry)
-			*retry = TRUE;
+			*retry = true;
 		rc = NULL;
 		goto cleanup;
 	}
 	ctx = kzalloc(allocbytes, GFP_KERNEL|__GFP_NORETRY);
 	if (!ctx) {
 		if (retry)
-			*retry = TRUE;
+			*retry = true;
 		rc = NULL;
 		goto cleanup;
 	}
@@ -76,7 +76,7 @@ parser_init_guts(u64 addr, u32 bytes, BOOL local,
 	ctx->param_bytes = bytes;
 	ctx->curr = NULL;
 	ctx->bytes_remaining = 0;
-	ctx->byte_stream = FALSE;
+	ctx->byte_stream = false;
 	if (local) {
 		void *p;
 
@@ -98,7 +98,7 @@ parser_init_guts(u64 addr, u32 bytes, BOOL local,
 		}
 	}
 	if (!standard_payload_header) {
-		ctx->byte_stream = TRUE;
+		ctx->byte_stream = true;
 		rc = ctx;
 		goto cleanup;
 	}
@@ -135,9 +135,9 @@ cleanup:
 }
 
 struct parser_context *
-parser_init(u64 addr, u32 bytes, BOOL local, BOOL *retry)
+parser_init(u64 addr, u32 bytes, bool local, bool *retry)
 {
-	return parser_init_guts(addr, bytes, local, TRUE, retry);
+	return parser_init_guts(addr, bytes, local, true, retry);
 }
 
 /* Call this instead of parser_init() if the payload area consists of just
@@ -146,9 +146,9 @@ parser_init(u64 addr, u32 bytes, BOOL local, BOOL *retry)
  * parser_byteStream_get() to obtain the data.
  */
 struct parser_context *
-parser_init_byte_stream(u64 addr, u32 bytes, BOOL local, BOOL *retry)
+parser_init_byte_stream(u64 addr, u32 bytes, bool local, bool *retry)
 {
-	return parser_init_guts(addr, bytes, local, FALSE, retry);
+	return parser_init_guts(addr, bytes, local, false, retry);
 }
 
 /* Obtain '\0'-terminated copy of string in payload area.
diff --git a/drivers/staging/unisys/visorchipset/parser.h b/drivers/staging/unisys/visorchipset/parser.h
index 2b903f1..d3b0b33 100644
--- a/drivers/staging/unisys/visorchipset/parser.h
+++ b/drivers/staging/unisys/visorchipset/parser.h
@@ -30,10 +30,10 @@ typedef enum {
 	PARSERSTRING_NAME,
 } PARSER_WHICH_STRING;
 
-struct parser_context *parser_init(u64 addr, u32 bytes, BOOL isLocal,
-				   BOOL *tryAgain);
-struct parser_context *parser_init_byte_stream(u64 addr, u32 bytes, BOOL local,
-				       BOOL *retry);
+struct parser_context *parser_init(u64 addr, u32 bytes, bool isLocal,
+				   bool *tryAgain);
+struct parser_context *parser_init_byte_stream(u64 addr, u32 bytes, bool local,
+				       bool *retry);
 void parser_param_start(struct parser_context *ctx,
 			PARSER_WHICH_STRING which_string);
 void *parser_param_get(struct parser_context *ctx, char *nam, int namesize);
diff --git a/drivers/staging/unisys/visorchipset/visorchipset.h b/drivers/staging/unisys/visorchipset/visorchipset.h
index bd46df9..4c1a74f 100644
--- a/drivers/staging/unisys/visorchipset/visorchipset.h
+++ b/drivers/staging/unisys/visorchipset/visorchipset.h
@@ -217,19 +217,19 @@ typedef void (*SPARREPORTEVENT_COMPLETE_FUNC) (struct controlvm_message *msg,
 void visorchipset_device_pause_response(ulong bus_no, ulong dev_no,
 					int response);
 
-BOOL visorchipset_get_bus_info(ulong bus_no,
+bool visorchipset_get_bus_info(ulong bus_no,
 			       struct visorchipset_bus_info *bus_info);
-BOOL visorchipset_get_device_info(ulong bus_no, ulong dev_no,
+bool visorchipset_get_device_info(ulong bus_no, ulong dev_no,
 				  struct visorchipset_device_info *dev_info);
-BOOL visorchipset_set_bus_context(ulong bus_no, void *context);
-BOOL visorchipset_set_device_context(ulong bus_no, ulong dev_no, void *context);
+bool visorchipset_set_bus_context(ulong bus_no, void *context);
+bool visorchipset_set_device_context(ulong bus_no, ulong dev_no, void *context);
 int visorchipset_chipset_ready(void);
 int visorchipset_chipset_selftest(void);
 int visorchipset_chipset_notready(void);
 void visorchipset_save_message(struct controlvm_message *msg,
 			       enum crash_obj_type type);
 void *visorchipset_cache_alloc(struct kmem_cache *pool,
-			       BOOL ok_to_block, char *fn, int ln);
+			       bool ok_to_block, char *fn, int ln);
 void visorchipset_cache_free(struct kmem_cache *pool, void *p,
 			     char *fn, int ln);
 
diff --git a/drivers/staging/unisys/visorchipset/visorchipset_main.c b/drivers/staging/unisys/visorchipset/visorchipset_main.c
index a1d0190..0b016e3 100644
--- a/drivers/staging/unisys/visorchipset/visorchipset_main.c
+++ b/drivers/staging/unisys/visorchipset/visorchipset_main.c
@@ -107,7 +107,7 @@ struct visor_livedump_info {
 	struct controlvm_message_header dumpcapture_header;
 	struct controlvm_message_header gettextdump_header;
 	struct controlvm_message_header dumpcomplete_header;
-	BOOL gettextdump_outstanding;
+	bool gettextdump_outstanding;
 	u32 crc32;
 	ulong length;
 	atomic_t buffers_in_use;
@@ -122,7 +122,7 @@ static struct visor_livedump_info livedump_info;
  * process it again the next time controlvm_periodic_work() runs.
  */
 static struct controlvm_message controlvm_pending_msg;
-static BOOL controlvm_pending_msg_valid = FALSE;
+static bool controlvm_pending_msg_valid = false;
 
 /* Pool of struct putfile_buffer_entry, for keeping track of pending (incoming)
  * TRANSMIT_FILE PutFile payloads.
@@ -775,7 +775,7 @@ static void
 bus_responder(enum controlvm_id cmd_id, ulong bus_no, int response)
 {
 	struct visorchipset_bus_info *p = NULL;
-	BOOL need_clear = FALSE;
+	bool need_clear = false;
 
 	p = findbus(&bus_info_list, bus_no);
 	if (!p)
@@ -790,7 +790,7 @@ bus_responder(enum controlvm_id cmd_id, ulong bus_no, int response)
 		if (cmd_id == CONTROLVM_BUS_CREATE)
 			p->state.created = 1;
 		if (cmd_id == CONTROLVM_BUS_DESTROY)
-			need_clear = TRUE;
+			need_clear = true;
 	}
 
 	if (p->pending_msg_hdr.id == CONTROLVM_INVALID)
@@ -839,7 +839,7 @@ device_responder(enum controlvm_id cmd_id, ulong bus_no, ulong dev_no,
 		 int response)
 {
 	struct visorchipset_device_info *p = NULL;
-	BOOL need_clear = FALSE;
+	bool need_clear = false;
 
 	p = finddevice(&dev_info_list, bus_no, dev_no);
 	if (!p)
@@ -848,7 +848,7 @@ device_responder(enum controlvm_id cmd_id, ulong bus_no, ulong dev_no,
 		if (cmd_id == CONTROLVM_DEVICE_CREATE)
 			p->state.created = 1;
 		if (cmd_id == CONTROLVM_DEVICE_DESTROY)
-			need_clear = TRUE;
+			need_clear = true;
 	}
 
 	if (p->pending_msg_hdr.id == CONTROLVM_INVALID)
@@ -866,9 +866,9 @@ device_responder(enum controlvm_id cmd_id, ulong bus_no, ulong dev_no,
 static void
 bus_epilog(u32 bus_no,
 	   u32 cmd, struct controlvm_message_header *msg_hdr,
-	   int response, BOOL need_response)
+	   int response, bool need_response)
 {
-	BOOL notified = FALSE;
+	bool notified = false;
 
 	struct visorchipset_bus_info *bus_info = findbus(&bus_info_list,
 							 bus_no);
@@ -899,23 +899,23 @@ bus_epilog(u32 bus_no,
 			* devices */
 			if (busdev_server_notifiers.bus_create) {
 				(*busdev_server_notifiers.bus_create) (bus_no);
-				notified = TRUE;
+				notified = true;
 			}
 			if ((!bus_info->flags.server) /*client */ &&
 			    busdev_client_notifiers.bus_create) {
 				(*busdev_client_notifiers.bus_create) (bus_no);
-				notified = TRUE;
+				notified = true;
 			}
 			break;
 		case CONTROLVM_BUS_DESTROY:
 			if (busdev_server_notifiers.bus_destroy) {
 				(*busdev_server_notifiers.bus_destroy) (bus_no);
-				notified = TRUE;
+				notified = true;
 			}
 			if ((!bus_info->flags.server) /*client */ &&
 			    busdev_client_notifiers.bus_destroy) {
 				(*busdev_client_notifiers.bus_destroy) (bus_no);
-				notified = TRUE;
+				notified = true;
 			}
 			break;
 		}
@@ -934,10 +934,10 @@ bus_epilog(u32 bus_no,
 static void
 device_epilog(u32 bus_no, u32 dev_no, struct spar_segment_state state, u32 cmd,
 	      struct controlvm_message_header *msg_hdr, int response,
-	      BOOL need_response, BOOL for_visorbus)
+	      bool need_response, bool for_visorbus)
 {
 	struct visorchipset_busdev_notifiers *notifiers = NULL;
-	BOOL notified = FALSE;
+	bool notified = false;
 
 	struct visorchipset_device_info *dev_info =
 		finddevice(&dev_info_list, bus_no, dev_no);
@@ -966,7 +966,7 @@ device_epilog(u32 bus_no, u32 dev_no, struct spar_segment_state state, u32 cmd,
 		case CONTROLVM_DEVICE_CREATE:
 			if (notifiers->device_create) {
 				(*notifiers->device_create) (bus_no, dev_no);
-				notified = TRUE;
+				notified = true;
 			}
 			break;
 		case CONTROLVM_DEVICE_CHANGESTATE:
@@ -977,7 +977,7 @@ device_epilog(u32 bus_no, u32 dev_no, struct spar_segment_state state, u32 cmd,
 				if (notifiers->device_resume) {
 					(*notifiers->device_resume) (bus_no,
 								     dev_no);
-					notified = TRUE;
+					notified = true;
 				}
 			}
 			/* ServerNotReady / ServerLost / SegmentStateStandby */
@@ -990,7 +990,7 @@ device_epilog(u32 bus_no, u32 dev_no, struct spar_segment_state state, u32 cmd,
 				if (notifiers->device_pause) {
 					(*notifiers->device_pause) (bus_no,
 								    dev_no);
-					notified = TRUE;
+					notified = true;
 				}
 			} else if (state.alive == segment_state_paused.alive &&
 				   state.operating ==
@@ -1012,7 +1012,7 @@ device_epilog(u32 bus_no, u32 dev_no, struct spar_segment_state state, u32 cmd,
 		case CONTROLVM_DEVICE_DESTROY:
 			if (notifiers->device_destroy) {
 				(*notifiers->device_destroy) (bus_no, dev_no);
-				notified = TRUE;
+				notified = true;
 			}
 			break;
 		}
@@ -1261,7 +1261,7 @@ my_device_destroy(struct controlvm_message *inmsg)
 /* When provided with the physical address of the controlvm channel
  * (phys_addr), the offset to the payload area we need to manage
  * (offset), and the size of this payload area (bytes), fills in the
- * controlvm_payload_info struct.  Returns TRUE for success or FALSE
+ * controlvm_payload_info struct.  Returns true for success or false
  * for failure.
  */
 static int
@@ -1415,17 +1415,17 @@ chipset_notready(struct controlvm_message_header *msg_hdr)
 /* This is your "one-stop" shop for grabbing the next message from the
  * CONTROLVM_QUEUE_EVENT queue in the controlvm channel.
  */
-static BOOL
+static bool
 read_controlvm_event(struct controlvm_message *msg)
 {
 	if (visorchannel_signalremove(controlvm_channel,
 				      CONTROLVM_QUEUE_EVENT, msg)) {
 		/* got a message */
 		if (msg->hdr.flags.test_message == 1)
-			return FALSE;
-		return TRUE;
+			return false;
+		return true;
 	}
-	return FALSE;
+	return false;
 }
 
 /*
@@ -1636,16 +1636,16 @@ parahotplug_process_message(struct controlvm_message *inmsg)
 
 /* Process a controlvm message.
  * Return result:
- *    FALSE - this function will return FALSE only in the case where the
+ *    false - this function will return FALSE only in the case where the
  *            controlvm message was NOT processed, but processing must be
  *            retried before reading the next controlvm message; a
  *            scenario where this can occur is when we need to throttle
  *            the allocation of memory in which to copy out controlvm
  *            payload data
- *    TRUE  - processing of the controlvm message completed,
+ *    true  - processing of the controlvm message completed,
  *            either successfully or with an error.
  */
-static BOOL
+static bool
 handle_command(struct controlvm_message inmsg, HOSTADDRESS channel_addr)
 {
 	struct controlvm_message_packet *cmd = &inmsg.cmd;
@@ -1658,7 +1658,7 @@ handle_command(struct controlvm_message inmsg, HOSTADDRESS channel_addr)
 	/* create parsing context if necessary */
 	local_addr = (inmsg.hdr.flags.test_message == 1);
 	if (channel_addr == 0)
-		return TRUE;
+		return true;
 	parm_addr = channel_addr + inmsg.hdr.payload_vm_offset;
 	parm_bytes = inmsg.hdr.payload_bytes;
 
@@ -1667,13 +1667,13 @@ handle_command(struct controlvm_message inmsg, HOSTADDRESS channel_addr)
 	 * makes a difference in how we compute the virtual address.
 	 */
 	if (parm_addr != 0 && parm_bytes != 0) {
-		BOOL retry = FALSE;
+		bool retry = false;
 
 		parser_ctx =
 		    parser_init_byte_stream(parm_addr, parm_bytes,
 					    local_addr, &retry);
 		if (!parser_ctx && retry)
-			return FALSE;
+			return false;
 	}
 
 	if (!local_addr) {
@@ -1740,7 +1740,7 @@ handle_command(struct controlvm_message inmsg, HOSTADDRESS channel_addr)
 		parser_done(parser_ctx);
 		parser_ctx = NULL;
 	}
-	return TRUE;
+	return true;
 }
 
 static HOSTADDRESS controlvm_get_channel_address(void)
@@ -1758,8 +1758,8 @@ static void
 controlvm_periodic_work(struct work_struct *work)
 {
 	struct controlvm_message inmsg;
-	BOOL got_command = FALSE;
-	BOOL handle_command_failed = FALSE;
+	bool got_command = false;
+	bool handle_command_failed = false;
 	static u64 poll_count;
 
 	/* make sure visorbus server is registered for controlvm callbacks */
@@ -1801,14 +1801,14 @@ controlvm_periodic_work(struct work_struct *work)
 			* rather than reading a new one
 			*/
 			inmsg = controlvm_pending_msg;
-			controlvm_pending_msg_valid = FALSE;
+			controlvm_pending_msg_valid = false;
 			got_command = true;
 		} else {
 			got_command = read_controlvm_event(&inmsg);
 		}
 	}
 
-	handle_command_failed = FALSE;
+	handle_command_failed = false;
 	while (got_command && (!handle_command_failed)) {
 		most_recent_message_jiffies = jiffies;
 		if (handle_command(inmsg,
@@ -1822,9 +1822,9 @@ controlvm_periodic_work(struct work_struct *work)
 			* controlvm msg so we will attempt to
 			* reprocess it on our next loop
 			*/
-			handle_command_failed = TRUE;
+			handle_command_failed = true;
 			controlvm_pending_msg = inmsg;
-			controlvm_pending_msg_valid = TRUE;
+			controlvm_pending_msg_valid = true;
 		}
 	}
 
@@ -1995,60 +1995,60 @@ device_resume_response(ulong bus_no, ulong dev_no, int response)
 				     segment_state_running);
 }
 
-BOOL
+bool
 visorchipset_get_bus_info(ulong bus_no, struct visorchipset_bus_info *bus_info)
 {
 	void *p = findbus(&bus_info_list, bus_no);
 
 	if (!p)
-		return FALSE;
+		return false;
 	memcpy(bus_info, p, sizeof(struct visorchipset_bus_info));
-	return TRUE;
+	return true;
 }
 EXPORT_SYMBOL_GPL(visorchipset_get_bus_info);
 
-BOOL
+bool
 visorchipset_set_bus_context(ulong bus_no, void *context)
 {
 	struct visorchipset_bus_info *p = findbus(&bus_info_list, bus_no);
 
 	if (!p)
-		return FALSE;
+		return false;
 	p->bus_driver_context = context;
-	return TRUE;
+	return true;
 }
 EXPORT_SYMBOL_GPL(visorchipset_set_bus_context);
 
-BOOL
+bool
 visorchipset_get_device_info(ulong bus_no, ulong dev_no,
 			     struct visorchipset_device_info *dev_info)
 {
 	void *p = finddevice(&dev_info_list, bus_no, dev_no);
 
 	if (!p)
-		return FALSE;
+		return false;
 	memcpy(dev_info, p, sizeof(struct visorchipset_device_info));
-	return TRUE;
+	return true;
 }
 EXPORT_SYMBOL_GPL(visorchipset_get_device_info);
 
-BOOL
+bool
 visorchipset_set_device_context(ulong bus_no, ulong dev_no, void *context)
 {
 	struct visorchipset_device_info *p =
 			finddevice(&dev_info_list, bus_no, dev_no);
 
 	if (!p)
-		return FALSE;
+		return false;
 	p->bus_driver_context = context;
-	return TRUE;
+	return true;
 }
 EXPORT_SYMBOL_GPL(visorchipset_set_device_context);
 
 /* Generic wrapper function for allocating memory from a kmem_cache pool.
  */
 void *
-visorchipset_cache_alloc(struct kmem_cache *pool, BOOL ok_to_block,
+visorchipset_cache_alloc(struct kmem_cache *pool, bool ok_to_block,
 			 char *fn, int ln)
 {
 	gfp_t gfp;
-- 
2.1.0

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel




[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux