Reduced level of debug kprintf in NSLU2 modules.
authorJohn Bowler <jbowler@nslu2-linux.org>
Wed, 15 Jun 2005 14:23:52 +0000 (14:23 +0000)
committerJohn Bowler <jbowler@nslu2-linux.org>
Wed, 15 Jun 2005 14:23:52 +0000 (14:23 +0000)
BKrev: 42b039f8SBTG5tUgM-DpuMoIlZ11ag

packages/linux/openslug-kernel-2.6.11.2/nslu2-io.c
packages/linux/openslug-kernel-2.6.11.2/x1205-rtc.c
packages/linux/openslug-kernel_2.6.11.2.bb

index 7744821..a15a305 100644 (file)
 #include <asm-arm/delay.h>
 #include <asm-arm/signal.h>
 
+/* Set this to 1 to output lots of debug messages. */
+#if NSLU2_IO_DEBUG
+#define nslu2_io_debug(args) printk args
+#else
+#define nslu2_io_debug(args) ((void)0)
+#endif
 
 #define VERSION                        "0.1.7"
 
@@ -215,7 +221,7 @@ static void n2lm_d2_handler(unsigned long data)
 static void n2lm_timer_start(unsigned long led)
 {
 
-       printk(KERN_DEBUG "timer: %ld\n",led);
+       nslu2_io_debug((KERN_DEBUG "timer: %ld\n",led));
 
        switch(led) {
                case LED_RS_RED:
@@ -282,7 +288,7 @@ static void n2lm_timer_stop_all(void)
 static void n2lm_ledon(unsigned long led)
 {
 
-       printk(KERN_DEBUG "ledon: %ld\n", led);
+       nslu2_io_debug((KERN_DEBUG "ledon: %ld\n", led));
 
        switch (led) {
                case LED_RS_RED:        
@@ -333,7 +339,7 @@ static void n2lm_ledoff(unsigned long led)
 static int n2lm_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long led)
 {
 
-       printk(KERN_DEBUG "cmd=%d, led=%ld\n", cmd, led);
+       nslu2_io_debug((KERN_DEBUG "cmd=%d, led=%ld\n", cmd, led));
        
        if (led < 0 || led >= PHYS_LEDS)
                return -EINVAL;
@@ -421,7 +427,7 @@ static void n2bz_handler(unsigned long data)
                add_timer(&n2bz_timer);                                 //reinit timer
        }
        n2_buzz(tone/2, ontime);
-       printk(KERN_DEBUG "Count = %d\tOntime = %d\n", bz_repeatcnt, ontime);
+       nslu2_io_debug((KERN_DEBUG "Count = %d\tOntime = %d\n", bz_repeatcnt, ontime));
        return;
 }
 
@@ -498,7 +504,7 @@ static irqreturn_t n2pb_handler (int irq, void *dev_id, struct pt_regs *regs)
        remove_proc_entry(PWR_OFF_STR, NULL);           //no parent     
        n2_buzz(N2_BEEP_PITCH_MED, N2_BEEP_DUR_MED);
        ret = create_proc_entry(PWR_OFF_STR, 0, NULL);
-       printk(KERN_DEBUG "cpe ret = %p\n", ret);
+       nslu2_io_debug((KERN_DEBUG "cpe ret = %p\n", ret));
 
 // WARNING: This is RUDE...it unconditionally pulls the power plug.
 // Your data will be at risk...since this is just a test system
@@ -560,7 +566,7 @@ static irqreturn_t n2rb_handler (int irq, void *dev_id, struct pt_regs *regs)
                                 N2LM_ALL_ON,0
        };
 
-       printk("Reset Entry IRQ =%d Presses = %d Jiffies = %08lx\tIO = %x\tIOW = %x\n", irq, rb_presses, jiffies, (int)_IO('M',rb_presses), (int)_IOW('M',rb_presses,long));
+       nslu2_io_debug(("Reset Entry IRQ =%d Presses = %d Jiffies = %08lx\tIO = %x\tIOW = %x\n", irq, rb_presses, jiffies, (int)_IO('M',rb_presses), (int)_IOW('M',rb_presses,long)));
 
        wake_up(&n2rb_waitq);   
        while ((*IXP4XX_GPIO_GPINR & GPIO_RB_BM) == 0)
@@ -571,7 +577,7 @@ static irqreturn_t n2rb_handler (int irq, void *dev_id, struct pt_regs *regs)
        tone = (rb_presses * 50) + 200;
        ontime = (rb_presses*10) + 100;
        offtime = 500 - (rb_presses*20);
-       printk("Ontime = %d\tOfftime = %d\tTone = %d\n",ontime,offtime,tone);
+       nslu2_io_debug(("Ontime = %d\tOfftime = %d\tTone = %d\n",ontime,offtime,tone));
        rb_presses++;
 
        n2bz_ioctl(NULL,NULL, N2BZ_BEEPS, rb_presses);  
@@ -598,7 +604,7 @@ static irqreturn_t n2rb_handler (int irq, void *dev_id, struct pt_regs *regs)
 //             n2lm_timer_start(rb_presses);
 //     };
 
-       printk(KERN_DEBUG "Reset Exit IRQ=%d Presses= %d Jiffies= %08lx\n", irq, rb_presses, jiffies);
+       nslu2_io_debug((KERN_DEBUG "Reset Exit IRQ=%d Presses= %d Jiffies= %08lx\n", irq, rb_presses, jiffies));
        return IRQ_HANDLED;
 
 }
index acac095..9ef333b 100644 (file)
@@ -115,6 +115,12 @@ struct i2c_adapter {
 #endif
 
 #define                DEBUG                   KERN_DEBUG
+/* This, if defined to 1, turns on a lot of debugging meessages. */
+#if X1205_DEBUG
+#define x1205_debug(args) printk args
+#else
+#define x1205_debug(args) ((void)0)
+#endif
 
 
 static int x1205_get_datetime(struct i2c_client *client, struct rtc_time *tm, u8 reg_base);
@@ -183,8 +189,8 @@ static int x1205_get_datetime(struct i2c_client *client, struct rtc_time *tm, u8
        };
        addr[1] = reg_base;
        if ((i2c_transfer(client->adapter, msgs, 2)) == 2) {    //did we read 2 messages?
-               printk(KERN_DEBUG "raw x1205 read data  - sec-%02x min-%02x hr-%02x mday-%02x mon-%02x year-%02x wday-%02x y2k-%02x\n", 
-                       buf[0],buf[1],buf[2],buf[3],buf[4],buf[5],buf[6], buf[7]);
+               x1205_debug((KERN_DEBUG "raw x1205 read data  - sec-%02x min-%02x hr-%02x mday-%02x mon-%02x year-%02x wday-%02x y2k-%02x\n", 
+                       buf[0],buf[1],buf[2],buf[3],buf[4],buf[5],buf[6], buf[7]));
                tm->tm_sec  = BCD2BIN(buf[CCR_SEC]);
                tm->tm_min  = BCD2BIN(buf[CCR_MIN]);
                buf[CCR_HOUR] &= ~X1205_MILBIT;
@@ -194,8 +200,8 @@ static int x1205_get_datetime(struct i2c_client *client, struct rtc_time *tm, u8
                rtc_epoch   = BCD2BIN(buf[CCR_Y2K]) * 100;
                tm->tm_year = BCD2BIN(buf[CCR_YEAR]) + rtc_epoch - epoch;
                tm->tm_wday = buf[CCR_WDAY];
-               printk(KERN_DEBUG "rtc_time output data - sec-%02d min-%02d hr-%02d mday-%02d mon-%02d year-%02d wday-%02d epoch-%d rtc_epoch-%d\n",
-                       tm->tm_sec,tm->tm_min,tm->tm_hour,tm->tm_mday,tm->tm_mon,tm->tm_year,tm->tm_wday,epoch, rtc_epoch);
+               x1205_debug((KERN_DEBUG "rtc_time output data - sec-%02d min-%02d hr-%02d mday-%02d mon-%02d year-%02d wday-%02d epoch-%d rtc_epoch-%d\n",
+                       tm->tm_sec,tm->tm_min,tm->tm_hour,tm->tm_mday,tm->tm_mon,tm->tm_year,tm->tm_wday,epoch, rtc_epoch));
        } else {
                printk(KERN_DEBUG "i2c_transfer Read Error\n");
                return -EIO;
@@ -238,10 +244,10 @@ static int x1205_set_datetime(struct i2c_client *client, struct rtc_time *tm, in
                buf[CCR_Y2K+2]   = BIN2BCD((rtc_epoch/100));
                msgs[2].len += 5;                               //5 more bytes to set date
        }
-       printk(KERN_DEBUG "rtc_time input - sec-%02d min-%02d hour-%02d mday-%02d mon-%02d year-%02d wday-%02d epoch-%d rtc_epoch-%d\n",
-               tm->tm_sec,tm->tm_min,tm->tm_hour,tm->tm_mday,tm->tm_mon,tm->tm_year,tm->tm_wday, epoch, rtc_epoch);
-       printk(KERN_DEBUG "BCD write data - sec-%02x min-%02x hour-%02x mday-%02x mon-%02x year-%02x wday-%02x y2k-%02x\n",
-               buf[2],buf[3],buf[4],buf[5],buf[6], buf[7], buf[8], buf[9]);
+       x1205_debug((KERN_DEBUG "rtc_time input - sec-%02d min-%02d hour-%02d mday-%02d mon-%02d year-%02d wday-%02d epoch-%d rtc_epoch-%d\n",
+               tm->tm_sec,tm->tm_min,tm->tm_hour,tm->tm_mday,tm->tm_mon,tm->tm_year,tm->tm_wday, epoch, rtc_epoch));
+       x1205_debug((KERN_DEBUG "BCD write data - sec-%02x min-%02x hour-%02x mday-%02x mon-%02x year-%02x wday-%02x y2k-%02x\n",
+               buf[2],buf[3],buf[4],buf[5],buf[6], buf[7], buf[8], buf[9]));
 
        if ((i2c_transfer(client->adapter, msgs, 4)) != 4)
                return -EIO;
@@ -265,16 +271,16 @@ static int x1205_set_datetime(struct i2c_client *client, struct rtc_time *tm, in
                buf[CCR_Y2K]   = BIN2BCD((rtc_epoch/100));
                count = CCR_Y2K+1;
        }
-       printk(KERN_DEBUG "rtc_time input - sec-%02d min-%02d hour-%02d mday-%02d mon-%02d year-%02d wday-%02d epoch-%d rtc_epoch-%d\n",
-               tm->tm_sec,tm->tm_min,tm->tm_hour,tm->tm_mday,tm->tm_mon,tm->tm_year,tm->tm_wday, epoch, rtc_epoch);
+       x1205_debug((KERN_DEBUG "rtc_time input - sec-%02d min-%02d hour-%02d mday-%02d mon-%02d year-%02d wday-%02d epoch-%d rtc_epoch-%d\n",
+               tm->tm_sec,tm->tm_min,tm->tm_hour,tm->tm_mday,tm->tm_mon,tm->tm_year,tm->tm_wday, epoch, rtc_epoch));
 
        xfer = i2c_master_send(client, wel, 3);
-       printk(KERN_DEBUG "wen - %x\n", xfer);
+       x1205_debug((KERN_DEBUG "wen - %x\n", xfer));
        if (xfer != 3)
                return -EIO;
 
        xfer = i2c_master_send(client, rwel, 3);
-       printk(KERN_DEBUG "wenb - %x\n", xfer);
+       x1205_debug((KERN_DEBUG "wenb - %x\n", xfer));
        if (xfer != 3)
                return -EIO;
 
@@ -282,13 +288,13 @@ static int x1205_set_datetime(struct i2c_client *client, struct rtc_time *tm, in
                data[1] = i + reg_base;
                data[2] =  buf[i];
                xfer = i2c_master_send(client, data, 3);
-               printk(KERN_DEBUG "xfer - %d addr - %02x  data - %02x\n", xfer, data[1], data[2]);
+               x1205_debug((KERN_DEBUG "xfer - %d addr - %02x  data - %02x\n", xfer, data[1], data[2]));
                if (xfer != 3)
                        return -EIO;
        };
 
        xfer = i2c_master_send(client, diswe, 3);
-       printk(KERN_DEBUG "wdis - %x\n", xfer);
+       x1205_debug((KERN_DEBUG "wdis - %x\n", xfer));
        if (xfer != 3)
                return -EIO;
        return NOERR;
@@ -393,7 +399,7 @@ static int x1205_command(struct i2c_client *client, unsigned int cmd, void *tm)
        if (!capable(CAP_SYS_TIME))
                return -EACCES;
 
-       printk(KERN_DEBUG "x1205_command %d\n", cmd);
+       x1205_debug((KERN_DEBUG "x1205_command %d\n", cmd));
 
        switch (cmd) {
        case RTC_GETDATETIME:
@@ -425,7 +431,7 @@ static int x1205_sync_rtc(void)
        time_t new_s, old_s, div, rem;
        unsigned int cmd;
 
-       printk(KERN_DEBUG "x1205_sync_rtc entry\n");
+       x1205_debug((KERN_DEBUG "x1205_sync_rtc entry\n"));
 
        {
                int err = x1205_command(&x1205_i2c_client, RTC_GETDATETIME, &tm);
@@ -443,7 +449,7 @@ static int x1205_sync_rtc(void)
         * to reset it if it is within 1s of now.
         */
        if (old_s - 1 <= new_s && new_s <= old_s + 1) {
-               printk(KERN_DEBUG "x1205_sync_rtc exit (RTC in sync)\n");
+               x1205_debug((KERN_DEBUG "x1205_sync_rtc exit (RTC in sync)\n"));
                return NOERR;
        }
 
@@ -555,7 +561,7 @@ static int x1205_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
        struct rtc_time tm;
        int errno;
 
-       printk(KERN_DEBUG "ioctl = %x\n", cmd);
+       x1205_debug((KERN_DEBUG "ioctl = %x\n", cmd));
        
        switch (cmd) {
        case RTC_RD_TIME:
@@ -615,8 +621,8 @@ static int x1205_read_proc(char *buf, char **start, off_t off, int len, int *eof
 //     here we return the real year and the month as 1-12 since it is human-readable
        slen = sprintf(buf, "rtc_time\t: %02d:%02d:%02d\nrtc_date\t: %04d-%02d-%02d\n",
                tm.tm_hour, tm.tm_min, tm.tm_sec, tm.tm_year + 1900, tm.tm_mon+1, tm.tm_mday);
-       printk(KERN_DEBUG "raw rtc_time\t: %02d:%02d:%02d\nraw rtc_date\t: %04d-%02d-%02d\n",
-               tm.tm_hour, tm.tm_min, tm.tm_sec, tm.tm_year, tm.tm_mon, tm.tm_mday);
+       x1205_debug((KERN_DEBUG "raw rtc_time\t: %02d:%02d:%02d\nraw rtc_date\t: %04d-%02d-%02d\n",
+               tm.tm_hour, tm.tm_min, tm.tm_sec, tm.tm_year, tm.tm_mon, tm.tm_mday));
 
        if (slen <= off + len)
                *eof = 1;
index c77c5ce..b604e27 100644 (file)
@@ -2,7 +2,7 @@ SECTION = "kernel"
 DESCRIPTION = "Linux kernel for the Linksys NSLU2 device"
 LICENSE = "GPL"
 MAINTAINER = "Chris Larson <kergoth@handhelds.org>"
-PR = "r10"
+PR = "r11"
 
 KERNEL_SUFFIX = "openslug"