diff options
author | Felipe Balbi <balbi@ti.com> | 2011-03-16 09:59:35 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2011-04-19 19:45:50 -0400 |
commit | bcdd323b893ad3c9b7ef26b5e4a0bef974238501 (patch) | |
tree | 3a107018f470ec4d7e021d1421ba3688770f473f /include/linux/device.h | |
parent | f0e615c3cb72b42191b558c130409335812621d8 (diff) |
device: add dev_WARN_ONCE
it's quite useful to print the device name
on the stack dump caused by WARN(), but
there are other cases where we might want
to use WARN_ONCE.
Introduce a helper similar to dev_WARN() for
that case too.
Signed-off-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'include/linux/device.h')
-rw-r--r-- | include/linux/device.h | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/include/linux/device.h b/include/linux/device.h index ab8dfc095709..d4840511e877 100644 --- a/include/linux/device.h +++ b/include/linux/device.h | |||
@@ -742,13 +742,17 @@ do { \ | |||
742 | #endif | 742 | #endif |
743 | 743 | ||
744 | /* | 744 | /* |
745 | * dev_WARN() acts like dev_printk(), but with the key difference | 745 | * dev_WARN*() acts like dev_printk(), but with the key difference |
746 | * of using a WARN/WARN_ON to get the message out, including the | 746 | * of using a WARN/WARN_ON to get the message out, including the |
747 | * file/line information and a backtrace. | 747 | * file/line information and a backtrace. |
748 | */ | 748 | */ |
749 | #define dev_WARN(dev, format, arg...) \ | 749 | #define dev_WARN(dev, format, arg...) \ |
750 | WARN(1, "Device: %s\n" format, dev_driver_string(dev), ## arg); | 750 | WARN(1, "Device: %s\n" format, dev_driver_string(dev), ## arg); |
751 | 751 | ||
752 | #define dev_WARN_ONCE(dev, condition, format, arg...) \ | ||
753 | WARN_ONCE(condition, "Device %s\n" format, \ | ||
754 | dev_driver_string(dev), ## arg) | ||
755 | |||
752 | /* Create alias, so I can be autoloaded. */ | 756 | /* Create alias, so I can be autoloaded. */ |
753 | #define MODULE_ALIAS_CHARDEV(major,minor) \ | 757 | #define MODULE_ALIAS_CHARDEV(major,minor) \ |
754 | MODULE_ALIAS("char-major-" __stringify(major) "-" __stringify(minor)) | 758 | MODULE_ALIAS("char-major-" __stringify(major) "-" __stringify(minor)) |