Skip to content

Commit

Permalink
Consolidate bool type
Browse files Browse the repository at this point in the history
'bool' is defined in random places. This patch consolidates them into a
single header file include/linux/types.h, using stdbool.h introduced in C99.

All other #define, typedef and enum are removed. They are all consistent with
true = 1, false = 0.

Replace FALSE, False with false. Replace TRUE, True with true.
Skip *.py, *.php, lib/* files.

Signed-off-by: York Sun <[email protected]>
  • Loading branch information
York Sun authored and trini committed Apr 1, 2013
1 parent 5644369 commit 472d546
Show file tree
Hide file tree
Showing 135 changed files with 942 additions and 1,137 deletions.
12 changes: 6 additions & 6 deletions README
Original file line number Diff line number Diff line change
Expand Up @@ -1938,24 +1938,24 @@ CBFS (Coreboot Filesystem) support

I2C_READ

Code that returns TRUE if the I2C data line is high,
FALSE if it is low.
Code that returns true if the I2C data line is high,
false if it is low.

eg: #define I2C_READ ((immr->im_cpm.cp_pbdat & PB_SDA) != 0)

I2C_SDA(bit)

If <bit> is TRUE, sets the I2C data line high. If it
is FALSE, it clears it (low).
If <bit> is true, sets the I2C data line high. If it
is false, it clears it (low).

eg: #define I2C_SDA(bit) \
if(bit) immr->im_cpm.cp_pbdat |= PB_SDA; \
else immr->im_cpm.cp_pbdat &= ~PB_SDA

I2C_SCL(bit)

If <bit> is TRUE, sets the I2C clock line high. If it
is FALSE, it clears it (low).
If <bit> is true, sets the I2C clock line high. If it
is false, it clears it (low).

eg: #define I2C_SCL(bit) \
if(bit) immr->im_cpm.cp_pbdat |= PB_SCL; \
Expand Down
37 changes: 17 additions & 20 deletions arch/arm/cpu/arm926ejs/spear/spear600.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,6 @@
#include <asm/arch/spr_misc.h>
#include <asm/arch/spr_defs.h>

#define FALSE 0
#define TRUE (!FALSE)

static void sel_1v8(void)
{
struct misc_regs *misc_p = (struct misc_regs *)CONFIG_SPEAR_MISCBASE;
Expand Down Expand Up @@ -133,8 +130,8 @@ void soc_init(void)
/*
* xxx_boot_selected:
*
* return TRUE if the particular booting option is selected
* return FALSE otherwise
* return true if the particular booting option is selected
* return false otherwise
*/
static u32 read_bootstrap(void)
{
Expand All @@ -150,18 +147,18 @@ int snor_boot_selected(void)
/* Check whether SNOR boot is selected */
if ((bootstrap & CONFIG_SPEAR_ONLYSNORBOOT) ==
CONFIG_SPEAR_ONLYSNORBOOT)
return TRUE;
return true;

if ((bootstrap & CONFIG_SPEAR_NORNANDBOOT) ==
CONFIG_SPEAR_NORNAND8BOOT)
return TRUE;
return true;

if ((bootstrap & CONFIG_SPEAR_NORNANDBOOT) ==
CONFIG_SPEAR_NORNAND16BOOT)
return TRUE;
return true;
}

return FALSE;
return false;
}

int nand_boot_selected(void)
Expand All @@ -172,20 +169,20 @@ int nand_boot_selected(void)
/* Check whether NAND boot is selected */
if ((bootstrap & CONFIG_SPEAR_NORNANDBOOT) ==
CONFIG_SPEAR_NORNAND8BOOT)
return TRUE;
return true;

if ((bootstrap & CONFIG_SPEAR_NORNANDBOOT) ==
CONFIG_SPEAR_NORNAND16BOOT)
return TRUE;
return true;
}

return FALSE;
return false;
}

int pnor_boot_selected(void)
{
/* Parallel NOR boot is not selected in any SPEAr600 revision */
return FALSE;
return false;
}

int usb_boot_selected(void)
Expand All @@ -195,39 +192,39 @@ int usb_boot_selected(void)
if (USB_BOOT_SUPPORTED) {
/* Check whether USB boot is selected */
if (!(bootstrap & CONFIG_SPEAR_USBBOOT))
return TRUE;
return true;
}

return FALSE;
return false;
}

int tftp_boot_selected(void)
{
/* TFTP boot is not selected in any SPEAr600 revision */
return FALSE;
return false;
}

int uart_boot_selected(void)
{
/* UART boot is not selected in any SPEAr600 revision */
return FALSE;
return false;
}

int spi_boot_selected(void)
{
/* SPI boot is not selected in any SPEAr600 revision */
return FALSE;
return false;
}

int i2c_boot_selected(void)
{
/* I2C boot is not selected in any SPEAr600 revision */
return FALSE;
return false;
}

int mmc_boot_selected(void)
{
return FALSE;
return false;
}

void plat_late_init(void)
Expand Down
2 changes: 1 addition & 1 deletion arch/arm/cpu/arm926ejs/spear/spl_boot.c
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ u32 spl_boot(void)
/*
* All the supported booting devices are listed here. Each of
* the booting type supported by the platform would define the
* macro xxx_BOOT_SUPPORTED to TRUE.
* macro xxx_BOOT_SUPPORTED to true.
*/

if (SNOR_BOOT_SUPPORTED && snor_boot_selected()) {
Expand Down
3 changes: 0 additions & 3 deletions arch/blackfin/include/asm/posix_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,6 @@ typedef unsigned int __kernel_gid32_t;
typedef unsigned short __kernel_old_uid_t;
typedef unsigned short __kernel_old_gid_t;

#define BOOL_WAS_DEFINED
typedef enum { false = 0, true = 1 } bool;

#ifdef __GNUC__
typedef long long __kernel_loff_t;
#endif
Expand Down
2 changes: 1 addition & 1 deletion arch/m68k/lib/interrupts.c
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ int disable_interrupts (void)
sr = get_sr ();
set_sr (sr | 0x0700);

return ((sr & 0x0700) == 0); /* return TRUE, if interrupts were enabled before */
return ((sr & 0x0700) == 0); /* return true, if interrupts were enabled before */
}

void int_handler (struct pt_regs *fp)
Expand Down
2 changes: 1 addition & 1 deletion arch/nds32/lib/interrupts.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ void enable_interrupts(void)

/*
* disable interrupts
* Return TRUE if GIE is enabled before we disable it.
* Return true if GIE is enabled before we disable it.
*/
int disable_interrupts(void)
{
Expand Down
2 changes: 1 addition & 1 deletion arch/powerpc/cpu/mpc85xx/fsl_corenet_serdes.c
Original file line number Diff line number Diff line change
Expand Up @@ -513,7 +513,7 @@ void fsl_serdes_init(void)
size_t arglen;
#endif
#ifdef CONFIG_SYS_P4080_ERRATUM_SERDES_A001
int need_serdes_a001; /* TRUE == need work-around for SERDES A001 */
int need_serdes_a001; /* true == need work-around for SERDES A001 */
#endif
#ifdef CONFIG_SYS_P4080_ERRATUM_SERDES8
char buffer[HWCONFIG_BUFFER_SIZE];
Expand Down
Loading

0 comments on commit 472d546

Please sign in to comment.