summaryrefslogtreecommitdiff
path: root/drivers/staging/brcm80211/util/bcmutils.c
diff options
context:
space:
mode:
authorArend van Spriel <arend@broadcom.com>2011-03-02 21:18:44 +0100
committerGreg Kroah-Hartman <gregkh@suse.de>2011-03-02 19:48:04 -0500
commit278d927d660b1652cf9a1425b0ce20a385ea9cff (patch)
treed1de5a58d61a1d7f36cdbb76b8d7e82f6d852fc8 /drivers/staging/brcm80211/util/bcmutils.c
parent4fe9042fe05a828293f693405f14b3f6a7898866 (diff)
downloadlinux-278d927d660b1652cf9a1425b0ce20a385ea9cff.tar.gz
staging: brcm80211: cleanup declaration in osl.h
Several declarations and macro definitions in osl.h are still needed and therefore moved to bcmutils.h or hnddma.h. The osl_assert function is moved to bcmutils.c accordingly. Reviewed-by: Brett Rudley <brudley@broadcom.com> Reviewed-by: Henry Ptasinski <henryp@broadcom.com> Reviewed-by: Roland Vossen <rvossen@broadcom.com> Signed-off-by: Arend van Spriel <arend@broadcom.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/staging/brcm80211/util/bcmutils.c')
-rw-r--r--drivers/staging/brcm80211/util/bcmutils.c54
1 files changed, 52 insertions, 2 deletions
diff --git a/drivers/staging/brcm80211/util/bcmutils.c b/drivers/staging/brcm80211/util/bcmutils.c
index e31151b9dbeb..d066ed7d373f 100644
--- a/drivers/staging/brcm80211/util/bcmutils.c
+++ b/drivers/staging/brcm80211/util/bcmutils.c
@@ -17,11 +17,12 @@
#include <linux/ctype.h>
#include <linux/kernel.h>
#include <linux/string.h>
-#include <bcmdefs.h>
-#include <stdarg.h>
#include <linux/module.h>
#include <linux/pci.h>
#include <linux/netdevice.h>
+#include <linux/sched.h>
+#include <bcmdefs.h>
+#include <stdarg.h>
#include <osl.h>
#include <bcmutils.h>
#include <siutils.h>
@@ -29,6 +30,9 @@
#include <bcmdevs.h>
#include <proto/802.11.h>
+/* Global ASSERT type flag */
+u32 g_assert_type;
+
struct sk_buff *BCMFASTPATH pkt_buf_get_skb(struct osl_info *osh, uint len)
{
struct sk_buff *skb;
@@ -1091,3 +1095,49 @@ int bcm_bprintf(struct bcmstrbuf *b, const char *fmt, ...)
return r;
}
+#if defined(BCMDBG_ASSERT)
+void osl_assert(char *exp, char *file, int line)
+{
+ char tempbuf[256];
+ char *basename;
+
+ basename = strrchr(file, '/');
+ /* skip the '/' */
+ if (basename)
+ basename++;
+
+ if (!basename)
+ basename = file;
+
+ snprintf(tempbuf, 256,
+ "assertion \"%s\" failed: file \"%s\", line %d\n", exp,
+ basename, line);
+
+ /*
+ * Print assert message and give it time to
+ * be written to /var/log/messages
+ */
+ if (!in_interrupt()) {
+ const int delay = 3;
+ printk(KERN_ERR "%s", tempbuf);
+ printk(KERN_ERR "panic in %d seconds\n", delay);
+ set_current_state(TASK_INTERRUPTIBLE);
+ schedule_timeout(delay * HZ);
+ }
+
+ switch (g_assert_type) {
+ case 0:
+ panic(KERN_ERR "%s", tempbuf);
+ break;
+ case 1:
+ printk(KERN_ERR "%s", tempbuf);
+ BUG();
+ break;
+ case 2:
+ printk(KERN_ERR "%s", tempbuf);
+ break;
+ default:
+ break;
+ }
+}
+#endif /* defined(BCMDBG_ASSERT) */