Skip to contentSkip to conversation

drivers/char/synclink drivers/pcmcia/synclink - BOOLEAN to bool conversion

PATCH In review Joe Perches 2 participants 7 messages Mar 9, 2008 – Mar 10, 2008 Char and misc drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drivers/char/synclink drivers/pcmcia/synclink - BOOLEAN to bool conversion

Remove more TRUE/FALSE defines and uses
Remove == TRUE tests
Convert BOOLEAN to bool
Convert int to bool where appropriate

 include/linux/synclink.h          |    4 -
 drivers/char/pcmcia/synclink_cs.c |  125 +++++++++---------
 drivers/char/synclink.c           |  258 ++++++++++++++++++-------------------
 drivers/char/synclink_gt.c        |   88 +++++++-------
 drivers/char/synclinkmp.c         |  157 +++++++++++-----------
 5 files changed, 312 insertions(+), 320 deletions(-)
include/linux/synclink.h +0 -4
index 5562fbf..45f6bc8 100644
@@ -13,10 +13,6 @@
 #define _SYNCLINK_H_
 #define SYNCLINK_H_VERSION 3.6
 
-#define BOOLEAN int
-#define TRUE 1
-#define FALSE 0
-
 #define BIT0	0x0001
 #define BIT1	0x0002
 #define BIT2	0x0004
drivers/char/pcmcia/synclink_cs.c +63 -62

389 lines not on this page · raw message

drivers/char/synclink.c +126 -132

796 lines not on this page · raw message

drivers/char/synclink_gt.c +44 -44

286 lines not on this page · raw message

drivers/char/synclinkmp.c +79 -78

509 lines not on this page · raw message

#1 lore raw
Quoted 14 lines · Joe Perches

Remove more TRUE/FALSE defines and uses
Remove == TRUE tests
Convert BOOLEAN to bool
Convert int to bool where appropriate

 include/linux/synclink.h          |    4 -
 drivers/char/pcmcia/synclink_cs.c |  125 +++++++++---------
 drivers/char/synclink.c           |  258 ++++++++++++++++++-------------------
 drivers/char/synclink_gt.c        |   88 +++++++-------
 drivers/char/synclinkmp.c         |  157 +++++++++++-----------
 5 files changed, 312 insertions(+), 320 deletions(-)

...

Quoted 1 line
drivers/char/synclink_gt.c +0 -0

...

Quoted 17 lines
drivers/char/synclink_gt.c +1 -2
@@ -4475,14 +4476,13 @@ static void reset_rbufs(struct slgt_info *info)
 /*
  * pass receive HDLC frame to upper layer
  *
- * return 1 if frame available, otherwise 0
+ * return true if frame available, otherwise false
  */
 static int rx_get_frame(struct slgt_info *info)
 {
 	unsigned int start, end;
 	unsigned short status;
 	unsigned int framesize = 0;
-	int rc = 0;
 	unsigned long flags;
 	struct tty_struct *tty = info->tty;
 	unsigned char addr_field = 0xff;

drivers/char/synclink_gt.c check_again: · line 4613

Quoted 10 lines
drivers/char/synclink_gt.c +2 -2
@@ -4606,10 +4606,10 @@ check_again:
 		}
 	}
 	free_rbufs(info, start, end);
-	rc = 1;
+	return true;
 
 cleanup:
-	return rc;
+	return false;
 }

If you return bool values from this function it would make sense to also change the return value of the function declaration to bool.

Overall the patch seems reasonable. I need to spend time tomorrow going over it more carefully, compiling it, and testing it with hardware.

You may wish to shorten the subject line to:
[PATCH] synclink drivers bool conversion

It is more readable and covers all of the patch changes including int to bool conversions.

--
Paul

#2 lore raw

PATCH 1/1 synclink drivers bool conversion

Quoted 3 lines · Paul Fulghum

If you return bool values from this function it would make sense to also change the return value of the function declaration to bool.

Missed that one. Well spotted.
I changed rx_get_buf and a couple of comments from nonzero to true.

Quoted 3 lines

Overall the patch seems reasonable. I need to spend time tomorrow going over it more carefully, compiling it, and testing it with hardware.

 include/linux/synclink.h          |    4 -
 drivers/char/pcmcia/synclink_cs.c |  125 +++++++++---------
 drivers/char/synclink.c           |  258 ++++++++++++++++++-------------------
 drivers/char/synclink_gt.c        |  102 ++++++++--------
 drivers/char/synclinkmp.c         |  157 +++++++++++-----------
 5 files changed, 319 insertions(+), 327 deletions(-)
include/linux/synclink.h +0 -4
index 5562fbf..45f6bc8 100644
@@ -13,10 +13,6 @@
 #define _SYNCLINK_H_
 #define SYNCLINK_H_VERSION 3.6
 
-#define BOOLEAN int
-#define TRUE 1
-#define FALSE 0
-
 #define BIT0	0x0001
 #define BIT1	0x0002
 #define BIT2	0x0004
drivers/char/pcmcia/synclink_cs.c +63 -62

389 lines not on this page · raw message

drivers/char/synclink.c +126 -132

796 lines not on this page · raw message

drivers/char/synclink_gt.c +51 -51

321 lines not on this page · raw message

drivers/char/synclinkmp.c +79 -78

509 lines not on this page · raw message

#3 lore raw

Re: [PATCH] synclink drivers bool conversion

Quoted 6 lines · Joe Perches
drivers/char/synclink.c +0 -0
index ddc74d1..abf3c37 100644
@@ -5413,9 +5410,9 @@ static void usc_process_rxoverrun_sync( struct mgsl_struct *info )
 

drivers/char/synclink.c static void usc_process_rxoverrun_sync( struct mgsl_struct *info ) · line 5418

Quoted 10 lines
drivers/char/synclink.c +2 -2
 		if ( !start_of_frame_found )
 		{
-			start_of_frame_found = TRUE;
+			start_of_frame_found = true;
 			frame_start_index = end_index;
-			end_of_frame_found = FALSE;
+			end_of_frame_found = true;
 		}
 
 		if ( buffer_list[end_index].status )

end_of_frame_found should be false

#4 lore raw

Re: [PATCH] synclink drivers bool conversion

Quoted 16 lines · Joe Perches
Quoted 15 lines · Joe Perches
drivers/char/synclink.c +2 -2
index ddc74d1..abf3c37 100644
@@ -5413,9 +5410,9 @@ static void usc_process_rxoverrun_sync( struct mgsl_struct *info )
 
 		if ( !start_of_frame_found )
 		{
-			start_of_frame_found = TRUE;
+			start_of_frame_found = true;
 			frame_start_index = end_index;
-			end_of_frame_found = FALSE;
+			end_of_frame_found = true;
 		}
 
Quoted 3 lines

drivers/char/synclink.c static void usc_process_rxoverrun_sync( struct mgsl_struct *info ) · line 5418

Quoted 1 line
drivers/char/synclink.c +0 -0
 		if ( buffer_list[end_index].status )

end_of_frame_found should be false

OK the patch checks out (with the above fix).

Post the updated patch with a CC to Andrew
and I'll post an Acked-by response.

Signature · 2 lines
Paul Fulghum
Microgate Systems, Ltd.
#5 lore raw

PATCH 1/1 synclink drivers bool conversion

Quoted 4 lines · Paul Fulghum
Quoted 1 line

end_of_frame_found should be false

OK the patch checks out (with the above fix).
Post the updated patch with a CC to Andrew
and I'll post an Acked-by response.

 include/linux/synclink.h          |    4 -
 drivers/char/pcmcia/synclink_cs.c |  125 +++++++++---------
 drivers/char/synclink.c           |  258 ++++++++++++++++++-------------------
 drivers/char/synclink_gt.c        |  102 ++++++++--------
 drivers/char/synclinkmp.c         |  157 +++++++++++-----------
 5 files changed, 319 insertions(+), 327 deletions(-)
include/linux/synclink.h +0 -4
index 5562fbf..45f6bc8 100644
@@ -13,10 +13,6 @@
 #define _SYNCLINK_H_
 #define SYNCLINK_H_VERSION 3.6
 
-#define BOOLEAN int
-#define TRUE 1
-#define FALSE 0
-
 #define BIT0	0x0001
 #define BIT1	0x0002
 #define BIT2	0x0004
drivers/char/pcmcia/synclink_cs.c +63 -62

389 lines not on this page · raw message

drivers/char/synclink.c +126 -132

796 lines not on this page · raw message

drivers/char/synclink_gt.c +51 -51

321 lines not on this page · raw message

drivers/char/synclinkmp.c +79 -78

509 lines not on this page · raw message

Acked-by on v1 1/1
#6 lore raw

Re: [PATCH] synclink drivers bool conversion

Quoted 9 lines · Joe Perches
 include/linux/synclink.h          |    4 -
 drivers/char/pcmcia/synclink_cs.c |  125 +++++++++---------
 drivers/char/synclink.c           |  258 ++++++++++++++++++-------------------
 drivers/char/synclink_gt.c        |  102 ++++++++--------
 drivers/char/synclinkmp.c         |  157 +++++++++++-----------
 5 files changed, 319 insertions(+), 327 deletions(-)

Andrew, Here is Joe's original patch description:

Remove more TRUE/FALSE defines and uses
Remove == TRUE tests
Convert BOOLEAN to bool
Convert int to bool where appropriate