diff mbox

[U-Boot,v3] Consolidate bool type

Message ID 1358977307-17350-1-git-send-email-yorksun@freescale.com
State Superseded
Headers show

Commit Message

York Sun Jan. 23, 2013, 9:41 p.m. UTC
'bool' is defined in random places. This patch consolidates them into a
single header file include/linux/types.h, using stdbool.h.

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

Signed-off-by: York Sun <yorksun@freescale.com>
---
Change since v1:
 Move 'false' and 'true' to the common header file.

Change since v2:
 Use stdbool.h
 Consolidate all TRUE, FALSE, True, False, true, false

Need help to test on all ARCHs with differnt toolchains as well as USE_PRIVATE_LIBGCC.

 arch/arm/cpu/arm926ejs/spear/spear600.c   |    3 ---
 arch/blackfin/include/asm/posix_types.h   |    3 ---
 arch/powerpc/cpu/ppc4xx/44x_spd_ddr.c     |    2 --
 arch/powerpc/cpu/ppc4xx/44x_spd_ddr2.c    |    7 -------
 arch/powerpc/cpu/ppc4xx/denali_spd_ddr2.c |    7 -------
 board/Marvell/db64360/mv_eth.h            |    7 -------
 board/Marvell/db64460/mv_eth.h            |    7 -------
 board/Marvell/include/core.h              |    5 -----
 board/amcc/bamboo/bamboo.h                |    3 ---
 board/amcc/yucca/yucca.c                  |    3 ---
 board/bf533-ezkit/flash-defines.h         |    2 --
 board/bf533-stamp/video.h                 |    3 ---
 board/esd/common/lcd.h                    |    5 -----
 board/esd/cpci750/mv_eth.h                |    7 -------
 board/esd/dasa_sim/cmd_dasa_sim.c         |    4 ----
 board/evb64260/eth_addrtbl.c              |    3 ---
 board/mpl/common/isa.c                    |    7 -------
 board/mpl/mip405/mip405.c                 |    2 --
 board/mpl/pip405/pip405.c                 |    3 ---
 board/prodrive/p3mx/mv_eth.h              |    7 -------
 board/sacsng/clkinit.h                    |    5 -----
 board/xilinx/common/xbasic_types.h        |    8 --------
 common/cmd_fdc.c                          |    7 -------
 drivers/bios_emulator/atibios.c           |    4 ----
 drivers/block/sata_dwc.h                  |    7 -------
 drivers/mtd/nand/mxc_nand.c               |    2 --
 drivers/net/armada100_fec.h               |    7 -------
 drivers/net/ne2000_base.h                 |    4 ----
 drivers/net/npe/include/IxOsalTypes.h     |    8 --------
 drivers/rtc/ds1374.c                      |    7 -------
 drivers/usb/musb-new/linux-compat.h       |    2 --
 fs/ext4/ext4_common.h                     |    2 --
 include/at91rm9200_net.h                  |    4 ----
 include/bedbug/ppc.h                      |    5 -----
 include/fpga.h                            |    8 --------
 include/galileo/core.h                    |    5 -----
 include/linux/types.h                     |    5 +++++
 include/scsi.h                            |    8 --------
 include/sym53c8xx.h                       |    7 -------
 include/xyzModem.h                        |    8 --------
 lib/bzlib_private.h                       |    3 ---
 lib/lzma/Types.h                          |    3 ---
 42 files changed, 5 insertions(+), 204 deletions(-)

Comments

York Sun Jan. 23, 2013, 9:46 p.m. UTC | #1
On 01/23/2013 01:41 PM, York Sun wrote:
> 'bool' is defined in random places. This patch consolidates them into a
> single header file include/linux/types.h, using stdbool.h.
> 
> All other #define, typedef and enum are removed. They are all consistent with
> true = 1, false = 0.
> 
> Signed-off-by: York Sun <yorksun@freescale.com>
> ---
> Change since v1:
>  Move 'false' and 'true' to the common header file.
> 
> Change since v2:
>  Use stdbool.h
>  Consolidate all TRUE, FALSE, True, False, true, false
> 
> Need help to test on all ARCHs with differnt toolchains as well as USE_PRIVATE_LIBGCC.
> 
>
I should put RFC in the subject as I am not able to compile all ARCH myself.

York
Scott Wood Jan. 23, 2013, 9:52 p.m. UTC | #2
On 01/23/2013 03:46:04 PM, York Sun wrote:
> On 01/23/2013 01:41 PM, York Sun wrote:
> > 'bool' is defined in random places. This patch consolidates them  
> into a
> > single header file include/linux/types.h, using stdbool.h.
> >
> > All other #define, typedef and enum are removed. They are all  
> consistent with
> > true = 1, false = 0.
> >
> > Signed-off-by: York Sun <yorksun@freescale.com>
> > ---
> > Change since v1:
> >  Move 'false' and 'true' to the common header file.
> >
> > Change since v2:
> >  Use stdbool.h
> >  Consolidate all TRUE, FALSE, True, False, true, false
> >
> > Need help to test on all ARCHs with differnt toolchains as well as  
> USE_PRIVATE_LIBGCC.
> >
> >
> I should put RFC in the subject as I am not able to compile all ARCH  
> myself.

So how do you see this patch becoming non-RFC?  I think most people  
don't have every single toolchain.  You should at least get a toolchain  
for a couple major architectures such as ARM.  Usually RFC is for when  
you know the patch has issues, and don't want it applied yet even if  
nobody else finds fault with it.

-Scott
Scott Wood Jan. 23, 2013, 9:53 p.m. UTC | #3
On 01/23/2013 03:41:47 PM, York Sun wrote:
> diff --git a/drivers/net/npe/include/IxOsalTypes.h  
> b/drivers/net/npe/include/IxOsalTypes.h
> index a190a70..0168902 100644
> --- a/drivers/net/npe/include/IxOsalTypes.h
> +++ b/drivers/net/npe/include/IxOsalTypes.h
> @@ -107,18 +107,10 @@ typedef volatile INT32 VINT32;
>   */
>  #define IX_OSAL_BILLION (1000000000)
> 
> -#ifndef TRUE
> -#define TRUE       1L
> -#endif
> -
>  #if TRUE != 1
>  #error TRUE is not defined to 1
>  #endif
> 
> -#ifndef FALSE
> -#define FALSE      0L
> -#endif
> -
>  #if FALSE != 0
>  #error FALSE is not defined to 0
>  #endif

I imagine at least one of these #error statements will kick in now.   
All of the users of non-standard capitalizations must be fixed (I only  
see the definitions affected by this patch), and tests like these  
should just be dropped.

-Scott
York Sun Jan. 23, 2013, 10:01 p.m. UTC | #4
On 01/23/2013 01:52 PM, Scott Wood wrote:
> On 01/23/2013 03:46:04 PM, York Sun wrote:
>> On 01/23/2013 01:41 PM, York Sun wrote:
>> > 'bool' is defined in random places. This patch consolidates them into a
>> > single header file include/linux/types.h, using stdbool.h.
>> >
>> > All other #define, typedef and enum are removed. They are all
>> consistent with
>> > true = 1, false = 0.
>> >
>> > Signed-off-by: York Sun <yorksun@freescale.com>
>> > ---
>> > Change since v1:
>> >  Move 'false' and 'true' to the common header file.
>> >
>> > Change since v2:
>> >  Use stdbool.h
>> >  Consolidate all TRUE, FALSE, True, False, true, false
>> >
>> > Need help to test on all ARCHs with differnt toolchains as well as
>> USE_PRIVATE_LIBGCC.
>> >
>> >
>> I should put RFC in the subject as I am not able to compile all ARCH
>> myself.
> 
> So how do you see this patch becoming non-RFC?  I think most people
> don't have every single toolchain.  You should at least get a toolchain
> for a couple major architectures such as ARM.  Usually RFC is for when
> you know the patch has issues, and don't want it applied yet even if
> nobody else finds fault with it.
> 

I know this version has problem. I am hoping more people get involved
and test what they can. I tried the arm toolchain you pointed to me. I
couldn't run MAKEALL for arm.

York
Scott Wood Jan. 23, 2013, 10:02 p.m. UTC | #5
On 01/23/2013 04:01:49 PM, York Sun wrote:
> On 01/23/2013 01:52 PM, Scott Wood wrote:
> > On 01/23/2013 03:46:04 PM, York Sun wrote:
> >> On 01/23/2013 01:41 PM, York Sun wrote:
> >> I should put RFC in the subject as I am not able to compile all  
> ARCH
> >> myself.
> >
> > So how do you see this patch becoming non-RFC?  I think most people
> > don't have every single toolchain.  You should at least get a  
> toolchain
> > for a couple major architectures such as ARM.  Usually RFC is for  
> when
> > you know the patch has issues, and don't want it applied yet even if
> > nobody else finds fault with it.
> >
> 
> I know this version has problem. I am hoping more people get involved
> and test what they can. I tried the arm toolchain you pointed to me. I
> couldn't run MAKEALL for arm.

Even before your patch, using USE_PRIVATE_LIBGCC?  How many boards  
failed?

-Scott
York Sun Jan. 23, 2013, 10:04 p.m. UTC | #6
On 01/23/2013 01:53 PM, Scott Wood wrote:
> On 01/23/2013 03:41:47 PM, York Sun wrote:
>> diff --git a/drivers/net/npe/include/IxOsalTypes.h
>> b/drivers/net/npe/include/IxOsalTypes.h
>> index a190a70..0168902 100644
>> --- a/drivers/net/npe/include/IxOsalTypes.h
>> +++ b/drivers/net/npe/include/IxOsalTypes.h
>> @@ -107,18 +107,10 @@ typedef volatile INT32 VINT32;
>>   */
>>  #define IX_OSAL_BILLION (1000000000)
>>
>> -#ifndef TRUE
>> -#define TRUE       1L
>> -#endif
>> -
>>  #if TRUE != 1
>>  #error TRUE is not defined to 1
>>  #endif
>>
>> -#ifndef FALSE
>> -#define FALSE      0L
>> -#endif
>> -
>>  #if FALSE != 0
>>  #error FALSE is not defined to 0
>>  #endif
> 
> I imagine at least one of these #error statements will kick in now.  All
> of the users of non-standard capitalizations must be fixed (I only see
> the definitions affected by this patch), and tests like these should
> just be dropped.
> 


Agreed. Will drop in next version (v5).

York
York Sun Jan. 23, 2013, 10:05 p.m. UTC | #7
On 01/23/2013 02:02 PM, Scott Wood wrote:
> On 01/23/2013 04:01:49 PM, York Sun wrote:
>> On 01/23/2013 01:52 PM, Scott Wood wrote:
>> > On 01/23/2013 03:46:04 PM, York Sun wrote:
>> >> On 01/23/2013 01:41 PM, York Sun wrote:
>> >> I should put RFC in the subject as I am not able to compile all ARCH
>> >> myself.
>> >
>> > So how do you see this patch becoming non-RFC?  I think most people
>> > don't have every single toolchain.  You should at least get a toolchain
>> > for a couple major architectures such as ARM.  Usually RFC is for when
>> > you know the patch has issues, and don't want it applied yet even if
>> > nobody else finds fault with it.
>> >
>>
>> I know this version has problem. I am hoping more people get involved
>> and test what they can. I tried the arm toolchain you pointed to me. I
>> couldn't run MAKEALL for arm.
> 
> Even before your patch, using USE_PRIVATE_LIBGCC?  How many boards failed?
> 
I don't know. Wolfgang brought it. Allen kindly offered help to verify
on tegra which uses USE_PRIVATE_LIBGCC.

York
Allen Martin Jan. 23, 2013, 10:10 p.m. UTC | #8
On Wed, Jan 23, 2013 at 02:05:26PM -0800, York Sun wrote:
> On 01/23/2013 02:02 PM, Scott Wood wrote:
> > On 01/23/2013 04:01:49 PM, York Sun wrote:
> >> On 01/23/2013 01:52 PM, Scott Wood wrote:
> >> > On 01/23/2013 03:46:04 PM, York Sun wrote:
> >> >> On 01/23/2013 01:41 PM, York Sun wrote:
> >> >> I should put RFC in the subject as I am not able to compile all ARCH
> >> >> myself.
> >> >
> >> > So how do you see this patch becoming non-RFC?  I think most people
> >> > don't have every single toolchain.  You should at least get a toolchain
> >> > for a couple major architectures such as ARM.  Usually RFC is for when
> >> > you know the patch has issues, and don't want it applied yet even if
> >> > nobody else finds fault with it.
> >> >
> >>
> >> I know this version has problem. I am hoping more people get involved
> >> and test what they can. I tried the arm toolchain you pointed to me. I
> >> couldn't run MAKEALL for arm.
> > 
> > Even before your patch, using USE_PRIVATE_LIBGCC?  How many boards failed?
> > 
> I don't know. Wolfgang brought it. Allen kindly offered help to verify
> on tegra which uses USE_PRIVATE_LIBGCC.

I actually have a script to build all 1000+ boards in every
architecture, but I think a few of my toolchains are broken (openrisc
and blackfin come to mind).  I've been thinking about incorporating
that functionality into MAKEALL as a set of patches.

In the meantime I can build and test on tegra, which as York says uses
USE_PRIVATE_LIBGCC. 

-Allen
Allen Martin Jan. 24, 2013, 5:34 p.m. UTC | #9
On Wed, Jan 23, 2013 at 02:05:26PM -0800, York Sun wrote:
> On 01/23/2013 02:02 PM, Scott Wood wrote:
> > On 01/23/2013 04:01:49 PM, York Sun wrote:
> >> On 01/23/2013 01:52 PM, Scott Wood wrote:
> >> > On 01/23/2013 03:46:04 PM, York Sun wrote:
> >> >> On 01/23/2013 01:41 PM, York Sun wrote:
> >> >> I should put RFC in the subject as I am not able to compile all ARCH
> >> >> myself.
> >> >
> >> > So how do you see this patch becoming non-RFC?  I think most people
> >> > don't have every single toolchain.  You should at least get a toolchain
> >> > for a couple major architectures such as ARM.  Usually RFC is for when
> >> > you know the patch has issues, and don't want it applied yet even if
> >> > nobody else finds fault with it.
> >> >
> >>
> >> I know this version has problem. I am hoping more people get involved
> >> and test what they can. I tried the arm toolchain you pointed to me. I
> >> couldn't run MAKEALL for arm.
> > 
> > Even before your patch, using USE_PRIVATE_LIBGCC?  How many boards failed?
> > 
> I don't know. Wolfgang brought it. Allen kindly offered help to verify
> on tegra which uses USE_PRIVATE_LIBGCC.
> 

Built and tested on tegra, no problems.  I'm still seeing a lot of
references to  TRUE/FALSE even after this patch though:

$ git grep -e FALSE -e TRUE | awk 'BEGIN {FS = ":"} {print $1}' | sort | uniq
arch/arm/cpu/arm926ejs/spear/spear600.c
arch/arm/cpu/arm926ejs/spear/spl_boot.c
arch/m68k/lib/interrupts.c
arch/nds32/lib/interrupts.c
arch/powerpc/cpu/mpc85xx/fsl_corenet_serdes.c
arch/powerpc/cpu/ppc4xx/44x_spd_ddr2.c
arch/powerpc/cpu/ppc4xx/44x_spd_ddr.c
arch/powerpc/cpu/ppc4xx/denali_spd_ddr2.c
Binary file tools/easylogo/linux_logo.tga matches
board/amcc/bamboo/bamboo.c
board/amcc/yucca/yucca.h
board/bf533-ezkit/flash.c
board/bf537-stamp/ide-cf.c
board/esd/common/lcd.c
board/esd/dasa_sim/cmd_dasa_sim.c
board/esd/pmc440/fpga.c
board/evb64260/eth_addrtbl.c
board/gen860t/fpga.c
board/matrix_vision/mvblx/mvblx.c
board/mousse/flash.c
board/mpl/common/isa.c
board/mpl/mip405/mip405.c
board/mpl/pip405/pip405.c
board/sacsng/clkinit.c
board/spear/x600/fpga.c
board/teejet/mt_ventoux/mt_ventoux.c
board/xilinx/common/xbasic_types.c
board/xilinx/common/xdma_channel.c
board/xilinx/common/xdma_channel_sg.c
board/xilinx/common/xipif_v1_23_b.h
board/xilinx/common/xpacket_fifo_v1_00_b.h
board/xilinx/common/xversion.c
common/bedbug.c
common/cmd_bedbug.c
common/cmd_fdc.c
common/cmd_scsi.c
drivers/bios_emulator/x86emu/debug.c
drivers/block/ahci.c
drivers/block/sata_dwc.c
drivers/block/sym53c8xx.c
drivers/dma/MCD_dmaApi.c
drivers/fpga/ACEX1K.c
drivers/fpga/altera.c
drivers/fpga/cyclon2.c
drivers/fpga/lattice.c
drivers/fpga/spartan2.c
drivers/fpga/spartan3.c
drivers/fpga/virtex2.c
drivers/fpga/xilinx.c
drivers/net/armada100_fec.c
drivers/net/e1000.c
drivers/net/e1000.h
drivers/net/e1000_spi.c
drivers/net/npe/include/IxAtmdAccCtrl.h
drivers/net/npe/include/IxEthAcc_p.h
drivers/net/npe/include/IxEthDB.h
drivers/net/npe/include/IxEthDB_p.h
drivers/net/npe/include/IxEthMii.h
drivers/net/npe/include/IxFeatureCtrl.h
drivers/net/npe/include/IxHssAcc.h
drivers/net/npe/include/IxNpeDl.h
drivers/net/npe/include/IxNpeDlNpeMgr_p.h
drivers/net/npe/include/IxNpeDlNpeMgrUtils_p.h
drivers/net/npe/include/IxNpeMhConfig_p.h
drivers/net/npe/include/IxOsal.h
drivers/net/npe/include/IxOsalTypes.h
drivers/net/npe/include/IxPerfProfAcc.h
drivers/net/npe/include/IxQMgrAqmIf_p.h
drivers/net/npe/include/IxTimeSyncAcc.h
drivers/net/npe/IxEthAcc.c
drivers/net/npe/IxEthAccCommon.c
drivers/net/npe/IxEthAccDataPlane.c
drivers/net/npe/IxEthAccMac.c
drivers/net/npe/IxEthDBAPI.c
drivers/net/npe/IxEthDBAPISupport.c
drivers/net/npe/IxEthDBCore.c
drivers/net/npe/IxEthDBEvents.c
drivers/net/npe/IxEthDBFeatures.c
drivers/net/npe/IxEthDBFirewall.c
drivers/net/npe/IxEthDBLearning.c
drivers/net/npe/IxEthDBNPEAdaptor.c
drivers/net/npe/IxEthDBPortUpdate.c
drivers/net/npe/IxEthDBReports.c
drivers/net/npe/IxEthDBSearch.c
drivers/net/npe/IxEthDBSpanningTree.c
drivers/net/npe/IxEthDBUtil.c
drivers/net/npe/IxEthDBVlan.c
drivers/net/npe/IxEthMii.c
drivers/net/npe/IxFeatureCtrl.c
drivers/net/npe/IxNpeDl.c
drivers/net/npe/IxNpeDlImageMgr.c
drivers/net/npe/IxNpeDlNpeMgr.c
drivers/net/npe/IxNpeMh.c
drivers/net/npe/IxNpeMhConfig.c
drivers/net/npe/IxNpeMhSend.c
drivers/net/npe/IxOsalOsSemaphore.c
drivers/net/npe/IxQMgrDispatcher.c
drivers/net/npe/IxQMgrInit.c
drivers/net/npe/IxQMgrQCfg.c
drivers/net/npe/npe.c
drivers/rtc/ds1374.c
drivers/serial/usbtty.c
drivers/video/da8xx-fb.c
drivers/video/mxc_ipuv3_fb.c
fs/ext4/ext4_journal.c
include/configs/bf537-stamp.h
include/dp83848.h
include/linux/fb.h
include/linux/mtd/nand.h
include/linux/types.h
include/MCD_dma.h
include/pcmcia/ti113x.h
include/radeon.h
include/sym53c8xx.h
include/usb_cdc_acm.h
include/usbdevice.h
README
tools/bddb/defs.php


-Allen
York Sun Jan. 24, 2013, 5:54 p.m. UTC | #10
On 01/24/2013 09:34 AM, Allen Martin wrote:
> On Wed, Jan 23, 2013 at 02:05:26PM -0800, York Sun wrote:
>> On 01/23/2013 02:02 PM, Scott Wood wrote:
>>> On 01/23/2013 04:01:49 PM, York Sun wrote:
>>>> On 01/23/2013 01:52 PM, Scott Wood wrote:
>>>>> On 01/23/2013 03:46:04 PM, York Sun wrote:
>>>>>> On 01/23/2013 01:41 PM, York Sun wrote:
>>>>>> I should put RFC in the subject as I am not able to compile all ARCH
>>>>>> myself.
>>>>>
>>>>> So how do you see this patch becoming non-RFC?  I think most people
>>>>> don't have every single toolchain.  You should at least get a toolchain
>>>>> for a couple major architectures such as ARM.  Usually RFC is for when
>>>>> you know the patch has issues, and don't want it applied yet even if
>>>>> nobody else finds fault with it.
>>>>>
>>>>
>>>> I know this version has problem. I am hoping more people get involved
>>>> and test what they can. I tried the arm toolchain you pointed to me. I
>>>> couldn't run MAKEALL for arm.
>>>
>>> Even before your patch, using USE_PRIVATE_LIBGCC?  How many boards failed?
>>>
>> I don't know. Wolfgang brought it. Allen kindly offered help to verify
>> on tegra which uses USE_PRIVATE_LIBGCC.
>>
> 
> Built and tested on tegra, no problems.  I'm still seeing a lot of
> references to  TRUE/FALSE even after this patch though:
> 
> $ git grep -e FALSE -e TRUE | awk 'BEGIN {FS = ":"} {print $1}' | sort | uniq
> 
Thanks, Allen. A long way to go.

York
York Sun Jan. 24, 2013, 6:03 p.m. UTC | #11
On 01/24/2013 09:54 AM, York Sun wrote:
> On 01/24/2013 09:34 AM, Allen Martin wrote:
>> On Wed, Jan 23, 2013 at 02:05:26PM -0800, York Sun wrote:
>>> On 01/23/2013 02:02 PM, Scott Wood wrote:
>>>> On 01/23/2013 04:01:49 PM, York Sun wrote:
>>>>> On 01/23/2013 01:52 PM, Scott Wood wrote:
>>>>>> On 01/23/2013 03:46:04 PM, York Sun wrote:
>>>>>>> On 01/23/2013 01:41 PM, York Sun wrote:
>>>>>>> I should put RFC in the subject as I am not able to compile all ARCH
>>>>>>> myself.
>>>>>>
>>>>>> So how do you see this patch becoming non-RFC?  I think most people
>>>>>> don't have every single toolchain.  You should at least get a toolchain
>>>>>> for a couple major architectures such as ARM.  Usually RFC is for when
>>>>>> you know the patch has issues, and don't want it applied yet even if
>>>>>> nobody else finds fault with it.
>>>>>>
>>>>>
>>>>> I know this version has problem. I am hoping more people get involved
>>>>> and test what they can. I tried the arm toolchain you pointed to me. I
>>>>> couldn't run MAKEALL for arm.
>>>>
>>>> Even before your patch, using USE_PRIVATE_LIBGCC?  How many boards failed?
>>>>
>>> I don't know. Wolfgang brought it. Allen kindly offered help to verify
>>> on tegra which uses USE_PRIVATE_LIBGCC.
>>>
>>
>> Built and tested on tegra, no problems.  I'm still seeing a lot of
>> references to  TRUE/FALSE even after this patch though:
>>
>> $ git grep -e FALSE -e TRUE | awk 'BEGIN {FS = ":"} {print $1}' | sort | uniq
>>
> Thanks, Allen. A long way to go.
> 

I thought I have replaced all #define, enum, typedef. I have left alone
those FALSE, False, false but add define like this

+#include <stdbool.h>
+#define TRUE true
+#define FALSE false
+#define True true
+#define False false

Isn't that enough?

I did miss the #if TRUE != 1 part, as pointed out by Scott. Will fix in
next rev.

York
Scott Wood Jan. 24, 2013, 6:14 p.m. UTC | #12
On 01/24/2013 12:03:49 PM, York Sun wrote:
> On 01/24/2013 09:54 AM, York Sun wrote:
> > On 01/24/2013 09:34 AM, Allen Martin wrote:
> >> On Wed, Jan 23, 2013 at 02:05:26PM -0800, York Sun wrote:
> >>> On 01/23/2013 02:02 PM, Scott Wood wrote:
> >>>> On 01/23/2013 04:01:49 PM, York Sun wrote:
> >>>>> On 01/23/2013 01:52 PM, Scott Wood wrote:
> >>>>>> On 01/23/2013 03:46:04 PM, York Sun wrote:
> >>>>>>> On 01/23/2013 01:41 PM, York Sun wrote:
> >>>>>>> I should put RFC in the subject as I am not able to compile  
> all ARCH
> >>>>>>> myself.
> >>>>>>
> >>>>>> So how do you see this patch becoming non-RFC?  I think most  
> people
> >>>>>> don't have every single toolchain.  You should at least get a  
> toolchain
> >>>>>> for a couple major architectures such as ARM.  Usually RFC is  
> for when
> >>>>>> you know the patch has issues, and don't want it applied yet  
> even if
> >>>>>> nobody else finds fault with it.
> >>>>>>
> >>>>>
> >>>>> I know this version has problem. I am hoping more people get  
> involved
> >>>>> and test what they can. I tried the arm toolchain you pointed  
> to me. I
> >>>>> couldn't run MAKEALL for arm.
> >>>>
> >>>> Even before your patch, using USE_PRIVATE_LIBGCC?  How many  
> boards failed?
> >>>>
> >>> I don't know. Wolfgang brought it. Allen kindly offered help to  
> verify
> >>> on tegra which uses USE_PRIVATE_LIBGCC.
> >>>
> >>
> >> Built and tested on tegra, no problems.  I'm still seeing a lot of
> >> references to  TRUE/FALSE even after this patch though:
> >>
> >> $ git grep -e FALSE -e TRUE | awk 'BEGIN {FS = ":"} {print $1}' |  
> sort | uniq
> >>
> > Thanks, Allen. A long way to go.
> >
> 
> I thought I have replaced all #define, enum, typedef. I have left  
> alone
> those FALSE, False, false but add define like this
> 
> +#include <stdbool.h>
> +#define TRUE true
> +#define FALSE false
> +#define True true
> +#define False false
> 
> Isn't that enough?

It's enough to make it build, but it would be better to fix the users.

-Scott
York Sun Jan. 24, 2013, 6:23 p.m. UTC | #13
On 01/24/2013 10:14 AM, Scott Wood wrote:
>> >
>>
>> I thought I have replaced all #define, enum, typedef. I have left alone
>> those FALSE, False, false but add define like this
>>
>> +#include <stdbool.h>
>> +#define TRUE true
>> +#define FALSE false
>> +#define True true
>> +#define False false
>>
>> Isn't that enough?
> 
> It's enough to make it build, but it would be better to fix the users.
> 

Let me try to run a script to replace all of them to "false" and "true".

York
Allen Martin Jan. 24, 2013, 6:25 p.m. UTC | #14
On Thu, Jan 24, 2013 at 10:14:37AM -0800, Scott Wood wrote:
> On 01/24/2013 12:03:49 PM, York Sun wrote:
> > On 01/24/2013 09:54 AM, York Sun wrote:
> > > On 01/24/2013 09:34 AM, Allen Martin wrote:
> > >> On Wed, Jan 23, 2013 at 02:05:26PM -0800, York Sun wrote:
> > >>> On 01/23/2013 02:02 PM, Scott Wood wrote:
> > >>>> On 01/23/2013 04:01:49 PM, York Sun wrote:
> > >>>>> On 01/23/2013 01:52 PM, Scott Wood wrote:
> > >>>>>> On 01/23/2013 03:46:04 PM, York Sun wrote:
> > >>>>>>> On 01/23/2013 01:41 PM, York Sun wrote:
> > >>>>>>> I should put RFC in the subject as I am not able to compile  
> > all ARCH
> > >>>>>>> myself.
> > >>>>>>
> > >>>>>> So how do you see this patch becoming non-RFC?  I think most  
> > people
> > >>>>>> don't have every single toolchain.  You should at least get a  
> > toolchain
> > >>>>>> for a couple major architectures such as ARM.  Usually RFC is  
> > for when
> > >>>>>> you know the patch has issues, and don't want it applied yet  
> > even if
> > >>>>>> nobody else finds fault with it.
> > >>>>>>
> > >>>>>
> > >>>>> I know this version has problem. I am hoping more people get  
> > involved
> > >>>>> and test what they can. I tried the arm toolchain you pointed  
> > to me. I
> > >>>>> couldn't run MAKEALL for arm.
> > >>>>
> > >>>> Even before your patch, using USE_PRIVATE_LIBGCC?  How many  
> > boards failed?
> > >>>>
> > >>> I don't know. Wolfgang brought it. Allen kindly offered help to  
> > verify
> > >>> on tegra which uses USE_PRIVATE_LIBGCC.
> > >>>
> > >>
> > >> Built and tested on tegra, no problems.  I'm still seeing a lot of
> > >> references to  TRUE/FALSE even after this patch though:
> > >>
> > >> $ git grep -e FALSE -e TRUE | awk 'BEGIN {FS = ":"} {print $1}' |  
> > sort | uniq
> > >>
> > > Thanks, Allen. A long way to go.
> > >
> > 
> > I thought I have replaced all #define, enum, typedef. I have left  
> > alone
> > those FALSE, False, false but add define like this
> > 
> > +#include <stdbool.h>
> > +#define TRUE true
> > +#define FALSE false
> > +#define True true
> > +#define False false
> > 
> > Isn't that enough?
> 
> It's enough to make it build, but it would be better to fix the users.
> 

For code consistency I think it would be better to force everything to
use the lower case "true/false".  Otherwise this patch does nothing to
force new code to use the standardized version.

There may be some exception we want to make for unmodified 3rd party
libraries that are checked in, like lib/bzlib which uses True/False,
otherwise it makes it hard to take new code drops of those things.

-Allen
Wolfgang Denk Jan. 24, 2013, 6:26 p.m. UTC | #15
Dear York Sun,

In message <51017785.9060705@freescale.com> you wrote:
>
> I thought I have replaced all #define, enum, typedef. I have left alone
> those FALSE, False, false but add define like this
> 
> +#include <stdbool.h>
> +#define TRUE true
> +#define FALSE false
> +#define True true
> +#define False false

Arghh..

> Isn't that enough?

Please remove all such occurrences.  Thanks.

Best regards,

Wolfgang Denk
Allen Martin Jan. 24, 2013, 6:28 p.m. UTC | #16
On Thu, Jan 24, 2013 at 10:23:21AM -0800, York Sun wrote:
> On 01/24/2013 10:14 AM, Scott Wood wrote:
> >> >
> >>
> >> I thought I have replaced all #define, enum, typedef. I have left alone
> >> those FALSE, False, false but add define like this
> >>
> >> +#include <stdbool.h>
> >> +#define TRUE true
> >> +#define FALSE false
> >> +#define True true
> >> +#define False false
> >>
> >> Isn't that enough?
> > 
> > It's enough to make it build, but it would be better to fix the users.
> > 
> 
> Let me try to run a script to replace all of them to "false" and "true".
> 
> York
> 
> 

Try this:

$ find . -type f -name \*.h -print | xargs perl -pi -e 's/(\b)FALSE(\b)/$1false$2/g'
$ find . -type f -name \*.h -print | xargs perl -pi -e 's/(\b)TRUE(\b)/$1true$2/g'
$ find . -type f -name \*.c -print | xargs perl -pi -e 's/(\b)FALSE(\b)/$1false$2/g'
$ find . -type f -name \*.c -print | xargs perl -pi -e 's/(\b)TRUE(\b)/$1true$2/g'
$ find . -type f -name \*.h -print | xargs perl -pi -e 's/(\b)False(\b)/$1false$2/g'
$ find . -type f -name \*.h -print | xargs perl -pi -e 's/(\b)True(\b)/$1true$2/g'
$ find . -type f -name \*.c -print | xargs perl -pi -e 's/(\b)False(\b)/$1false$2/g'
$ find . -type f -name \*.c -print | xargs perl -pi -e 's/(\b)True(\b)/$1true$2/g'

-Allen
York Sun Jan. 24, 2013, 6:49 p.m. UTC | #17
On 01/24/2013 10:28 AM, Allen Martin wrote:
> On Thu, Jan 24, 2013 at 10:23:21AM -0800, York Sun wrote:
>> On 01/24/2013 10:14 AM, Scott Wood wrote:
>>>>>
>>>>
>>>> I thought I have replaced all #define, enum, typedef. I have left alone
>>>> those FALSE, False, false but add define like this
>>>>
>>>> +#include <stdbool.h>
>>>> +#define TRUE true
>>>> +#define FALSE false
>>>> +#define True true
>>>> +#define False false
>>>>
>>>> Isn't that enough?
>>>
>>> It's enough to make it build, but it would be better to fix the users.
>>>
>>
>> Let me try to run a script to replace all of them to "false" and "true".
>>
>> York
>>
>>
> 
> Try this:
> 
> $ find . -type f -name \*.h -print | xargs perl -pi -e 's/(\b)FALSE(\b)/$1false$2/g'
> $ find . -type f -name \*.h -print | xargs perl -pi -e 's/(\b)TRUE(\b)/$1true$2/g'
> $ find . -type f -name \*.c -print | xargs perl -pi -e 's/(\b)FALSE(\b)/$1false$2/g'
> $ find . -type f -name \*.c -print | xargs perl -pi -e 's/(\b)TRUE(\b)/$1true$2/g'
> $ find . -type f -name \*.h -print | xargs perl -pi -e 's/(\b)False(\b)/$1false$2/g'
> $ find . -type f -name \*.h -print | xargs perl -pi -e 's/(\b)True(\b)/$1true$2/g'
> $ find . -type f -name \*.c -print | xargs perl -pi -e 's/(\b)False(\b)/$1false$2/g'
> $ find . -type f -name \*.c -print | xargs perl -pi -e 's/(\b)True(\b)/$1true$2/g'
> 

Thanks. I used xargs sed -i "s/\bTrue\b/true/g" following your git grep.

York
diff mbox

Patch

diff --git a/arch/arm/cpu/arm926ejs/spear/spear600.c b/arch/arm/cpu/arm926ejs/spear/spear600.c
index ff52131..ab9c6bd 100644
--- a/arch/arm/cpu/arm926ejs/spear/spear600.c
+++ b/arch/arm/cpu/arm926ejs/spear/spear600.c
@@ -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;
diff --git a/arch/blackfin/include/asm/posix_types.h b/arch/blackfin/include/asm/posix_types.h
index 000ffe5..1f28b36 100644
--- a/arch/blackfin/include/asm/posix_types.h
+++ b/arch/blackfin/include/asm/posix_types.h
@@ -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
diff --git a/arch/powerpc/cpu/ppc4xx/44x_spd_ddr.c b/arch/powerpc/cpu/ppc4xx/44x_spd_ddr.c
index 8a20a2b..7d151e1 100644
--- a/arch/powerpc/cpu/ppc4xx/44x_spd_ddr.c
+++ b/arch/powerpc/cpu/ppc4xx/44x_spd_ddr.c
@@ -88,8 +88,6 @@  void spd_ddr_init_hang (void) __attribute__((weak, alias("__spd_ddr_init_hang"))
 #define NUMMEMTESTS		8
 #define NUMMEMWORDS		8
 #define MAXBXCR			4
-#define TRUE			1
-#define FALSE			0
 
 /*
  * This DDR2 setup code can dynamically setup the TLB entries for the DDR2 memory
diff --git a/arch/powerpc/cpu/ppc4xx/44x_spd_ddr2.c b/arch/powerpc/cpu/ppc4xx/44x_spd_ddr2.c
index 85217ea..bd7e0ac 100644
--- a/arch/powerpc/cpu/ppc4xx/44x_spd_ddr2.c
+++ b/arch/powerpc/cpu/ppc4xx/44x_spd_ddr2.c
@@ -241,13 +241,6 @@  void board_add_ram_info(int use_default)
 /*-----------------------------------------------------------------------------+
  * Defines
  *-----------------------------------------------------------------------------*/
-#ifndef	TRUE
-#define TRUE		1
-#endif
-#ifndef FALSE
-#define FALSE		0
-#endif
-
 #define SDRAM_DDR1	1
 #define SDRAM_DDR2	2
 #define SDRAM_NONE	0
diff --git a/arch/powerpc/cpu/ppc4xx/denali_spd_ddr2.c b/arch/powerpc/cpu/ppc4xx/denali_spd_ddr2.c
index ce769a7..d841399 100644
--- a/arch/powerpc/cpu/ppc4xx/denali_spd_ddr2.c
+++ b/arch/powerpc/cpu/ppc4xx/denali_spd_ddr2.c
@@ -53,13 +53,6 @@ 
 /*-----------------------------------------------------------------------------+
  * Defines
  *-----------------------------------------------------------------------------*/
-#ifndef	TRUE
-#define TRUE		1
-#endif
-#ifndef FALSE
-#define FALSE		0
-#endif
-
 #define MAXDIMMS	2
 #define MAXRANKS	2
 
diff --git a/board/Marvell/db64360/mv_eth.h b/board/Marvell/db64360/mv_eth.h
index bd8e05d..d7de9d9 100644
--- a/board/Marvell/db64360/mv_eth.h
+++ b/board/Marvell/db64360/mv_eth.h
@@ -46,13 +46,6 @@ 
 **************************************************************************
 **************************************************************************
 *************************************************************************/
-#ifndef TRUE
-#define TRUE 1
-#endif
-#ifndef FALSE
-#define FALSE 0
-#endif
-
 /* In case not using SG on Tx, define MAX_SKB_FRAGS as 0 */
 #ifndef MAX_SKB_FRAGS
 #define MAX_SKB_FRAGS 0
diff --git a/board/Marvell/db64460/mv_eth.h b/board/Marvell/db64460/mv_eth.h
index af4e818..1107e95 100644
--- a/board/Marvell/db64460/mv_eth.h
+++ b/board/Marvell/db64460/mv_eth.h
@@ -47,13 +47,6 @@ 
 **************************************************************************
 **************************************************************************
 *************************************************************************/
-#ifndef TRUE
-#define TRUE 1
-#endif
-#ifndef FALSE
-#define FALSE 0
-#endif
-
 /* In case not using SG on Tx, define MAX_SKB_FRAGS as 0 */
 #ifndef MAX_SKB_FRAGS
 #define MAX_SKB_FRAGS 0
diff --git a/board/Marvell/include/core.h b/board/Marvell/include/core.h
index c413439..3119d0a 100644
--- a/board/Marvell/include/core.h
+++ b/board/Marvell/include/core.h
@@ -91,11 +91,6 @@  extern unsigned int INTERNAL_REG_BASE_ADDR;
 #define _1G		0x40000000
 #define _2G		0x80000000
 
-#ifndef	BOOL_WAS_DEFINED
-#define BOOL_WAS_DEFINED
-typedef enum _bool{false,true} bool;
-#endif
-
 /* Little to Big endian conversion macros */
 
 #ifdef LE /* Little Endian */
diff --git a/board/amcc/bamboo/bamboo.h b/board/amcc/bamboo/bamboo.h
index f2b78a9..6c49733 100644
--- a/board/amcc/bamboo/bamboo.h
+++ b/board/amcc/bamboo/bamboo.h
@@ -250,9 +250,6 @@ 
 #define	 PVR_POWERPC_440EP_PASS1    0x42221850
 #define	 PVR_POWERPC_440EP_PASS2    0x422218D3
 
-#define TRUE 1
-#define FALSE 0
-
 #define GPIO0		0
 #define GPIO1		1
 
diff --git a/board/amcc/yucca/yucca.c b/board/amcc/yucca/yucca.c
index 1fab794..f606d92 100644
--- a/board/amcc/yucca/yucca.c
+++ b/board/amcc/yucca/yucca.c
@@ -47,9 +47,6 @@  void fpga_init (void);
 #define DEBUGF(fmt,args...)
 #endif
 
-#define FALSE	0
-#define TRUE	1
-
 int board_early_init_f (void)
 {
 /*----------------------------------------------------------------------------+
diff --git a/board/bf533-ezkit/flash-defines.h b/board/bf533-ezkit/flash-defines.h
index eb0af94..f073c0c 100644
--- a/board/bf533-ezkit/flash-defines.h
+++ b/board/bf533-ezkit/flash-defines.h
@@ -32,8 +32,6 @@ 
 
 #define V_ULONG(a)		(*(volatile unsigned long *)( a ))
 #define V_BYTE(a)		(*(volatile unsigned char *)( a ))
-#define TRUE			0x1
-#define FALSE			0x0
 #define BUFFER_SIZE		0x80000
 #define NO_COMMAND		0
 #define GET_CODES		1
diff --git a/board/bf533-stamp/video.h b/board/bf533-stamp/video.h
index 80837e2..949c3d8 100644
--- a/board/bf533-stamp/video.h
+++ b/board/bf533-stamp/video.h
@@ -9,9 +9,6 @@ 
 #define YELLOW  (0xD292D210)	/* yellow pixel pattern  */
 #define WHITE   (0xFE80FE80)	/* white pixel pattern   */
 
-#define true	1
-#define false	0
-
 typedef struct {
 	unsigned int sav;
 	unsigned int eav;
diff --git a/board/esd/common/lcd.h b/board/esd/common/lcd.h
index 01f6019..5c48b5a 100644
--- a/board/esd/common/lcd.h
+++ b/board/esd/common/lcd.h
@@ -35,11 +35,6 @@ 
 #define LOAD_LONG(data)   SWAP_LONG(data)
 #define LOAD_SHORT(data)  SWAP_SHORT(data)
 
-#ifndef FALSE
-#define FALSE 0
-#define TRUE (!FALSE)
-#endif
-
 #define S1D_WRITE_PALETTE(p,i,r,g,b)					\
 	{								\
 		out_8(&((uchar*)(p))[palette_index], (uchar)(i));	\
diff --git a/board/esd/cpci750/mv_eth.h b/board/esd/cpci750/mv_eth.h
index 3d0cb10..94745bc 100644
--- a/board/esd/cpci750/mv_eth.h
+++ b/board/esd/cpci750/mv_eth.h
@@ -47,13 +47,6 @@ 
 **************************************************************************
 **************************************************************************
 *************************************************************************/
-#ifndef TRUE
-#define TRUE 1
-#endif
-#ifndef FALSE
-#define FALSE 0
-#endif
-
 /* In case not using SG on Tx, define MAX_SKB_FRAGS as 0 */
 #ifndef MAX_SKB_FRAGS
 #define MAX_SKB_FRAGS 0
diff --git a/board/esd/dasa_sim/cmd_dasa_sim.c b/board/esd/dasa_sim/cmd_dasa_sim.c
index 0014808..db65c23 100644
--- a/board/esd/dasa_sim/cmd_dasa_sim.c
+++ b/board/esd/dasa_sim/cmd_dasa_sim.c
@@ -30,10 +30,6 @@ 
 #define OK 0
 #define ERROR (-1)
 
-#define TRUE 1
-#define FALSE 0
-
-
 extern u_long pci9054_iobase;
 
 
diff --git a/board/evb64260/eth_addrtbl.c b/board/evb64260/eth_addrtbl.c
index e8ef0e3..02fc34d 100644
--- a/board/evb64260/eth_addrtbl.c
+++ b/board/evb64260/eth_addrtbl.c
@@ -6,9 +6,6 @@ 
 #include "eth.h"
 #include "eth_addrtbl.h"
 
-#define TRUE 1
-#define FALSE 0
-
 #define PRINTF printf
 
 #ifdef CONFIG_GT_USE_MAC_HASH_TABLE
diff --git a/board/mpl/common/isa.c b/board/mpl/common/isa.c
index fc56153..a97d6b3 100644
--- a/board/mpl/common/isa.c
+++ b/board/mpl/common/isa.c
@@ -41,13 +41,6 @@ 
 #define PRINTF(fmt,args...)
 #endif
 
-#ifndef	TRUE
-#define TRUE            1
-#endif
-#ifndef FALSE
-#define FALSE           0
-#endif
-
 #if defined(CONFIG_PIP405)
 
 extern int drv_isa_kbd_init (void);
diff --git a/board/mpl/mip405/mip405.c b/board/mpl/mip405/mip405.c
index 56a84e9..7c5c78c 100644
--- a/board/mpl/mip405/mip405.c
+++ b/board/mpl/mip405/mip405.c
@@ -77,8 +77,6 @@  DECLARE_GLOBAL_DATA_PTR;
 
 #undef SDRAM_DEBUG
 #define ENABLE_ECC /* for ecc boards */
-#define FALSE           0
-#define TRUE            1
 
 /* stdlib.h causes some compatibility problems; should fixe these! -- wd */
 #ifndef __ldiv_t_defined
diff --git a/board/mpl/pip405/pip405.c b/board/mpl/pip405/pip405.c
index 75f57ad..bf59e8b 100644
--- a/board/mpl/pip405/pip405.c
+++ b/board/mpl/pip405/pip405.c
@@ -36,9 +36,6 @@  DECLARE_GLOBAL_DATA_PTR;
 
 #undef SDRAM_DEBUG
 
-#define FALSE           0
-#define TRUE            1
-
 /* stdlib.h causes some compatibility problems; should fixe these! -- wd */
 #ifndef __ldiv_t_defined
 typedef struct {
diff --git a/board/prodrive/p3mx/mv_eth.h b/board/prodrive/p3mx/mv_eth.h
index 8cc00dc..58a8cb9 100644
--- a/board/prodrive/p3mx/mv_eth.h
+++ b/board/prodrive/p3mx/mv_eth.h
@@ -47,13 +47,6 @@ 
 **************************************************************************
 **************************************************************************
 *************************************************************************/
-#ifndef TRUE
-#define TRUE 1
-#endif
-#ifndef FALSE
-#define FALSE 0
-#endif
-
 /* In case not using SG on Tx, define MAX_SKB_FRAGS as 0 */
 #ifndef MAX_SKB_FRAGS
 #define MAX_SKB_FRAGS 0
diff --git a/board/sacsng/clkinit.h b/board/sacsng/clkinit.h
index 011638f..68d69db 100644
--- a/board/sacsng/clkinit.h
+++ b/board/sacsng/clkinit.h
@@ -22,11 +22,6 @@ 
  * MA 02111-1307 USA
  */
 
-#ifndef FALSE
-#define FALSE 0
-#define TRUE (!FALSE)
-#endif
-
 #define SLRCLK_EN_MASK  0x00040000 /* PA13 - SLRCLK_EN*     */
 
 #define MIN_SAMPLE_RATE       4000 /* Minimum sample rate */
diff --git a/board/xilinx/common/xbasic_types.h b/board/xilinx/common/xbasic_types.h
index ef0b7c2..a89fe02 100644
--- a/board/xilinx/common/xbasic_types.h
+++ b/board/xilinx/common/xbasic_types.h
@@ -68,14 +68,6 @@ 
 /***************************** Include Files *********************************/
 
 /************************** Constant Definitions *****************************/
-
-#ifndef TRUE
-#define TRUE 1
-#endif
-#ifndef FALSE
-#define FALSE 0
-#endif
-
 #ifndef NULL
 #define NULL 0
 #endif
diff --git a/common/cmd_fdc.c b/common/cmd_fdc.c
index 66e0ef0..c3afb16 100644
--- a/common/cmd_fdc.c
+++ b/common/cmd_fdc.c
@@ -39,13 +39,6 @@ 
 #define PRINTF(fmt,args...)
 #endif
 
-#ifndef	TRUE
-#define TRUE            1
-#endif
-#ifndef FALSE
-#define FALSE           0
-#endif
-
 /*#if defined(CONFIG_CMD_DATE) */
 /*#include <rtc.h> */
 /*#endif */
diff --git a/drivers/bios_emulator/atibios.c b/drivers/bios_emulator/atibios.c
index dbb5e8c..e373560 100644
--- a/drivers/bios_emulator/atibios.c
+++ b/drivers/bios_emulator/atibios.c
@@ -52,10 +52,6 @@ 
 /* Length of the BIOS image */
 #define MAX_BIOSLEN	    (128 * 1024L)
 
-/* Define some useful types and macros */
-#define true		    1
-#define false		    0
-
 /* Place to save PCI BAR's that we change and later restore */
 static u32 saveROMBaseAddress;
 static u32 saveBaseAddress10;
diff --git a/drivers/block/sata_dwc.h b/drivers/block/sata_dwc.h
index 204d644..e4e4ab1 100644
--- a/drivers/block/sata_dwc.h
+++ b/drivers/block/sata_dwc.h
@@ -467,11 +467,4 @@  struct ata_port {
 	unsigned char		*pdata;
 };
 
-#ifndef TRUE
-#define TRUE 1
-#endif
-#ifndef FALSE
-#define FALSE 0
-#endif
-
 #endif
diff --git a/drivers/mtd/nand/mxc_nand.c b/drivers/mtd/nand/mxc_nand.c
index d0ded48..04836c0 100644
--- a/drivers/mtd/nand/mxc_nand.c
+++ b/drivers/mtd/nand/mxc_nand.c
@@ -29,8 +29,6 @@ 
 
 #define DRIVER_NAME "mxc_nand"
 
-typedef enum {false, true} bool;
-
 struct mxc_nand_host {
 	struct mtd_info			mtd;
 	struct nand_chip		*nand;
diff --git a/drivers/net/armada100_fec.h b/drivers/net/armada100_fec.h
index e2df4fc..dcac964 100644
--- a/drivers/net/armada100_fec.h
+++ b/drivers/net/armada100_fec.h
@@ -29,13 +29,6 @@ 
 #ifndef __ARMADA100_FEC_H__
 #define __ARMADA100_FEC_H__
 
-#ifndef TRUE
-#define TRUE 1
-#endif
-#ifndef FALSE
-#define FALSE 0
-#endif
-
 #define PORT_NUM		0x0
 
 /* RX & TX descriptor command */
diff --git a/drivers/net/ne2000_base.h b/drivers/net/ne2000_base.h
index 5446de4..eee0956 100644
--- a/drivers/net/ne2000_base.h
+++ b/drivers/net/ne2000_base.h
@@ -79,10 +79,6 @@  are GPL, so this is, of course, GPL.
 #ifndef __NE2000_BASE_H__
 #define __NE2000_BASE_H__
 
-#define bool int
-#define false 0
-#define true 1
-
 /*
  * Debugging details
  *
diff --git a/drivers/net/npe/include/IxOsalTypes.h b/drivers/net/npe/include/IxOsalTypes.h
index a190a70..0168902 100644
--- a/drivers/net/npe/include/IxOsalTypes.h
+++ b/drivers/net/npe/include/IxOsalTypes.h
@@ -107,18 +107,10 @@  typedef volatile INT32 VINT32;
  */
 #define IX_OSAL_BILLION (1000000000)
 
-#ifndef TRUE
-#define TRUE       1L
-#endif
-
 #if TRUE != 1
 #error TRUE is not defined to 1
 #endif
 
-#ifndef FALSE
-#define FALSE      0L
-#endif
-
 #if FALSE != 0
 #error FALSE is not defined to 0
 #endif
diff --git a/drivers/rtc/ds1374.c b/drivers/rtc/ds1374.c
index d61a228..3cd4881 100644
--- a/drivers/rtc/ds1374.c
+++ b/drivers/rtc/ds1374.c
@@ -86,13 +86,6 @@ 
 
 typedef unsigned char boolean_t;
 
-#ifndef TRUE
-#define TRUE ((boolean_t)(0==0))
-#endif
-#ifndef FALSE
-#define FALSE (!TRUE)
-#endif
-
 const char RtcTodAddr[] = {
 	RTC_TOD_CNT_BYTE0_ADDR,
 	RTC_TOD_CNT_BYTE1_ADDR,
diff --git a/drivers/usb/musb-new/linux-compat.h b/drivers/usb/musb-new/linux-compat.h
index 5c126ef..72c8c2b 100644
--- a/drivers/usb/musb-new/linux-compat.h
+++ b/drivers/usb/musb-new/linux-compat.h
@@ -12,8 +12,6 @@ 
 #define __iomem
 #define __deprecated
 
-typedef enum { false = 0, true = 1 } bool;
-
 struct unused {};
 typedef struct unused unused_t;
 
diff --git a/fs/ext4/ext4_common.h b/fs/ext4/ext4_common.h
index 87cab16..72cd020 100644
--- a/fs/ext4/ext4_common.h
+++ b/fs/ext4/ext4_common.h
@@ -44,8 +44,6 @@ 
 
 #define YES		1
 #define NO		0
-#define TRUE		1
-#define FALSE		0
 #define RECOVER	1
 #define SCAN		0
 
diff --git a/include/at91rm9200_net.h b/include/at91rm9200_net.h
index f799206..804105f 100644
--- a/include/at91rm9200_net.h
+++ b/include/at91rm9200_net.h
@@ -23,10 +23,6 @@ 
 #include <asm/io.h>
 #include <asm/arch/hardware.h>
 
-#define FALSE 0
-#define TRUE 1
-
-
 #define ETHERNET_ADDRESS_SIZE           6
 
 typedef unsigned char UCHAR;
diff --git a/include/bedbug/ppc.h b/include/bedbug/ppc.h
index 46bf8db..76d86fd 100644
--- a/include/bedbug/ppc.h
+++ b/include/bedbug/ppc.h
@@ -296,11 +296,6 @@  struct operand {
 			   ((rc) & 0x1))
 #define MDS_MASK MDS_OPCODE(0x3f,0xf,0x1)
 
-#ifndef FALSE
-#define FALSE 0
-#define TRUE (!FALSE)
-#endif
-
 #define INSTRUCTION( memaddr ) ntohl(*(unsigned long *)(memaddr))
 
 #define MAX_OPERANDS  8
diff --git a/include/fpga.h b/include/fpga.h
index e0b1fe7..30a4e6a 100644
--- a/include/fpga.h
+++ b/include/fpga.h
@@ -31,14 +31,6 @@ 
 #define CONFIG_MAX_FPGA_DEVICES		5
 #endif
 
-/* these probably belong somewhere else */
-#ifndef FALSE
-#define FALSE			(0)
-#endif
-#ifndef TRUE
-#define TRUE			(!FALSE)
-#endif
-
 /* CONFIG_FPGA bit assignments */
 #define CONFIG_SYS_FPGA_MAN(x)		(x)
 #define CONFIG_SYS_FPGA_DEV(x)		((x) << 8 )
diff --git a/include/galileo/core.h b/include/galileo/core.h
index c277509..faf4962 100644
--- a/include/galileo/core.h
+++ b/include/galileo/core.h
@@ -110,11 +110,6 @@  extern unsigned int INTERNAL_REG_BASE_ADDR;
 #define _1G             0x40000000
 #define _2G             0x80000000
 
-#ifndef	BOOL_WAS_DEFINED
-#define BOOL_WAS_DEFINED
-typedef enum _bool{false,true} bool;
-#endif
-
 /* Little to Big endian conversion macros */
 
 #ifdef LE /* Little Endian */
diff --git a/include/linux/types.h b/include/linux/types.h
index 1b0b4a4..0063495 100644
--- a/include/linux/types.h
+++ b/include/linux/types.h
@@ -7,6 +7,11 @@ 
 
 #include <linux/posix_types.h>
 #include <asm/types.h>
+#include <stdbool.h>
+#define TRUE true
+#define FALSE false
+#define True true
+#define False false
 
 #ifndef __KERNEL_STRICT_NAMES
 
diff --git a/include/scsi.h b/include/scsi.h
index 9da764b..c764e15 100644
--- a/include/scsi.h
+++ b/include/scsi.h
@@ -204,12 +204,4 @@  int scsi_get_disk_count(void);
 
 #define SCSI_INT_STATE				 0x00010000  /* unknown Interrupt number is stored in 16 LSB */
 
-
-#ifndef TRUE
-#define TRUE 1
-#endif
-#ifndef FALSE
-#define FALSE 0
-#endif
-
 #endif /* _SCSI_H */
diff --git a/include/sym53c8xx.h b/include/sym53c8xx.h
index 7d3ded5..9696db0 100644
--- a/include/sym53c8xx.h
+++ b/include/sym53c8xx.h
@@ -568,11 +568,4 @@ 
 
 #define SCSI_IDENTIFY					0xC0
 
-#ifndef TRUE
-#define TRUE 1
-#endif
-#ifndef FALSE
-#define FALSE 0
-#endif
-
 #endif
diff --git a/include/xyzModem.h b/include/xyzModem.h
index f437bbd..a3ea768 100644
--- a/include/xyzModem.h
+++ b/include/xyzModem.h
@@ -97,14 +97,6 @@  typedef struct {
 #endif
 } connection_info_t;
 
-#ifndef	BOOL_WAS_DEFINED
-#define BOOL_WAS_DEFINED
-typedef unsigned int bool;
-#endif
-
-#define false 0
-#define true 1
-
 #endif
 
 
diff --git a/lib/bzlib_private.h b/lib/bzlib_private.h
index 87d8f94..e147b00 100644
--- a/lib/bzlib_private.h
+++ b/lib/bzlib_private.h
@@ -89,9 +89,6 @@  typedef unsigned int    UInt32;
 typedef short           Int16;
 typedef unsigned short  UInt16;
 
-#define True  ((Bool)1)
-#define False ((Bool)0)
-
 #ifndef __GNUC__
 #define __inline__  /* */
 #endif
diff --git a/lib/lzma/Types.h b/lib/lzma/Types.h
index 8afcba5..56feb3f 100644
--- a/lib/lzma/Types.h
+++ b/lib/lzma/Types.h
@@ -81,9 +81,6 @@  typedef size_t SizeT;
 #endif
 
 typedef int Bool;
-#define True 1
-#define False 0
-
 
 #ifdef _MSC_VER