Merge branch 'late/cleanup' into devel-late
[firefly-linux-kernel-4.4.55.git] / drivers / watchdog / wdrtas.c
index 94ec22b9e66bda7db6f96ace71df36afe6f35f9f..0a77655cda60d6341f379d674b48bce17e6166c3 100644 (file)
@@ -26,6 +26,8 @@
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
 #include <linux/fs.h>
 #include <linux/init.h>
 #include <linux/kernel.h>
@@ -49,7 +51,7 @@ MODULE_LICENSE("GPL");
 MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR);
 MODULE_ALIAS_MISCDEV(TEMP_MINOR);
 
-static int wdrtas_nowayout = WATCHDOG_NOWAYOUT;
+static bool wdrtas_nowayout = WATCHDOG_NOWAYOUT;
 static atomic_t wdrtas_miscdev_open = ATOMIC_INIT(0);
 static char wdrtas_expect_close;
 
@@ -93,8 +95,8 @@ static int wdrtas_set_interval(int interval)
        result = rtas_call(wdrtas_token_set_indicator, 3, 1, NULL,
                           WDRTAS_SURVEILLANCE_IND, 0, interval);
        if (result < 0 && print_msg) {
-               printk(KERN_ERR "wdrtas: setting the watchdog to %i "
-                      "timeout failed: %li\n", interval, result);
+               pr_err("setting the watchdog to %i timeout failed: %li\n",
+                      interval, result);
                print_msg--;
        }
 
@@ -128,8 +130,8 @@ static int wdrtas_get_interval(int fallback_value)
        spin_unlock(&rtas_data_buf_lock);
 
        if (value[0] != 0 || value[1] != 2 || value[3] != 0 || result < 0) {
-               printk(KERN_WARNING "wdrtas: could not get sp_spi watchdog "
-                      "timeout (%li). Continuing\n", result);
+               pr_warn("could not get sp_spi watchdog timeout (%li). Continuing\n",
+                       result);
                return fallback_value;
        }
 
@@ -170,18 +172,18 @@ static void wdrtas_log_scanned_event(void)
        int i;
 
        for (i = 0; i < WDRTAS_LOGBUFFER_LEN; i += 16)
-               printk(KERN_INFO "wdrtas: dumping event (line %i/%i), data = "
-                      "%02x %02x %02x %02x  %02x %02x %02x %02x   "
-                      "%02x %02x %02x %02x  %02x %02x %02x %02x\n",
-                      (i / 16) + 1, (WDRTAS_LOGBUFFER_LEN / 16),
-                      wdrtas_logbuffer[i + 0], wdrtas_logbuffer[i + 1],
-                      wdrtas_logbuffer[i + 2], wdrtas_logbuffer[i + 3],
-                      wdrtas_logbuffer[i + 4], wdrtas_logbuffer[i + 5],
-                      wdrtas_logbuffer[i + 6], wdrtas_logbuffer[i + 7],
-                      wdrtas_logbuffer[i + 8], wdrtas_logbuffer[i + 9],
-                      wdrtas_logbuffer[i + 10], wdrtas_logbuffer[i + 11],
-                      wdrtas_logbuffer[i + 12], wdrtas_logbuffer[i + 13],
-                      wdrtas_logbuffer[i + 14], wdrtas_logbuffer[i + 15]);
+               pr_info("dumping event (line %i/%i), data = "
+                       "%02x %02x %02x %02x  %02x %02x %02x %02x   "
+                       "%02x %02x %02x %02x  %02x %02x %02x %02x\n",
+                       (i / 16) + 1, (WDRTAS_LOGBUFFER_LEN / 16),
+                       wdrtas_logbuffer[i + 0], wdrtas_logbuffer[i + 1],
+                       wdrtas_logbuffer[i + 2], wdrtas_logbuffer[i + 3],
+                       wdrtas_logbuffer[i + 4], wdrtas_logbuffer[i + 5],
+                       wdrtas_logbuffer[i + 6], wdrtas_logbuffer[i + 7],
+                       wdrtas_logbuffer[i + 8], wdrtas_logbuffer[i + 9],
+                       wdrtas_logbuffer[i + 10], wdrtas_logbuffer[i + 11],
+                       wdrtas_logbuffer[i + 12], wdrtas_logbuffer[i + 13],
+                       wdrtas_logbuffer[i + 14], wdrtas_logbuffer[i + 15]);
 }
 
 /**
@@ -201,8 +203,7 @@ static void wdrtas_timer_keepalive(void)
                                   (void *)__pa(wdrtas_logbuffer),
                                   WDRTAS_LOGBUFFER_LEN);
                if (result < 0)
-                       printk(KERN_ERR "wdrtas: event-scan failed: %li\n",
-                              result);
+                       pr_err("event-scan failed: %li\n", result);
                if (result == 0)
                        wdrtas_log_scanned_event();
        } while (result == 0);
@@ -224,8 +225,7 @@ static int wdrtas_get_temperature(void)
        result = rtas_get_sensor(WDRTAS_THERMAL_SENSOR, 0, &temperature);
 
        if (result < 0)
-               printk(KERN_WARNING "wdrtas: reading the thermal sensor "
-                      "failed: %i\n", result);
+               pr_warn("reading the thermal sensor failed: %i\n", result);
        else
                temperature = ((temperature * 9) / 5) + 32; /* fahrenheit */
 
@@ -419,8 +419,7 @@ static int wdrtas_close(struct inode *inode, struct file *file)
        if (wdrtas_expect_close == WDRTAS_MAGIC_CHAR)
                wdrtas_timer_stop();
        else {
-               printk(KERN_WARNING "wdrtas: got unexpected close. Watchdog "
-                      "not stopped.\n");
+               pr_warn("got unexpected close. Watchdog not stopped.\n");
                wdrtas_timer_keepalive();
        }
 
@@ -552,30 +551,24 @@ static int wdrtas_get_tokens(void)
 {
        wdrtas_token_get_sensor_state = rtas_token("get-sensor-state");
        if (wdrtas_token_get_sensor_state == RTAS_UNKNOWN_SERVICE) {
-               printk(KERN_WARNING "wdrtas: couldn't get token for "
-                      "get-sensor-state. Trying to continue without "
-                      "temperature support.\n");
+               pr_warn("couldn't get token for get-sensor-state. Trying to continue without temperature support.\n");
        }
 
        wdrtas_token_get_sp = rtas_token("ibm,get-system-parameter");
        if (wdrtas_token_get_sp == RTAS_UNKNOWN_SERVICE) {
-               printk(KERN_WARNING "wdrtas: couldn't get token for "
-                      "ibm,get-system-parameter. Trying to continue with "
-                      "a default timeout value of %i seconds.\n",
-                      WDRTAS_DEFAULT_INTERVAL);
+               pr_warn("couldn't get token for ibm,get-system-parameter. Trying to continue with a default timeout value of %i seconds.\n",
+                       WDRTAS_DEFAULT_INTERVAL);
        }
 
        wdrtas_token_set_indicator = rtas_token("set-indicator");
        if (wdrtas_token_set_indicator == RTAS_UNKNOWN_SERVICE) {
-               printk(KERN_ERR "wdrtas: couldn't get token for "
-                      "set-indicator. Terminating watchdog code.\n");
+               pr_err("couldn't get token for set-indicator. Terminating watchdog code.\n");
                return -EIO;
        }
 
        wdrtas_token_event_scan = rtas_token("event-scan");
        if (wdrtas_token_event_scan == RTAS_UNKNOWN_SERVICE) {
-               printk(KERN_ERR "wdrtas: couldn't get token for event-scan. "
-                      "Terminating watchdog code.\n");
+               pr_err("couldn't get token for event-scan. Terminating watchdog code.\n");
                return -EIO;
        }
 
@@ -609,17 +602,14 @@ static int wdrtas_register_devs(void)
 
        result = misc_register(&wdrtas_miscdev);
        if (result) {
-               printk(KERN_ERR "wdrtas: couldn't register watchdog misc "
-                      "device. Terminating watchdog code.\n");
+               pr_err("couldn't register watchdog misc device. Terminating watchdog code.\n");
                return result;
        }
 
        if (wdrtas_token_get_sensor_state != RTAS_UNKNOWN_SERVICE) {
                result = misc_register(&wdrtas_tempdev);
                if (result) {
-                       printk(KERN_WARNING "wdrtas: couldn't register "
-                              "watchdog temperature misc device. Continuing "
-                              "without temperature support.\n");
+                       pr_warn("couldn't register watchdog temperature misc device. Continuing without temperature support.\n");
                        wdrtas_token_get_sensor_state = RTAS_UNKNOWN_SERVICE;
                }
        }
@@ -643,8 +633,7 @@ static int __init wdrtas_init(void)
                return -ENODEV;
 
        if (register_reboot_notifier(&wdrtas_notifier)) {
-               printk(KERN_ERR "wdrtas: could not register reboot notifier. "
-                      "Terminating watchdog code.\n");
+               pr_err("could not register reboot notifier. Terminating watchdog code.\n");
                wdrtas_unregister_devs();
                return -ENODEV;
        }