linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Rajesh B Prathipati <rprathip@linux.vnet.ibm.com>
To: benh@kernel.crashing.org, paulus@samba.org,
	linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org,
	anton@au1.ibm.com
Subject: [PATCH] powerpc: Make unaligned accesses endian-safe for powerpc
Date: Thu, 12 Dec 2013 21:15:56 +0530	[thread overview]
Message-ID: <52A9DA34.40905@linux.vnet.ibm.com> (raw)

From: Rajesh B Prathipati <rprathip@linux.vnet.ibm.com>

The generic put_unaligned/get_unaligned macros were made endian-safe by 
calling the appropriate endian dependent macros based on the endian type 
of the powerpc processor.

Signed-off-by: Rajesh B Prathipati <rprathip@linux.vnet.ibm.com>
---
This patch applies to linux kernel version 3.12. This patch has been 
tested and it fixes the problem with linux 3.12 USB stack.

--- linux/arch/powerpc/include/asm/unaligned.h.orig     2013-12-12 
00:07:05.329073544 -0200
+++ linux/arch/powerpc/include/asm/unaligned.h  2013-12-11 
23:56:52.918630238 -0200
@@ -4,13 +4,18 @@
  #ifdef __KERNEL__

  /*
- * The PowerPC can do unaligned accesses itself in big endian mode.
+ * The PowerPC can do unaligned accesses itself based on its endian mode.
   */
  #include <linux/unaligned/access_ok.h>
  #include <linux/unaligned/generic.h>

+#ifdef __LITTLE_ENDIAN__
+#define get_unaligned  __get_unaligned_le
+#define put_unaligned  __put_unaligned_le
+#else
  #define get_unaligned  __get_unaligned_be
  #define put_unaligned  __put_unaligned_be
+#endif

  #endif /* __KERNEL__ */
  #endif /* _ASM_POWERPC_UNALIGNED_H */


             reply	other threads:[~2013-12-12 16:41 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-12 15:45 Rajesh B Prathipati [this message]
2013-12-16  7:58 ` [PATCH] powerpc: Make unaligned accesses endian-safe for powerpc Anton Blanchard

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=52A9DA34.40905@linux.vnet.ibm.com \
    --to=rprathip@linux.vnet.ibm.com \
    --cc=anton@au1.ibm.com \
    --cc=benh@kernel.crashing.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=paulus@samba.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).