Skip to contentSkip to conversation

Where to define platform-specific ndelay

DISCUSSION Mason 1 participant 1 message Jul 16, 2015

lore
Share & tools
lore

Mason

author
#0 lore raw

Hello,

arch/arm64 defines ndelay, but arch/arm does not.

With my current setup, ndelay resolves to the generic implementation from include/linux/delay.h

#ifndef ndelay
static inline void ndelay(unsigned long x)

{
	udelay(DIV_ROUND_UP(x, 1000));
}

#define ndelay(x) ndelay(x)
#endif

I want to provide a different implementation for my platform.

Something along the lines of

#define NDELAY_MULT ((2199 * HZ) >> 11)
#define ndelay(n) __const_udelay((n) * NDELAY_MULT)

Where should I put these definitions?

(I don't want to pollute the generic namespace, so it should probably go inside platform-specific files, such as perhaps mach-foo/include/mach/timex.h ??)

Although, I'm not sure how it would be supposed to work with CONFIG_ARCH_MULTIPLATFORM (which is the default, IIUC?)

Regards.