Introduce the TRUE and FALSE boolean macros so that everyone can
stop re-inventing them, and remove the one occurrence in the source
tree that clashes with that change.
Signed-off-by: Robert P. J. Day <[email protected]>
---
once this patch is applied, others can remove all of the superfluous
macro definitions from the source tree at their convenience.
this was compile tested on x86 with "make allyesconfig".
drivers/net/wireless/strip.c | 2 --
include/linux/types.h | 2 ++
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/wireless/strip.c b/drivers/net/wireless/strip.c
index ce3a8ba..5e64ec1 100644
--- a/drivers/net/wireless/strip.c
+++ b/drivers/net/wireless/strip.c
@@ -177,8 +177,6 @@ typedef struct {
MetricomNode node[NODE_TABLE_SIZE];
} MetricomNodeTable;
-enum { FALSE = 0, TRUE = 1 };
-
/*
* Holds the radio's firmware version.
*/
diff --git a/include/linux/types.h b/include/linux/types.h
index 0351bf2..d988636 100644
--- a/include/linux/types.h
+++ b/include/linux/types.h
@@ -34,6 +34,8 @@ typedef __kernel_mqd_t mqd_t;
#ifdef __KERNEL__
typedef _Bool bool;
+#define TRUE 1
+#define FALSE 0
typedef __kernel_uid32_t uid_t;
typedef __kernel_gid32_t gid_t;
On Sun, 2007-01-21 at 05:03 -0500, Robert P. J. Day wrote:
> Introduce the TRUE and FALSE boolean macros so that everyone can
> stop re-inventing them, and remove the one occurrence in the source
> tree that clashes with that change.
>
If you're going to introduce true and false macros, you should probably
use the official all-lowercase C99 version.
--
Nicholas Miell <[email protected]>
Nicholas Miell wrote:
> On Sun, 2007-01-21 at 05:03 -0500, Robert P. J. Day wrote:
>
>> Introduce the TRUE and FALSE boolean macros so that everyone can
>> stop re-inventing them, and remove the one occurrence in the source
>> tree that clashes with that change.
>>
>>
>
> If you're going to introduce true and false macros, you should probably
> use the official all-lowercase C99 version.
>
It is already in there (see include/linux/stddef.h). These are just to
get rid of the defines of FALSE/TRUE all over the tree.
Not sure why, thou...
On Sun, 21 Jan 2007, Nicholas Miell wrote:
> On Sun, 2007-01-21 at 05:03 -0500, Robert P. J. Day wrote:
> > Introduce the TRUE and FALSE boolean macros so that everyone can
> > stop re-inventing them, and remove the one occurrence in the
> > source tree that clashes with that change.
> If you're going to introduce true and false macros, you should
> probably use the official all-lowercase C99 version.
i'm going to try this one more time, and see if i can get my point
across. *yes*, the *eventual* goal should be to use the official
all-lowercase C99 versions of "true" and "false", and the patch i
proposed is, in fact, the first step in getting there.
by adding (temporarily) the definitions of TRUE and FALSE to types.h,
you should then (theoretically) be able to delete over 100 instances
of those same macros being *defined* throughout the source tree.
you're not going to be deleting the hundreds and hundreds of *uses* of
TRUE and FALSE (not yet, anyway) but, at the very least, by adding two
lines to types.h, you can delete all those redundant *definitions* and
make sure that nothing breaks. (it shouldn't, of course, but it's
always nice to be sure.)
*now*, once that's done, you can start going through the tree and
doing the conversion from upper case to lower case, little by little,
subsystem by subsystem.
the predictable response will be, "you really should do that all at
once." that's not going to happen, and you know it, and i know it.
that kind of change would be too big, and too disruptive. so why not
just add two macro defines, then delete over 100 lines of what are now
redundant definitions, make sure nothing breaks, then move on to phase
two.
do we understand one another now?
rday
Robert P. J. Day wrote:
> by adding (temporarily) the definitions of TRUE and FALSE to types.h,
> you should then (theoretically) be able to delete over 100 instances
> of those same macros being *defined* throughout the source tree.
> you're not going to be deleting the hundreds and hundreds of *uses* of
> TRUE and FALSE (not yet, anyway) but, at the very least, by adding two
> lines to types.h, you can delete all those redundant *definitions* and
> make sure that nothing breaks. (it shouldn't, of course, but it's
> always nice to be sure.)
Doesn't seem very worthwhile, and it legitimises this definition we're
trying to get rid of.
> *now*, once that's done, you can start going through the tree and
> doing the conversion from upper case to lower case, little by little,
> subsystem by subsystem.
I don't see why your patch is needed before the individual conversions?
> the predictable response will be, "you really should do that all at
> once."
You don't need to do it all at once.
--
SUSE Labs, Novell Inc.
Send instant messages to your online friends http://au.messenger.yahoo.com
On Mon, 22 Jan 2007, Nick Piggin wrote:
> Robert P. J. Day wrote:
>
> > by adding (temporarily) the definitions of TRUE and FALSE to
> > types.h, you should then (theoretically) be able to delete over
> > 100 instances of those same macros being *defined* throughout the
> > source tree. you're not going to be deleting the hundreds and
> > hundreds of *uses* of TRUE and FALSE (not yet, anyway) but, at the
> > very least, by adding two lines to types.h, you can delete all
> > those redundant *definitions* and make sure that nothing breaks.
> > (it shouldn't, of course, but it's always nice to be sure.)
>
> Doesn't seem very worthwhile, and it legitimises this definition
> we're trying to get rid of.
hmmmmmmmm ... apparently, you totally missed my use of the important
word "temporarily":
$ grep -r "temporary hack" . | wc -l
16
rday
Robert P. J. Day wrote:
> On Mon, 22 Jan 2007, Nick Piggin wrote:
>
>
>>Robert P. J. Day wrote:
>>
>>
>>>by adding (temporarily) the definitions of TRUE and FALSE to
>>>types.h, you should then (theoretically) be able to delete over
>>>100 instances of those same macros being *defined* throughout the
>>>source tree. you're not going to be deleting the hundreds and
>>>hundreds of *uses* of TRUE and FALSE (not yet, anyway) but, at the
>>>very least, by adding two lines to types.h, you can delete all
>>>those redundant *definitions* and make sure that nothing breaks.
>>>(it shouldn't, of course, but it's always nice to be sure.)
>>
>>Doesn't seem very worthwhile, and it legitimises this definition
>>we're trying to get rid of.
>
>
> hmmmmmmmm ... apparently, you totally missed my use of the important
> word "temporarily":
No, I didn't.
--
SUSE Labs, Novell Inc.
Send instant messages to your online friends http://au.messenger.yahoo.com
On Mon, 2007-01-22 at 06:02 -0500, Robert P. J. Day wrote:
> On Mon, 22 Jan 2007, Nick Piggin wrote:
>
> > Robert P. J. Day wrote:
> >
> > > by adding (temporarily) the definitions of TRUE and FALSE to
> > > types.h, you should then (theoretically) be able to delete over
> > > 100 instances of those same macros being *defined* throughout the
> > > source tree. you're not going to be deleting the hundreds and
> > > hundreds of *uses* of TRUE and FALSE (not yet, anyway) but, at the
> > > very least, by adding two lines to types.h, you can delete all
> > > those redundant *definitions* and make sure that nothing breaks.
> > > (it shouldn't, of course, but it's always nice to be sure.)
> >
> > Doesn't seem very worthwhile, and it legitimises this definition
> > we're trying to get rid of.
>
> hmmmmmmmm ... apparently, you totally missed my use of the important
> word "temporarily":
>
> $ grep -r "temporary hack" . | wc -l
> 16
That's a pretty good argument _against_ adding another one :) I wonder
how old those "temporary hacks" are (the ones you missed as well).
To make TRUE/FALSE go away, you or someone will have to visit them all,
which will take time. Why add an intermediate step where you or others
can end up getting interrupted (indefinitely), leaving the "temporary"
definition lying around for folks to use?
-Mike
On Mon, 22 Jan 2007, Mike Galbraith wrote:
> On Mon, 2007-01-22 at 06:02 -0500, Robert P. J. Day wrote:
> > On Mon, 22 Jan 2007, Nick Piggin wrote:
> >
> > > Robert P. J. Day wrote:
> > >
> > > > by adding (temporarily) the definitions of TRUE and FALSE to
> > > > types.h, you should then (theoretically) be able to delete over
> > > > 100 instances of those same macros being *defined* throughout the
> > > > source tree. you're not going to be deleting the hundreds and
> > > > hundreds of *uses* of TRUE and FALSE (not yet, anyway) but, at the
> > > > very least, by adding two lines to types.h, you can delete all
> > > > those redundant *definitions* and make sure that nothing breaks.
> > > > (it shouldn't, of course, but it's always nice to be sure.)
> > >
> > > Doesn't seem very worthwhile, and it legitimises this definition
> > > we're trying to get rid of.
> >
> > hmmmmmmmm ... apparently, you totally missed my use of the important
> > word "temporarily":
> >
> > $ grep -r "temporary hack" . | wc -l
> > 16
>
> That's a pretty good argument _against_ adding another one :) I
> wonder how old those "temporary hacks" are (the ones you missed as
> well).
>
> To make TRUE/FALSE go away, you or someone will have to visit them
> all, which will take time. Why add an intermediate step where you
> or others can end up getting interrupted (indefinitely), leaving the
> "temporary" definition lying around for folks to use?
as opposed to the 100+ *other* definitions currently cluttering up the
tree, which this patch would allow to be deleted *immediately*.
forget it. i can see this argument is going nowhere and that, six
months from now, some poor sucker is going to post, asking, "hey, you
know all these TRUE/FALSE things? wouldn't it be great if we could,
you know, clean those up? whaddya say?"
and groundhog day will begin all over again ...
rday
On Jan 22 2007 10:41, Robert P. J. Day wrote:
>
>as opposed to the 100+ *other* definitions currently cluttering up the
>tree, which this patch would allow to be deleted *immediately*.
>
>forget it. i can see this argument is going nowhere and that, six
>months from now, some poor sucker is going to post, asking, "hey, you
>know all these TRUE/FALSE things? wouldn't it be great if we could,
>you know, clean those up? whaddya say?"
>
>and groundhog day will begin all over again ...
I don't get it why it's so hard to do (b) over (a)
(a) remove all TRUE/FALSE and add TRUE/FALSE to linux/types.h
as per http://lkml.org/lkml/2007/1/21/19
(b) see below
Signed-off-by: Jan Engelhardt <[email protected]>
Index: linux-2.6.20-rc5/drivers/net/wireless/strip.c
===================================================================
--- linux-2.6.20-rc5.orig/drivers/net/wireless/strip.c
+++ linux-2.6.20-rc5/drivers/net/wireless/strip.c
@@ -177,8 +177,6 @@ typedef struct {
MetricomNode node[NODE_TABLE_SIZE];
} MetricomNodeTable;
-enum { FALSE = 0, TRUE = 1 };
-
/*
* Holds the radio's firmware version.
*/
@@ -1209,7 +1207,7 @@ static void ResetRadio(struct strip *str
if (!strip_info->manual_dev_addr)
*(MetricomAddress *) strip_info->dev->dev_addr =
zero_address;
- strip_info->working = FALSE;
+ strip_info->working = false;
strip_info->firmware_level = NoStructure;
strip_info->next_command = CompatibilityCommand;
strip_info->watchdog_doprobe = jiffies + 10 * HZ;
@@ -1845,7 +1843,7 @@ static void RecvErr_Message(struct strip
}
#endif
if (!strip_info->working) {
- strip_info->working = TRUE;
+ strip_info->working = true;
printk(KERN_INFO "%s: Radio now in starmode\n",
strip_info->dev->name);
/*
@@ -2455,7 +2453,7 @@ static int strip_open_low(struct net_dev
strip_info->tx_left = 0;
strip_info->discard = 0;
- strip_info->working = FALSE;
+ strip_info->working = false;
strip_info->firmware_level = NoStructure;
strip_info->next_command = CompatibilityCommand;
strip_info->user_baud = get_baud(strip_info->tty);
#<EOF>
-`J'
--