Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 27c766aa authored by Joe Perches's avatar Joe Perches Committed by Wim Van Sebroeck
Browse files

watchdog: Use pr_<fmt> and pr_<level>



Use the current logging styles.

Make sure all output has a prefix.
Add missing newlines.
Remove now unnecessary PFX, NAME, and miscellaneous other #defines.
Coalesce formats.

Signed-off-by: default avatarJoe Perches <joe@perches.com>
Signed-off-by: default avatarWim Van Sebroeck <wim@iguana.be>
parent 7cbc3535
Loading
Loading
Loading
Loading
+10 −14
Original line number Diff line number Diff line
@@ -52,6 +52,8 @@
 *	Includes, defines, variables, module parameters, ...
 */

#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt

/* Includes */
#include <linux/module.h>		/* For module specific items */
#include <linux/moduleparam.h>		/* For new moduleparam's */
@@ -70,7 +72,6 @@

/* Module information */
#define DRV_NAME "acquirewdt"
#define PFX DRV_NAME ": "
#define WATCHDOG_NAME "Acquire WDT"
/* There is no way to see what the correct time-out period is */
#define WATCHDOG_HEARTBEAT 0
@@ -208,8 +209,7 @@ static int acq_close(struct inode *inode, struct file *file)
	if (expect_close == 42) {
		acq_stop();
	} else {
		printk(KERN_CRIT PFX
			"Unexpected close, not stopping watchdog!\n");
		pr_crit("Unexpected close, not stopping watchdog!\n");
		acq_keepalive();
	}
	clear_bit(0, &acq_is_open);
@@ -246,27 +246,24 @@ static int __devinit acq_probe(struct platform_device *dev)

	if (wdt_stop != wdt_start) {
		if (!request_region(wdt_stop, 1, WATCHDOG_NAME)) {
			printk(KERN_ERR PFX
			    "I/O address 0x%04x already in use\n", wdt_stop);
			pr_err("I/O address 0x%04x already in use\n", wdt_stop);
			ret = -EIO;
			goto out;
		}
	}

	if (!request_region(wdt_start, 1, WATCHDOG_NAME)) {
		printk(KERN_ERR PFX "I/O address 0x%04x already in use\n",
			wdt_start);
		pr_err("I/O address 0x%04x already in use\n", wdt_start);
		ret = -EIO;
		goto unreg_stop;
	}
	ret = misc_register(&acq_miscdev);
	if (ret != 0) {
		printk(KERN_ERR PFX
			"cannot register miscdev on minor=%d (err=%d)\n",
		pr_err("cannot register miscdev on minor=%d (err=%d)\n",
		       WATCHDOG_MINOR, ret);
		goto unreg_regions;
	}
	printk(KERN_INFO PFX "initialized. (nowayout=%d)\n", nowayout);
	pr_info("initialized. (nowayout=%d)\n", nowayout);

	return 0;
unreg_regions:
@@ -308,8 +305,7 @@ static int __init acq_init(void)
{
	int err;

	printk(KERN_INFO
	      "WDT driver for Acquire single board computer initialising.\n");
	pr_info("WDT driver for Acquire single board computer initialising\n");

	err = platform_driver_register(&acquirewdt_driver);
	if (err)
@@ -332,7 +328,7 @@ static void __exit acq_exit(void)
{
	platform_device_unregister(acq_platform_device);
	platform_driver_unregister(&acquirewdt_driver);
	printk(KERN_INFO PFX "Watchdog Module Unloaded.\n");
	pr_info("Watchdog Module Unloaded\n");
}

module_init(acq_init);
+12 −18
Original line number Diff line number Diff line
@@ -28,6 +28,8 @@
 *	    add wdt_start and wdt_stop as parameters.
 */

#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt

#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/types.h>
@@ -43,7 +45,6 @@
#include <asm/system.h>

#define DRV_NAME "advantechwdt"
#define PFX DRV_NAME ": "
#define WATCHDOG_NAME "Advantech WDT"
#define WATCHDOG_TIMEOUT 60		/* 60 sec default timeout */

@@ -207,8 +208,7 @@ static int advwdt_close(struct inode *inode, struct file *file)
	if (adv_expect_close == 42) {
		advwdt_disable();
	} else {
		printk(KERN_CRIT PFX
				"Unexpected close, not stopping watchdog!\n");
		pr_crit("Unexpected close, not stopping watchdog!\n");
		advwdt_ping();
	}
	clear_bit(0, &advwdt_is_open);
@@ -245,8 +245,7 @@ static int __devinit advwdt_probe(struct platform_device *dev)

	if (wdt_stop != wdt_start) {
		if (!request_region(wdt_stop, 1, WATCHDOG_NAME)) {
			printk(KERN_ERR PFX
				"I/O address 0x%04x already in use\n",
			pr_err("I/O address 0x%04x already in use\n",
			       wdt_stop);
			ret = -EIO;
			goto out;
@@ -254,9 +253,7 @@ static int __devinit advwdt_probe(struct platform_device *dev)
	}

	if (!request_region(wdt_start, 1, WATCHDOG_NAME)) {
		printk(KERN_ERR PFX
				"I/O address 0x%04x already in use\n",
								wdt_start);
		pr_err("I/O address 0x%04x already in use\n", wdt_start);
		ret = -EIO;
		goto unreg_stop;
	}
@@ -265,18 +262,16 @@ static int __devinit advwdt_probe(struct platform_device *dev)
	 * if not reset to the default */
	if (advwdt_set_heartbeat(timeout)) {
		advwdt_set_heartbeat(WATCHDOG_TIMEOUT);
		printk(KERN_INFO PFX
			"timeout value must be 1<=x<=63, using %d\n", timeout);
		pr_info("timeout value must be 1<=x<=63, using %d\n", timeout);
	}

	ret = misc_register(&advwdt_miscdev);
	if (ret != 0) {
		printk(KERN_ERR PFX
			"cannot register miscdev on minor=%d (err=%d)\n",
		pr_err("cannot register miscdev on minor=%d (err=%d)\n",
		       WATCHDOG_MINOR, ret);
		goto unreg_regions;
	}
	printk(KERN_INFO PFX "initialized. timeout=%d sec (nowayout=%d)\n",
	pr_info("initialized. timeout=%d sec (nowayout=%d)\n",
		timeout, nowayout);
out:
	return ret;
@@ -318,8 +313,7 @@ static int __init advwdt_init(void)
{
	int err;

	printk(KERN_INFO
	     "WDT driver for Advantech single board computer initialising.\n");
	pr_info("WDT driver for Advantech single board computer initialising\n");

	err = platform_driver_register(&advwdt_driver);
	if (err)
@@ -343,7 +337,7 @@ static void __exit advwdt_exit(void)
{
	platform_device_unregister(advwdt_platform_device);
	platform_driver_unregister(&advwdt_driver);
	printk(KERN_INFO PFX "Watchdog Module Unloaded.\n");
	pr_info("Watchdog Module Unloaded\n");
}

module_init(advwdt_init);
+9 −12
Original line number Diff line number Diff line
@@ -7,6 +7,8 @@
 *	2 of the License, or (at your option) any later version.
 */

#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt

#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/types.h>
@@ -22,7 +24,6 @@
#include <linux/io.h>

#define WATCHDOG_NAME "ALi_M1535"
#define PFX WATCHDOG_NAME ": "
#define WATCHDOG_TIMEOUT 60	/* 60 sec default timeout */

/* internal variables */
@@ -268,8 +269,7 @@ static int ali_release(struct inode *inode, struct file *file)
	if (ali_expect_release == 42)
		ali_stop();
	else {
		printk(KERN_CRIT PFX
				"Unexpected close, not stopping watchdog!\n");
		pr_crit("Unexpected close, not stopping watchdog!\n");
		ali_keepalive();
	}
	clear_bit(0, &ali_is_open);
@@ -399,8 +399,7 @@ static int __init watchdog_init(void)
	   if not reset to the default */
	if (timeout < 1 || timeout >= 18000) {
		timeout = WATCHDOG_TIMEOUT;
		printk(KERN_INFO PFX
		     "timeout value must be 0 < timeout < 18000, using %d\n",
		pr_info("timeout value must be 0 < timeout < 18000, using %d\n",
			timeout);
	}

@@ -409,20 +408,18 @@ static int __init watchdog_init(void)

	ret = register_reboot_notifier(&ali_notifier);
	if (ret != 0) {
		printk(KERN_ERR PFX
			"cannot register reboot notifier (err=%d)\n", ret);
		pr_err("cannot register reboot notifier (err=%d)\n", ret);
		goto out;
	}

	ret = misc_register(&ali_miscdev);
	if (ret != 0) {
		printk(KERN_ERR PFX
			"cannot register miscdev on minor=%d (err=%d)\n",
		pr_err("cannot register miscdev on minor=%d (err=%d)\n",
		       WATCHDOG_MINOR, ret);
		goto unreg_reboot;
	}

	printk(KERN_INFO PFX "initialized. timeout=%d sec (nowayout=%d)\n",
	pr_info("initialized. timeout=%d sec (nowayout=%d)\n",
		timeout, nowayout);

out:
+18 −33
Original line number Diff line number Diff line
@@ -19,6 +19,8 @@
 *                  -- Mike Waychison <michael.waychison@sun.com>
 */

#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt

#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/types.h>
@@ -36,9 +38,6 @@

#include <asm/system.h>

#define OUR_NAME "alim7101_wdt"
#define PFX OUR_NAME ": "

#define WDT_ENABLE 0x9C
#define WDT_DISABLE 0x8C

@@ -112,8 +111,7 @@ static void wdt_timer_ping(unsigned long data)
					ALI_7101_GPIO_O, tmp & ~0x20);
		}
	} else {
		printk(KERN_WARNING PFX
			"Heartbeat lost! Will not ping the watchdog\n");
		pr_warn("Heartbeat lost! Will not ping the watchdog\n");
	}
	/* Re-set the timer interval */
	mod_timer(&timer, jiffies + WDT_INTERVAL);
@@ -162,7 +160,7 @@ static void wdt_startup(void)
	/* Start the timer */
	mod_timer(&timer, jiffies + WDT_INTERVAL);

	printk(KERN_INFO PFX "Watchdog timer is now enabled.\n");
	pr_info("Watchdog timer is now enabled\n");
}

static void wdt_turnoff(void)
@@ -170,7 +168,7 @@ static void wdt_turnoff(void)
	/* Stop the timer */
	del_timer_sync(&timer);
	wdt_change(WDT_DISABLE);
	printk(KERN_INFO PFX "Watchdog timer is now disabled...\n");
	pr_info("Watchdog timer is now disabled...\n");
}

static void wdt_keepalive(void)
@@ -226,8 +224,7 @@ static int fop_close(struct inode *inode, struct file *file)
		wdt_turnoff();
	else {
		/* wim: shouldn't there be a: del_timer(&timer); */
		printk(KERN_CRIT PFX
		  "device file closed unexpectedly. Will not stop the WDT!\n");
		pr_crit("device file closed unexpectedly. Will not stop the WDT!\n");
	}
	clear_bit(0, &wdt_is_open);
	wdt_expect_close = 0;
@@ -322,8 +319,7 @@ static int wdt_notify_sys(struct notifier_block *this,
		 * watchdog on reboot with no heartbeat
		 */
		wdt_change(WDT_ENABLE);
		printk(KERN_INFO PFX "Watchdog timer is now enabled "
			"with no heartbeat - should reboot in ~1 second.\n");
		pr_info("Watchdog timer is now enabled with no heartbeat - should reboot in ~1 second\n");
	}
	return NOTIFY_DONE;
}
@@ -352,12 +348,11 @@ static int __init alim7101_wdt_init(void)
	struct pci_dev *ali1543_south;
	char tmp;

	printk(KERN_INFO PFX "Steve Hill <steve@navaho.co.uk>.\n");
	pr_info("Steve Hill <steve@navaho.co.uk>\n");
	alim7101_pmu = pci_get_device(PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M7101,
		NULL);
	if (!alim7101_pmu) {
		printk(KERN_INFO PFX
			"ALi M7101 PMU not present - WDT not set\n");
		pr_info("ALi M7101 PMU not present - WDT not set\n");
		return -EBUSY;
	}

@@ -367,47 +362,38 @@ static int __init alim7101_wdt_init(void)
	ali1543_south = pci_get_device(PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M1533,
		NULL);
	if (!ali1543_south) {
		printk(KERN_INFO PFX
			"ALi 1543 South-Bridge not present - WDT not set\n");
		pr_info("ALi 1543 South-Bridge not present - WDT not set\n");
		goto err_out;
	}
	pci_read_config_byte(ali1543_south, 0x5e, &tmp);
	pci_dev_put(ali1543_south);
	if ((tmp & 0x1e) == 0x00) {
		if (!use_gpio) {
			printk(KERN_INFO PFX
				"Detected old alim7101 revision 'a1d'.  "
				"If this is a cobalt board, set the 'use_gpio' "
				"module parameter.\n");
			pr_info("Detected old alim7101 revision 'a1d'.  If this is a cobalt board, set the 'use_gpio' module parameter.\n");
			goto err_out;
		}
		nowayout = 1;
	} else if ((tmp & 0x1e) != 0x12 && (tmp & 0x1e) != 0x00) {
		printk(KERN_INFO PFX
			"ALi 1543 South-Bridge does not have the correct "
			"revision number (???1001?) - WDT not set\n");
		pr_info("ALi 1543 South-Bridge does not have the correct revision number (???1001?) - WDT not set\n");
		goto err_out;
	}

	if (timeout < 1 || timeout > 3600) {
		/* arbitrary upper limit */
		timeout = WATCHDOG_TIMEOUT;
		printk(KERN_INFO PFX
			"timeout value must be 1 <= x <= 3600, using %d\n",
		pr_info("timeout value must be 1 <= x <= 3600, using %d\n",
			timeout);
	}

	rc = register_reboot_notifier(&wdt_notifier);
	if (rc) {
		printk(KERN_ERR PFX
			"cannot register reboot notifier (err=%d)\n", rc);
		pr_err("cannot register reboot notifier (err=%d)\n", rc);
		goto err_out;
	}

	rc = misc_register(&wdt_miscdev);
	if (rc) {
		printk(KERN_ERR PFX
			"cannot register miscdev on minor=%d (err=%d)\n",
		pr_err("cannot register miscdev on minor=%d (err=%d)\n",
		       wdt_miscdev.minor, rc);
		goto err_out_reboot;
	}
@@ -415,8 +401,7 @@ static int __init alim7101_wdt_init(void)
	if (nowayout)
		__module_get(THIS_MODULE);

	printk(KERN_INFO PFX "WDT driver for ALi M7101 initialised. "
					"timeout=%d sec (nowayout=%d)\n",
	pr_info("WDT driver for ALi M7101 initialised. timeout=%d sec (nowayout=%d)\n",
		timeout, nowayout);
	return 0;

+16 −18
Original line number Diff line number Diff line
@@ -23,6 +23,8 @@
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 */

#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt

#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/errno.h>
@@ -39,7 +41,6 @@
#include <asm/addrspace.h>
#include <asm/mach-ar7/ar7.h>

#define DRVNAME "ar7_wdt"
#define LONGNAME "TI AR7 Watchdog Timer"

MODULE_AUTHOR("Nicolas Thill <nico@openwrt.org>");
@@ -93,7 +94,7 @@ static void ar7_wdt_kick(u32 value)
			return;
		}
	}
	printk(KERN_ERR DRVNAME ": failed to unlock WDT kick reg\n");
	pr_err("failed to unlock WDT kick reg\n");
}

static void ar7_wdt_prescale(u32 value)
@@ -106,7 +107,7 @@ static void ar7_wdt_prescale(u32 value)
			return;
		}
	}
	printk(KERN_ERR DRVNAME ": failed to unlock WDT prescale reg\n");
	pr_err("failed to unlock WDT prescale reg\n");
}

static void ar7_wdt_change(u32 value)
@@ -119,7 +120,7 @@ static void ar7_wdt_change(u32 value)
			return;
		}
	}
	printk(KERN_ERR DRVNAME ": failed to unlock WDT change reg\n");
	pr_err("failed to unlock WDT change reg\n");
}

static void ar7_wdt_disable(u32 value)
@@ -135,7 +136,7 @@ static void ar7_wdt_disable(u32 value)
			}
		}
	}
	printk(KERN_ERR DRVNAME ": failed to unlock WDT disable reg\n");
	pr_err("failed to unlock WDT disable reg\n");
}

static void ar7_wdt_update_margin(int new_margin)
@@ -151,21 +152,20 @@ static void ar7_wdt_update_margin(int new_margin)
		change = 0xffff;
	ar7_wdt_change(change);
	margin = change * prescale_value / vbus_rate;
	printk(KERN_INFO DRVNAME
	       ": timer margin %d seconds (prescale %d, change %d, freq %d)\n",
	pr_info("timer margin %d seconds (prescale %d, change %d, freq %d)\n",
		margin, prescale_value, change, vbus_rate);
}

static void ar7_wdt_enable_wdt(void)
{
	printk(KERN_DEBUG DRVNAME ": enabling watchdog timer\n");
	pr_debug("enabling watchdog timer\n");
	ar7_wdt_disable(1);
	ar7_wdt_kick(1);
}

static void ar7_wdt_disable_wdt(void)
{
	printk(KERN_DEBUG DRVNAME ": disabling watchdog timer\n");
	pr_debug("disabling watchdog timer\n");
	ar7_wdt_disable(0);
}

@@ -183,9 +183,7 @@ static int ar7_wdt_open(struct inode *inode, struct file *file)
static int ar7_wdt_release(struct inode *inode, struct file *file)
{
	if (!expect_close)
		printk(KERN_WARNING DRVNAME
		": watchdog device closed unexpectedly,"
		"will not disable the watchdog timer\n");
		pr_warn("watchdog device closed unexpectedly, will not disable the watchdog timer\n");
	else if (!nowayout)
		ar7_wdt_disable_wdt();
	clear_bit(0, &wdt_is_open);
@@ -283,28 +281,28 @@ static int __devinit ar7_wdt_probe(struct platform_device *pdev)
	ar7_regs_wdt =
		platform_get_resource_byname(pdev, IORESOURCE_MEM, "regs");
	if (!ar7_regs_wdt) {
		printk(KERN_ERR DRVNAME ": could not get registers resource\n");
		pr_err("could not get registers resource\n");
		rc = -ENODEV;
		goto out;
	}

	if (!request_mem_region(ar7_regs_wdt->start,
				resource_size(ar7_regs_wdt), LONGNAME)) {
		printk(KERN_WARNING DRVNAME ": watchdog I/O region busy\n");
		pr_warn("watchdog I/O region busy\n");
		rc = -EBUSY;
		goto out;
	}

	ar7_wdt = ioremap(ar7_regs_wdt->start, resource_size(ar7_regs_wdt));
	if (!ar7_wdt) {
		printk(KERN_ERR DRVNAME ": could not ioremap registers\n");
		pr_err("could not ioremap registers\n");
		rc = -ENXIO;
		goto out_mem_region;
	}

	vbus_clk = clk_get(NULL, "vbus");
	if (IS_ERR(vbus_clk)) {
		printk(KERN_ERR DRVNAME ": could not get vbus clock\n");
		pr_err("could not get vbus clock\n");
		rc = PTR_ERR(vbus_clk);
		goto out_mem_region;
	}
@@ -315,7 +313,7 @@ static int __devinit ar7_wdt_probe(struct platform_device *pdev)

	rc = misc_register(&ar7_wdt_miscdev);
	if (rc) {
		printk(KERN_ERR DRVNAME ": unable to register misc device\n");
		pr_err("unable to register misc device\n");
		goto out_alloc;
	}
	goto out;
Loading