Re: [PATCH V3] [staging] bcm: Replace the BCM_DEBUG_* and BCM_SHOW_* macros with functions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 2012-05-29 at 16:37 +0530, Devendra Naga wrote:
[]
> diff --git a/drivers/staging/bcm/Debug.c b/drivers/staging/bcm/Debug.c
[]
> +void bcm_debug_print(PMINI_ADAPTER Adapter, int Type, int SubType,
> +			int dbg_level, const char *fmt, ...)
> +{
> +	struct va_format vaf;
> +	va_list args;
> +	UINT debug_level = Adapter->stDebugState.debug_level;
> +
> +	va_start(args, fmt);
> +
> +	vaf.fmt = fmt;
> +	vaf.va = &args;
> +
> +	if (DBG_TYPE_PRINTK == Type)
> +		pr_info("%s: %pV", __func__, &vaf);

func

> +	else if (Adapter &&
> +		(dbg_level & DBG_LVL_BITMASK) <= debug_level &&
> +		(Type & Adapter->stDebugState.type) &&
> +		(SubType & Adapter->stDebugState.subtype[Type])) {
> +		if (dbg_level & DBG_NO_FUNC_PRINT)
> +			printk(KERN_DEBUG "%pV" , &vaf);
> +		else
> +			printk(KERN_DEBUG "%s: %pV", __func__, &vaf);

func

> +	}
> +
> +	va_end(args);
> +}
> +
> +void bcm_debug_print_buffer(PMINI_ADAPTER Adapter, int Type, int SubType,
> +			    int dbg_level, const void *buffer, size_t bufferlen)
> +{
> +	if (DBG_TYPE_PRINTK == Type ||
> +	   (Adapter &&
> +	   (dbg_level & DBG_LVL_BITMASK) <= Adapter->stDebugState.debug_level &&
> +	   (Type & Adapter->stDebugState.type) &&
> +	   (SubType & Adapter->stDebugState.subtype[Type]))) {
> +		printk(KERN_DEBUG "%s:\n", __func__);

func

> +		print_hex_dump(KERN_DEBUG, " ", DUMP_PREFIX_OFFSET,
> +			       16, 1, buffer, bufferlen, false);
> +	}
> +}

[]

> diff --git a/drivers/staging/bcm/Debug.h b/drivers/staging/bcm/Debug.h
[]
> +struct _MINI_ADAPTER;
> +
> +__printf(5, 6)
> +
> +void bcm_debug_print(struct _MINI_ADAPTER *Adapter, int Type, int SubType,
> +			int dbg_level, const char *fmt, ...);

No blank line between __printf and prototype

> +void bcm_debug_print_buffer(struct _MINI_ADAPTER *Adapter, int Type, int SubType,
> +			int dbg_level, const void *buffer, size_t bufferlen);
> +void bcm_show_debug_bitmap(struct _MINI_ADAPTER *Adapter);
> +
> +#define BCM_DEBUG_PRINT(Adapter, Type, SubType, dbg_level, fmt, ...)	\
> +	bcm_debug_print(Adapter, Type, SubType, dbg_level, fmt, ##__VA_ARGS__)
> +
> +#define BCM_DEBUG_PRINT_BUFFER(Adapter, Type, SubType, dbg_level,	\
> +				buffer, bufferlen)			\
> +	bcm_debug_print_buffer(Adapter, Type, SubType, dbg_level,	\
> +				buffer, bufferlen)
> +#define BCM_SHOW_DEBUG_BITMAP(Adapter)					\
> +	bcm_show_debug_bitmap(Adapter)

Turns out to keep the same behavior, you need to add
a const char *func argument to these functions and
change the macros to pass __func__.
 


_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/devel


[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux