forked from luck/tmp_suning_uos_patched
c2f8c90079
lmc_trace() was first introduced in commit e7a392d5158af ("Import 2.3.99pre6-5") and was not touched ever since. The reason for looking at this was to get rid of the in_interrupt() usage, but while looking at it the following observations were made: - At least lmc_get_stats() (->ndo_get_stats()) is invoked with disabled preemption which is not detected by the in_interrupt() check, which would cause schedule() to be called from invalid context. - The code is hidden behind #ifdef LMC_TRACE which is not defined within the kernel and wasn't at the time it was introduced. - Three jiffies don't match 50ms. msleep() would be a better match which would also avoid the schedule() invocation. But why have it to begin with? - Nobody would do something like this today. Either netdev_dbg() or trace_printk() or a trace event would be used. If only the functions related to this driver are interesting then ftrace can be used with filtering. As it is obviously broken for years, simply remove it. Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: David S. Miller <davem@davemloft.net>
66 lines
1.4 KiB
C
66 lines
1.4 KiB
C
// SPDX-License-Identifier: GPL-2.0
|
|
#include <linux/types.h>
|
|
#include <linux/netdevice.h>
|
|
#include <linux/interrupt.h>
|
|
|
|
#include "lmc_debug.h"
|
|
|
|
/*
|
|
* Prints out len, max to 80 octets using printk, 20 per line
|
|
*/
|
|
#ifdef DEBUG
|
|
#ifdef LMC_PACKET_LOG
|
|
void lmcConsoleLog(char *type, unsigned char *ucData, int iLen)
|
|
{
|
|
int iNewLine = 1;
|
|
char str[80], *pstr;
|
|
|
|
sprintf(str, KERN_DEBUG "lmc: %s: ", type);
|
|
pstr = str+strlen(str);
|
|
|
|
if(iLen > 240){
|
|
printk(KERN_DEBUG "lmc: Printing 240 chars... out of: %d\n", iLen);
|
|
iLen = 240;
|
|
}
|
|
else{
|
|
printk(KERN_DEBUG "lmc: Printing %d chars\n", iLen);
|
|
}
|
|
|
|
while(iLen > 0)
|
|
{
|
|
sprintf(pstr, "%02x ", *ucData);
|
|
pstr+=3;
|
|
ucData++;
|
|
if( !(iNewLine % 20))
|
|
{
|
|
sprintf(pstr, "\n");
|
|
printk(str);
|
|
sprintf(str, KERN_DEBUG "lmc: %s: ", type);
|
|
pstr=str+strlen(str);
|
|
}
|
|
iNewLine++;
|
|
iLen--;
|
|
}
|
|
sprintf(pstr, "\n");
|
|
printk(str);
|
|
}
|
|
#endif
|
|
#endif
|
|
|
|
#ifdef DEBUG
|
|
u32 lmcEventLogIndex;
|
|
u32 lmcEventLogBuf[LMC_EVENTLOGSIZE * LMC_EVENTLOGARGS];
|
|
|
|
void lmcEventLog(u32 EventNum, u32 arg2, u32 arg3)
|
|
{
|
|
lmcEventLogBuf[lmcEventLogIndex++] = EventNum;
|
|
lmcEventLogBuf[lmcEventLogIndex++] = arg2;
|
|
lmcEventLogBuf[lmcEventLogIndex++] = arg3;
|
|
lmcEventLogBuf[lmcEventLogIndex++] = jiffies;
|
|
|
|
lmcEventLogIndex &= (LMC_EVENTLOGSIZE * LMC_EVENTLOGARGS) - 1;
|
|
}
|
|
#endif /* DEBUG */
|
|
|
|
/* --------------------------- end if_lmc_linux.c ------------------------ */
|