Commit f4d68930 authored by Linus Torvalds's avatar Linus Torvalds
Browse files
Pull nios2 updates from Ley Foon Tan:

 - nios2: Remove unnecessary #ifdef guards
 - nios2: Switch to generic __xchg()
 - nios2: Fix unused variable warning

* tag 'nios2-v4.4-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/lftan/nios2:
  nios2: Remove unnecessary #ifdef guards
  nios2: Switch to generic __xchg()
  nios2: Fix unused variable warning
parents 3510ca19 bb3fc5dd
Loading
Loading
Loading
Loading
+0 −47
Original line number Diff line number Diff line
@@ -9,53 +9,6 @@
#ifndef _ASM_NIOS2_CMPXCHG_H
#define _ASM_NIOS2_CMPXCHG_H

#include <linux/irqflags.h>

#define xchg(ptr, x)	\
	((__typeof__(*(ptr)))__xchg((unsigned long)(x), (ptr), sizeof(*(ptr))))

struct __xchg_dummy { unsigned long a[100]; };
#define __xg(x)		((volatile struct __xchg_dummy *)(x))

static inline unsigned long __xchg(unsigned long x, volatile void *ptr,
					int size)
{
	unsigned long tmp, flags;

	local_irq_save(flags);

	switch (size) {
	case 1:
		__asm__ __volatile__(
			"ldb	%0, %2\n"
			"stb	%1, %2\n"
			: "=&r" (tmp)
			: "r" (x), "m" (*__xg(ptr))
			: "memory");
		break;
	case 2:
		__asm__ __volatile__(
			"ldh	%0, %2\n"
			"sth	%1, %2\n"
			: "=&r" (tmp)
			: "r" (x), "m" (*__xg(ptr))
			: "memory");
		break;
	case 4:
		__asm__ __volatile__(
			"ldw	%0, %2\n"
			"stw	%1, %2\n"
			: "=&r" (tmp)
			: "r" (x), "m" (*__xg(ptr))
			: "memory");
		break;
	}

	local_irq_restore(flags);
	return tmp;
}

#include <asm-generic/cmpxchg.h>
#include <asm-generic/cmpxchg-local.h>

#endif /* _ASM_NIOS2_CMPXCHG_H */
+1 −1
Original line number Diff line number Diff line
@@ -104,7 +104,7 @@ asmlinkage void __init nios2_boot_init(unsigned r4, unsigned r5, unsigned r6,
				       unsigned r7)
{
	unsigned dtb_passed = 0;
	char cmdline_passed[COMMAND_LINE_SIZE] = { 0, };
	char cmdline_passed[COMMAND_LINE_SIZE] __maybe_unused = { 0, };

#if defined(CONFIG_NIOS2_PASS_CMDLINE)
	if (r4 == 0x534f494e) { /* r4 is magic NIOS */
+0 −2
Original line number Diff line number Diff line
@@ -10,7 +10,6 @@
#include <linux/types.h>
#include <linux/string.h>

#ifdef __HAVE_ARCH_MEMMOVE
void *memmove(void *d, const void *s, size_t count)
{
	unsigned long dst, src;
@@ -79,4 +78,3 @@ restdown:

	return d;
}
#endif /* __HAVE_ARCH_MEMMOVE */
+0 −2
Original line number Diff line number Diff line
@@ -10,7 +10,6 @@
#include <linux/types.h>
#include <linux/string.h>

#ifdef __HAVE_ARCH_MEMSET
void *memset(void *s, int c, size_t count)
{
	int destptr, charcnt, dwordcnt, fill8reg, wrkrega;
@@ -78,4 +77,3 @@ void *memset(void *s, int c, size_t count)

	return s;
}
#endif /* __HAVE_ARCH_MEMSET */