2004-04-27 19:24:16

by Tom Rini

[permalink] [raw]
Subject: [PATCH] Fix thinkos in #if -> #ifdef conversions

<donning brown paper bag>
When I changed some '#if FOO' tests to '#ifdef FOO' I forgot to make
sure that nothing was doing #define FOO 0. So after auditing all of the
changes I made, the following is needed:

===== arch/ppc/4xx_io/serial_sicc.c 1.16 vs edited =====
--- 1.16/arch/ppc/4xx_io/serial_sicc.c Wed Apr 7 15:55:06 2004
+++ edited/arch/ppc/4xx_io/serial_sicc.c Tue Apr 27 12:17:52 2004
@@ -32,6 +32,7 @@

#include <linux/config.h>
#include <linux/module.h>
+#include <linux/kernel.h>
#include <linux/errno.h>
#include <linux/signal.h>
#include <linux/sched.h>
@@ -190,10 +191,6 @@
#define FALSE 0
#endif

-#define DEBUG 0
-
-
-
/*
* Things needed by tty driver
*/
@@ -763,9 +760,7 @@

cflag = info->tty->termios->c_cflag;

-#ifdef DEBUG
- printk("siccuart_set_cflag(0x%x) called\n", cflag);
-#endif
+ pr_debug("siccuart_set_cflag(0x%x) called\n", cflag);
/* byte size and parity */
switch (cflag & CSIZE) {
case CS7: lcr_h = _LCR_PE_DISABLE | _LCR_DB_7_BITS | _LCR_SB_1_BIT; bits = 9; break;
@@ -1027,9 +1022,7 @@
struct SICC_info *info = tty->driver_data;
unsigned long flags;

-#ifdef DEBUG
- printk("siccuart_flush_buffer(%d) called\n", tty->index);
-#endif
+ pr_debug("siccuart_flush_buffer(%d) called\n", tty->index);
save_flags(flags); cli();
info->xmit.head = info->xmit.tail = 0;
restore_flags(flags);
@@ -1433,9 +1426,7 @@

state = info->state;

-#ifdef DEBUG
- //printk("siccuart_close() called\n");
-#endif
+ //pr_debug("siccuart_close() called\n");

save_flags(flags); cli();

@@ -1544,11 +1535,9 @@
timeout = 2 * info->timeout;

expire = jiffies + timeout;
-#ifdef DEBUG
- printk("siccuart_wait_until_sent(%d), jiff=%lu, expire=%lu char_time=%lu...\n",
+ pr_debug("siccuart_wait_until_sent(%d), jiff=%lu, expire=%lu char_time=%lu...\n",
tty->index, jiffies,
expire, char_time);
-#endif
while ((readb(info->port->uart_base + BL_SICC_LSR) & _LSR_TX_ALL) != _LSR_TX_ALL) {
set_current_state(TASK_INTERRUPTIBLE);
schedule_timeout(char_time);
@@ -1831,9 +1820,8 @@
unsigned int status;
char *w;
int c;
-#ifdef DEBUG
- printk("siccuart_console_read() called\n");
-#endif
+
+ pr_debug("siccuart_console_read() called\n");

c = 0;
w = s;
===== arch/ppc/kernel/signal.c 1.31 vs edited =====
--- 1.31/arch/ppc/kernel/signal.c Wed Apr 7 15:55:06 2004
+++ edited/arch/ppc/kernel/signal.c Tue Apr 27 12:16:25 2004
@@ -33,7 +33,7 @@
#include <asm/pgtable.h>
#include <asm/cacheflush.h>

-#define DEBUG_SIG 0
+#undef DEBUG_SIG

#define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP)))


--
Tom Rini
http://gate.crashing.org/~trini/


2004-04-27 20:04:23

by Valdis Klētnieks

[permalink] [raw]
Subject: Re: [PATCH] Fix thinkos in #if -> #ifdef conversions

On Tue, 27 Apr 2004 12:24:09 PDT, Tom Rini <[email protected]> said:
> <donning brown paper bag>
> When I changed some '#if FOO' tests to '#ifdef FOO' I forgot to make
> sure that nothing was doing #define FOO 0. So after auditing all of the
> changes I made, the following is needed:

You're not the first to do that - I stayed away from preprocessor variables
other than CONFIG_* when I chunked through a big #if/#ifdef cleanup a few
months ago, simply because my poor brain was too tiny to figure out what was
intended.

Oddly enough, all the abuses I gave up on trying to figure out were
of the form '#if FOO_DEBUG > N', while the non-debugging comparisons
in a #if were all fairly clear. That says something about kernel programmers,
but I'm not sure what.. :)


Attachments:
(No filename) (226.00 B)

2004-04-27 20:03:43

by Tom Rini

[permalink] [raw]
Subject: Re: [PATCH] Fix thinkos in #if -> #ifdef conversions

On Tue, Apr 27, 2004 at 12:24:09PM -0700, Tom Rini wrote:

> <donning brown paper bag>

<crawling into a hole to hide>

And when trying to catch up on old patches, I forgot this hunk:
===== arch/ppc/platforms/prep_setup.c 1.44 vs edited =====
--- 1.44/arch/ppc/platforms/prep_setup.c Wed Apr 7 16:02:57 2004
+++ edited/arch/ppc/platforms/prep_setup.c Tue Apr 27 13:01:57 2004
@@ -134,6 +134,7 @@
#define PREP_IBM_CAROLINA_IDE_0 0xf0
#define PREP_IBM_CAROLINA_IDE_1 0xf1
#define PREP_IBM_CAROLINA_IDE_2 0xf2
+#define PREP_IBM_CAROLINA_IDE_3 0xf3
/* 7248-43P */
#define PREP_IBM_CAROLINA_SCSI_0 0xf4
#define PREP_IBM_CAROLINA_SCSI_1 0xf5

--
Tom Rini
http://gate.crashing.org/~trini/