arcnet: Convert BUGMSG and BUGMSG2 to arc_prink and arc_cont

These macros don't actually represent BUG uses but are more commonly
used as logging macros, so use a more kernel style macro.

Convert the BUGMSG from a netdev_ like use to actually use netdev_<level>.

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
This commit is contained in:
Joe Perches
2015-05-05 10:05:55 -07:00
committed by Michael Grzeschik
parent 72aeea4841
commit a34c0932c3
12 changed files with 355 additions and 327 deletions

View File

@@ -81,34 +81,36 @@ extern int arcnet_debug;
#define BUGLVL(x) ((x) & ARCNET_DEBUG_MAX & arcnet_debug)
/* macros to simplify debug checking */
#define BUGMSG(x, fmt, ...) \
#define arc_printk(x, dev, fmt, ...) \
do { \
if (BUGLVL(x)) \
printk("%s%6s: " fmt, \
(x) == D_NORMAL ? KERN_WARNING : \
(x) < D_DURING ? KERN_INFO : KERN_DEBUG, \
dev->name, ##__VA_ARGS__); \
if (BUGLVL(x)) { \
if ((x) == D_NORMAL) \
netdev_warn(dev, fmt, ##__VA_ARGS__); \
else if ((x) < D_DURING) \
netdev_info(dev, fmt, ##__VA_ARGS__); \
else \
netdev_dbg(dev, fmt, ##__VA_ARGS__); \
} \
} while (0)
#define BUGMSG2(x, fmt, ...) \
#define arc_cont(x, fmt, ...) \
do { \
if (BUGLVL(x)) \
printk(fmt, ##__VA_ARGS__); \
if (BUGLVL(x)) \
pr_cont(fmt, ##__VA_ARGS__); \
} while (0)
/* see how long a function call takes to run, expressed in CPU cycles */
#define TIME(name, bytes, call) \
#define TIME(dev, name, bytes, call) \
do { \
if (BUGLVL(D_TIMING)) { \
unsigned long _x, _y; \
_x = get_cycles(); \
call; \
_y = get_cycles(); \
BUGMSG(D_TIMING, \
"%s: %d bytes in %lu cycles == " \
"%lu Kbytes/100Mcycle\n", \
name, bytes, _y - _x, \
100000000 / 1024 * bytes / (_y - _x + 1)); \
arc_printk(D_TIMING, dev, \
"%s: %d bytes in %lu cycles == %lu Kbytes/100Mcycle\n", \
name, bytes, _y - _x, \
100000000 / 1024 * bytes / (_y - _x + 1)); \
} else { \
call; \
} \