brintos

brintos / linux-shallow public Read only

0
0
Text · 1.9 KiB · 3a3c13a Raw
88 lines · c
1// SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause2/*3 * Copyright (C) 2005-2011, 2021-2022 Intel Corporation4 */5#include <linux/device.h>6#include <linux/interrupt.h>7#include <linux/export.h>8#include "iwl-drv.h"9#include "iwl-debug.h"10#include "iwl-devtrace.h"11 12#define __iwl_fn(fn)						\13void __iwl_ ##fn(struct device *dev, const char *fmt, ...)	\14{								\15	struct va_format vaf = {				\16		.fmt = fmt,					\17	};							\18	va_list args;						\19								\20	va_start(args, fmt);					\21	vaf.va = &args;						\22	dev_ ##fn(dev, "%pV", &vaf);				\23	trace_iwlwifi_ ##fn(&vaf);				\24	va_end(args);						\25}26 27__iwl_fn(warn)28IWL_EXPORT_SYMBOL(__iwl_warn);29__iwl_fn(info)30IWL_EXPORT_SYMBOL(__iwl_info);31__iwl_fn(crit)32IWL_EXPORT_SYMBOL(__iwl_crit);33 34void __iwl_err(struct device *dev, enum iwl_err_mode mode, const char *fmt, ...)35{36	struct va_format vaf = {37		.fmt = fmt,38	};39	va_list args, args2;40 41	va_start(args, fmt);42	switch (mode) {43	case IWL_ERR_MODE_RATELIMIT:44		if (net_ratelimit())45			break;46		fallthrough;47	case IWL_ERR_MODE_REGULAR:48	case IWL_ERR_MODE_RFKILL:49		va_copy(args2, args);50		vaf.va = &args2;51		if (mode == IWL_ERR_MODE_RFKILL)52			dev_err(dev, "(RFKILL) %pV", &vaf);53		else54			dev_err(dev, "%pV", &vaf);55		va_end(args2);56		break;57	default:58		break;59	}60	vaf.va = &args;61	trace_iwlwifi_err(&vaf);62	va_end(args);63}64IWL_EXPORT_SYMBOL(__iwl_err);65 66#if defined(CONFIG_IWLWIFI_DEBUG) || defined(CONFIG_IWLWIFI_DEVICE_TRACING)67void __iwl_dbg(struct device *dev,68	       u32 level, bool limit, const char *function,69	       const char *fmt, ...)70{71	struct va_format vaf = {72		.fmt = fmt,73	};74	va_list args;75 76	va_start(args, fmt);77	vaf.va = &args;78#ifdef CONFIG_IWLWIFI_DEBUG79	if (iwl_have_debug_level(level) &&80	    (!limit || net_ratelimit()))81		dev_printk(KERN_DEBUG, dev, "%s %pV", function, &vaf);82#endif83	trace_iwlwifi_dbg(level, function, &vaf);84	va_end(args);85}86IWL_EXPORT_SYMBOL(__iwl_dbg);87#endif88