brintos

brintos / linux-shallow public Read only

0
0
Text · 4.2 KiB · 0b520df Raw
105 lines · c
1/* SPDX-License-Identifier: GPL-2.0 */2/**3  * This header file contains global constant/enum definitions,4  * global variable declaration.5  */6#ifndef _LBS_DEB_DEFS_H_7#define _LBS_DEB_DEFS_H_8 9#ifndef DRV_NAME10#define DRV_NAME "libertas_tf"11#endif12 13#include <linux/spinlock.h>14 15#ifdef CONFIG_LIBERTAS_THINFIRM_DEBUG16#define DEBUG17#define PROC_DEBUG18#endif19 20#define LBTF_DEB_ENTER	0x0000000121#define LBTF_DEB_LEAVE	0x0000000222#define LBTF_DEB_MAIN	0x0000000423#define LBTF_DEB_NET	0x0000000824#define LBTF_DEB_MESH	0x0000001025#define LBTF_DEB_WEXT	0x0000002026#define LBTF_DEB_IOCTL	0x0000004027#define LBTF_DEB_SCAN	0x0000008028#define LBTF_DEB_ASSOC	0x0000010029#define LBTF_DEB_JOIN	0x0000020030#define LBTF_DEB_11D	0x0000040031#define LBTF_DEB_DEBUGFS	0x0000080032#define LBTF_DEB_ETHTOOL	0x0000100033#define LBTF_DEB_HOST	0x0000200034#define LBTF_DEB_CMD	0x0000400035#define LBTF_DEB_RX	0x0000800036#define LBTF_DEB_TX	0x0001000037#define LBTF_DEB_USB	0x0002000038#define LBTF_DEB_CS	0x0004000039#define LBTF_DEB_FW	0x0008000040#define LBTF_DEB_THREAD	0x0010000041#define LBTF_DEB_HEX	0x0020000042#define LBTF_DEB_SDIO	0x0040000043#define LBTF_DEB_MACOPS	0x0080000044 45extern unsigned int lbtf_debug;46 47 48#ifdef DEBUG49#define LBTF_DEB_LL(grp, grpnam, fmt, args...) \50do { if ((lbtf_debug & (grp)) == (grp)) \51  printk(KERN_DEBUG DRV_NAME grpnam ": " fmt, ## args); } while (0)52#else53#define LBTF_DEB_LL(grp, grpnam, fmt, args...) do {} while (0)54#endif55 56#define lbtf_deb_enter(grp) \57  LBTF_DEB_LL(grp | LBTF_DEB_ENTER, " enter", "%s()\n", __func__);58#define lbtf_deb_enter_args(grp, fmt, args...) \59  LBTF_DEB_LL(grp | LBTF_DEB_ENTER, " enter", "%s(" fmt ")\n", __func__, ## args);60#define lbtf_deb_leave(grp) \61  LBTF_DEB_LL(grp | LBTF_DEB_LEAVE, " leave", "%s()\n", __func__);62#define lbtf_deb_leave_args(grp, fmt, args...) \63  LBTF_DEB_LL(grp | LBTF_DEB_LEAVE, " leave", "%s(), " fmt "\n", \64  __func__, ##args);65#define lbtf_deb_main(fmt, args...)      LBTF_DEB_LL(LBTF_DEB_MAIN, " main", fmt, ##args)66#define lbtf_deb_net(fmt, args...)       LBTF_DEB_LL(LBTF_DEB_NET, " net", fmt, ##args)67#define lbtf_deb_mesh(fmt, args...)      LBTF_DEB_LL(LBTF_DEB_MESH, " mesh", fmt, ##args)68#define lbtf_deb_wext(fmt, args...)      LBTF_DEB_LL(LBTF_DEB_WEXT, " wext", fmt, ##args)69#define lbtf_deb_ioctl(fmt, args...)     LBTF_DEB_LL(LBTF_DEB_IOCTL, " ioctl", fmt, ##args)70#define lbtf_deb_scan(fmt, args...)      LBTF_DEB_LL(LBTF_DEB_SCAN, " scan", fmt, ##args)71#define lbtf_deb_assoc(fmt, args...)     LBTF_DEB_LL(LBTF_DEB_ASSOC, " assoc", fmt, ##args)72#define lbtf_deb_join(fmt, args...)      LBTF_DEB_LL(LBTF_DEB_JOIN, " join", fmt, ##args)73#define lbtf_deb_11d(fmt, args...)       LBTF_DEB_LL(LBTF_DEB_11D, " 11d", fmt, ##args)74#define lbtf_deb_debugfs(fmt, args...)   LBTF_DEB_LL(LBTF_DEB_DEBUGFS, " debugfs", fmt, ##args)75#define lbtf_deb_ethtool(fmt, args...)   LBTF_DEB_LL(LBTF_DEB_ETHTOOL, " ethtool", fmt, ##args)76#define lbtf_deb_host(fmt, args...)      LBTF_DEB_LL(LBTF_DEB_HOST, " host", fmt, ##args)77#define lbtf_deb_cmd(fmt, args...)       LBTF_DEB_LL(LBTF_DEB_CMD, " cmd", fmt, ##args)78#define lbtf_deb_rx(fmt, args...)        LBTF_DEB_LL(LBTF_DEB_RX, " rx", fmt, ##args)79#define lbtf_deb_tx(fmt, args...)        LBTF_DEB_LL(LBTF_DEB_TX, " tx", fmt, ##args)80#define lbtf_deb_fw(fmt, args...)        LBTF_DEB_LL(LBTF_DEB_FW, " fw", fmt, ##args)81#define lbtf_deb_usb(fmt, args...)       LBTF_DEB_LL(LBTF_DEB_USB, " usb", fmt, ##args)82#define lbtf_deb_usbd(dev, fmt, args...) LBTF_DEB_LL(LBTF_DEB_USB, " usbd", "%s:" fmt, dev_name(dev), ##args)83#define lbtf_deb_cs(fmt, args...)        LBTF_DEB_LL(LBTF_DEB_CS, " cs", fmt, ##args)84#define lbtf_deb_thread(fmt, args...)    LBTF_DEB_LL(LBTF_DEB_THREAD, " thread", fmt, ##args)85#define lbtf_deb_sdio(fmt, args...)      LBTF_DEB_LL(LBTF_DEB_SDIO, " thread", fmt, ##args)86#define lbtf_deb_macops(fmt, args...)      LBTF_DEB_LL(LBTF_DEB_MACOPS, " thread", fmt, ##args)87 88#ifdef DEBUG89static inline void lbtf_deb_hex(unsigned int grp, const char *prompt, u8 *buf, int len)90{91	char newprompt[32];92 93	if (len &&94	    (lbtf_debug & LBTF_DEB_HEX) &&95	    (lbtf_debug & grp))	{96		snprintf(newprompt, sizeof(newprompt), DRV_NAME " %s: ", prompt);97		print_hex_dump_bytes(prompt, DUMP_PREFIX_NONE, buf, len);98	}99}100#else101#define lbtf_deb_hex(grp, prompt, buf, len)	do {} while (0)102#endif103 104#endif105