Staging: android: alarm: Rename pr_alarm to alarm_dbg
authorJoe Perches <joe@perches.com>
Sun, 20 May 2012 21:06:36 +0000 (14:06 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 5 Jun 2012 04:04:32 +0000 (21:04 -0700)
Rename a macro to make it explicit it's for debugging.

Use %s: __func__ instead of embedding function names.
Coalesce formats, align arguments.

Signed-off-by: Joe Perches <joe@perches.com>
Acked-by: David Rientjes <rientjes@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/android/alarm-dev.c

index 53ce6ecf390a6f3f8bbdcf96df1c2fbf77202b78..32614d611283004fff211579a81bd0569fea977f 100644 (file)
 #define ANDROID_ALARM_PRINT_IO (1U << 1)
 #define ANDROID_ALARM_PRINT_INT (1U << 2)
 
-
 static int debug_mask = ANDROID_ALARM_PRINT_INFO;
 module_param_named(debug_mask, debug_mask, int, S_IRUGO | S_IWUSR | S_IWGRP);
 
-#define pr_alarm(debug_level_mask, args...) \
-       do { \
-               if (debug_mask & ANDROID_ALARM_PRINT_##debug_level_mask) { \
-                       pr_info(args); \
-               } \
-       } while (0)
+#define alarm_dbg(debug_level_mask, fmt, ...)                          \
+do {                                                                   \
+       if (debug_mask & ANDROID_ALARM_PRINT_##debug_level_mask)        \
+               pr_info(fmt, ##__VA_ARGS__);                            \
+} while (0)
 
 #define ANDROID_ALARM_WAKEUP_MASK ( \
        ANDROID_ALARM_RTC_WAKEUP_MASK | \
@@ -138,7 +136,7 @@ static long alarm_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
        switch (ANDROID_ALARM_BASE_CMD(cmd)) {
        case ANDROID_ALARM_CLEAR(0):
                spin_lock_irqsave(&alarm_slock, flags);
-               pr_alarm(IO, "alarm %d clear\n", alarm_type);
+               alarm_dbg(IO, "alarm %d clear\n", alarm_type);
                devalarm_try_to_cancel(&alarms[alarm_type]);
                if (alarm_pending) {
                        alarm_pending &= ~alarm_type_mask;
@@ -167,8 +165,9 @@ static long alarm_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
                }
 from_old_alarm_set:
                spin_lock_irqsave(&alarm_slock, flags);
-               pr_alarm(IO, "alarm %d set %ld.%09ld\n", alarm_type,
-                       new_alarm_time.tv_sec, new_alarm_time.tv_nsec);
+               alarm_dbg(IO, "alarm %d set %ld.%09ld\n",
+                         alarm_type,
+                         new_alarm_time.tv_sec, new_alarm_time.tv_nsec);
                alarm_enabled |= alarm_type_mask;
                devalarm_start(&alarms[alarm_type],
                        timespec_to_ktime(new_alarm_time));
@@ -179,7 +178,7 @@ from_old_alarm_set:
                /* fall though */
        case ANDROID_ALARM_WAIT:
                spin_lock_irqsave(&alarm_slock, flags);
-               pr_alarm(IO, "alarm wait\n");
+               alarm_dbg(IO, "alarm wait\n");
                if (!alarm_pending && wait_pending) {
                        __pm_relax(&alarm_wake_lock);
                        wait_pending = 0;
@@ -260,9 +259,10 @@ static int alarm_release(struct inode *inode, struct file *file)
                for (i = 0; i < ANDROID_ALARM_TYPE_COUNT; i++) {
                        uint32_t alarm_type_mask = 1U << i;
                        if (alarm_enabled & alarm_type_mask) {
-                               pr_alarm(INFO, "alarm_release: clear alarm, "
-                                       "pending %d\n",
-                                       !!(alarm_pending & alarm_type_mask));
+                               alarm_dbg(INFO,
+                                         "%s: clear alarm, pending %d\n",
+                                         __func__,
+                                         !!(alarm_pending & alarm_type_mask));
                                alarm_enabled &= ~alarm_type_mask;
                        }
                        spin_unlock_irqrestore(&alarm_slock, flags);
@@ -271,8 +271,8 @@ static int alarm_release(struct inode *inode, struct file *file)
                }
                if (alarm_pending | wait_pending) {
                        if (alarm_pending)
-                               pr_alarm(INFO, "alarm_release: clear "
-                                       "pending alarms %x\n", alarm_pending);
+                               alarm_dbg(INFO, "%s: clear pending alarms %x\n",
+                                         __func__, alarm_pending);
                        __pm_relax(&alarm_wake_lock);
                        wait_pending = 0;
                        alarm_pending = 0;
@@ -288,7 +288,7 @@ static void devalarm_triggered(struct devalarm *alarm)
        unsigned long flags;
        uint32_t alarm_type_mask = 1U << alarm->type;
 
-       pr_alarm(INT, "devalarm_triggered type %d\n", alarm->type);
+       alarm_dbg(INT, "%s: type %d\n", __func__, alarm->type);
        spin_lock_irqsave(&alarm_slock, flags);
        if (alarm_enabled & alarm_type_mask) {
                __pm_wakeup_event(&alarm_wake_lock, 5000); /* 5secs */