/*
 * Copyright 2013, Michael Ellerman, IBM Corp.
 * Licensed under GPLv2.
 */

#ifndef _SELFTESTS_POWERPC_UTILS_H
#define _SELFTESTS_POWERPC_UTILS_H

#define __cacheline_aligned __attribute__((aligned(128)))

#include <stdint.h>
#include <stdbool.h>
#include <linux/auxvec.h>
#include "reg.h"

/* Avoid headaches with PRI?64 - just use %ll? always */
typedef unsigned long long u64;
typedef   signed long long s64;

/* Just for familiarity */
typedef uint32_t u32;
typedef uint16_t u16;
typedef uint8_t u8;

void test_harness_set_timeout(uint64_t time);
int test_harness(int (test_function)(void), char *name);
extern void *get_auxv_entry(int type);
int pick_online_cpu(void);

static inline bool have_hwcap(unsigned long ftr)
{
	return ((unsigned long)get_auxv_entry(AT_HWCAP) & ftr) == ftr;
}

#ifdef AT_HWCAP2
static inline bool have_hwcap2(unsigned long ftr2)
{
	return ((unsigned long)get_auxv_entry(AT_HWCAP2) & ftr2) == ftr2;
}
#else
static inline bool have_hwcap2(unsigned long ftr2)
{
	return false;
}
#endif

/* Yes, this is evil */
#define FAIL_IF(x)						\
do {								\
	if ((x)) {						\
		fprintf(stderr,					\
		"[FAIL] Test FAILED on line %d\n", __LINE__);	\
		return 1;					\
	}							\
} while (0)

/* The test harness uses this, yes it's gross */
#define MAGIC_SKIP_RETURN_VALUE	99

#define SKIP_IF(x)						\
do {								\
	if ((x)) {						\
		fprintf(stderr,					\
		"[SKIP] Test skipped on line %d\n", __LINE__);	\
		return MAGIC_SKIP_RETURN_VALUE;			\
	}							\
} while (0)

#define _str(s) #s
#define str(s) _str(s)

/* POWER9 feature */
#ifndef PPC_FEATURE2_ARCH_3_00
#define PPC_FEATURE2_ARCH_3_00 0x00800000
#endif

#endif /* _SELFTESTS_POWERPC_UTILS_H */
p;id=8b0e195314fabd58a331c4f7b6db75a1565535d7'>refs</a><a href='/cgit.cgi/linux/net-next.git/log/sound/soc/codecs/cx20442.h?h=nds-private-remove'>log</a><a href='/cgit.cgi/linux/net-next.git/tree/sound/soc/codecs/cx20442.h?h=nds-private-remove&amp;id=8b0e195314fabd58a331c4f7b6db75a1565535d7'>tree</a><a class='active' href='/cgit.cgi/linux/net-next.git/commit/sound/soc/codecs/cx20442.h?h=nds-private-remove&amp;id=8b0e195314fabd58a331c4f7b6db75a1565535d7'>commit</a><a href='/cgit.cgi/linux/net-next.git/diff/sound/soc/codecs/cx20442.h?h=nds-private-remove&amp;id=8b0e195314fabd58a331c4f7b6db75a1565535d7'>diff</a></td><td class='form'><form class='right' method='get' action='/cgit.cgi/linux/net-next.git/log/sound/soc/codecs/cx20442.h'>
<input type='hidden' name='h' value='nds-private-remove'/><input type='hidden' name='id' value='8b0e195314fabd58a331c4f7b6db75a1565535d7'/><select name='qt'>
<option value='grep'>log msg</option>
<option value='author'>author</option>
<option value='committer'>committer</option>
<option value='range'>range</option>
</select>
<input class='txt' type='search' size='10' name='q' value=''/>
<input type='submit' value='search'/>
</form>
</td></tr></table>
<div class='path'>path: <a href='/cgit.cgi/linux/net-next.git/commit/?h=nds-private-remove&amp;id=8b0e195314fabd58a331c4f7b6db75a1565535d7'>root</a>/<a href='/cgit.cgi/linux/net-next.git/commit/sound?h=nds-private-remove&amp;id=8b0e195314fabd58a331c4f7b6db75a1565535d7'>sound</a>/<a href='/cgit.cgi/linux/net-next.git/commit/sound/soc?h=nds-private-remove&amp;id=8b0e195314fabd58a331c4f7b6db75a1565535d7'>soc</a>/<a href='/cgit.cgi/linux/net-next.git/commit/sound/soc/codecs?h=nds-private-remove&amp;id=8b0e195314fabd58a331c4f7b6db75a1565535d7'>codecs</a>/<a href='/cgit.cgi/linux/net-next.git/commit/sound/soc/codecs/cx20442.h?h=nds-private-remove&amp;id=8b0e195314fabd58a331c4f7b6db75a1565535d7'>cx20442.h</a></div><div class='content'><div class='cgit-panel'><b>diff options</b><form method='get'><input type='hidden' name='h' value='nds-private-remove'/><input type='hidden' name='id' value='8b0e195314fabd58a331c4f7b6db75a1565535d7'/><table><tr><td colspan='2'/></tr><tr><td class='label'>context:</td><td class='ctrl'><select name='context' onchange='this.form.submit();'><option value='1'>1</option><option value='2'>2</option><option value='3' selected='selected'>3</option><option value='4'>4</option><option value='5'>5</option><option value='6'>6</option><option value='7'>7</option><option value='8'>8</option><option value='9'>9</option><option value='10'>10</option><option value='15'>15</option><option value='20'>20</option><option value='25'>25</option><option value='30'>30</option><option value='35'>35</option><option value='40'>40</option></select></td></tr><tr><td class='label'>space:</td><td class='ctrl'><select name='ignorews' onchange='this.form.submit();'><option value='0' selected='selected'>include</option><option value='1'>ignore</option></select></td></tr><tr><td class='label'>mode:</td><td class='ctrl'><select name='dt' onchange='this.form.submit();'><option value='0' selected='selected'>unified</option><option value='1'>ssdiff</option><option value='2'>stat only</option></select></td></tr><tr><td/><td class='ctrl'><noscript><input type='submit' value='reload'/></noscript></td></tr></table></form></div><table summary='commit info' class='commit-info'>
<tr><th>author</th><td>Thomas Gleixner &lt;tglx@linutronix.de&gt;</td><td class='right'>2016-12-25 12:30:41 +0100</td></tr>
<tr><th>committer</th><td>Thomas Gleixner &lt;tglx@linutronix.de&gt;</td><td class='right'>2016-12-25 17:21:22 +0100</td></tr>
<tr><th>commit</th><td colspan='2' class='oid'><a href='/cgit.cgi/linux/net-next.git/commit/sound/soc/codecs/cx20442.h?h=nds-private-remove&amp;id=8b0e195314fabd58a331c4f7b6db75a1565535d7'>8b0e195314fabd58a331c4f7b6db75a1565535d7</a> (<a href='/cgit.cgi/linux/net-next.git/patch/sound/soc/codecs/cx20442.h?id=8b0e195314fabd58a331c4f7b6db75a1565535d7'>patch</a>)</td></tr>
<tr><th>tree</th><td colspan='2' class='oid'><a href='/cgit.cgi/linux/net-next.git/tree/?h=nds-private-remove&amp;id=8b0e195314fabd58a331c4f7b6db75a1565535d7'>6ff9d2d9388406b8447b09b6a4037795142172de</a> /<a href='/cgit.cgi/linux/net-next.git/tree/sound/soc/codecs/cx20442.h?h=nds-private-remove&amp;id=8b0e195314fabd58a331c4f7b6db75a1565535d7'>sound/soc/codecs/cx20442.h</a></td></tr>
<tr><th>parent</th><td colspan='2' class='oid'><a href='/cgit.cgi/linux/net-next.git/commit/sound/soc/codecs/cx20442.h?h=nds-private-remove&amp;id=2456e855354415bfaeb7badaa14e11b3e02c8466'>2456e855354415bfaeb7badaa14e11b3e02c8466</a> (<a href='/cgit.cgi/linux/net-next.git/diff/sound/soc/codecs/cx20442.h?h=nds-private-remove&amp;id=8b0e195314fabd58a331c4f7b6db75a1565535d7&amp;id2=2456e855354415bfaeb7badaa14e11b3e02c8466'>diff</a>)</td></tr></table>
<div class='commit-subject'>ktime: Cleanup ktime_set() usage</div><div class='commit-msg'>ktime_set(S,N) was required for the timespec storage type and is still
useful for situations where a Seconds and Nanoseconds part of a time value
needs to be converted. For anything where the Seconds argument is 0, this
is pointless and can be replaced with a simple assignment.

Signed-off-by: Thomas Gleixner &lt;tglx@linutronix.de&gt;
Cc: Peter Zijlstra &lt;peterz@infradead.org&gt;
</div><div class='diffstat-header'><a href='/cgit.cgi/linux/net-next.git/diff/?h=nds-private-remove&amp;id=8b0e195314fabd58a331c4f7b6db75a1565535d7'>Diffstat</a> (limited to 'sound/soc/codecs/cx20442.h')</div><table summary='diffstat' class='diffstat'>