[RFC V2] fbdev/nvidia:change reverse_order() macro

2015-08-20 Thread yalin wang
This change reverse_order() to swab32(bitrev32()), so that
it can have better performance on some platforms.

Signed-off-by: yalin wang 
---
 drivers/video/fbdev/nvidia/nv_local.h | 21 +++--
 1 file changed, 11 insertions(+), 10 deletions(-)

diff --git a/drivers/video/fbdev/nvidia/nv_local.h 
b/drivers/video/fbdev/nvidia/nv_local.h
index 68e508d..2c6baa1 100644
--- a/drivers/video/fbdev/nvidia/nv_local.h
+++ b/drivers/video/fbdev/nvidia/nv_local.h
@@ -97,18 +97,19 @@
 
 #ifdef __LITTLE_ENDIAN
 
+#include 
 #include 
+static inline void reverse_order(u32 *data)
+{
+   *data = swab32(bitrev32(*data));
+}
 
-#define reverse_order(l)\
-do {\
-   u8 *a = (u8 *)(l);  \
-   a[0] = bitrev8(a[0]);   \
-   a[1] = bitrev8(a[1]);   \
-   a[2] = bitrev8(a[2]);   \
-   a[3] = bitrev8(a[3]);   \
-} while(0)
 #else
-#define reverse_order(l) do { } while(0)
-#endif  /* __LITTLE_ENDIAN */
 
+static inline void reverse_order(u32 *data)
+{
+
+}
+
+#endif  /* __LITTLE_ENDIAN */
 #endif /* __NV_LOCAL_H__ */
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[RFC V2] fbdev/nvidia:change reverse_order() macro

2015-08-20 Thread yalin wang
This change reverse_order() to swab32(bitrev32()), so that
it can have better performance on some platforms.

Signed-off-by: yalin wang yalin.wang2...@gmail.com
---
 drivers/video/fbdev/nvidia/nv_local.h | 21 +++--
 1 file changed, 11 insertions(+), 10 deletions(-)

diff --git a/drivers/video/fbdev/nvidia/nv_local.h 
b/drivers/video/fbdev/nvidia/nv_local.h
index 68e508d..2c6baa1 100644
--- a/drivers/video/fbdev/nvidia/nv_local.h
+++ b/drivers/video/fbdev/nvidia/nv_local.h
@@ -97,18 +97,19 @@
 
 #ifdef __LITTLE_ENDIAN
 
+#include linux/swab.h
 #include linux/bitrev.h
+static inline void reverse_order(u32 *data)
+{
+   *data = swab32(bitrev32(*data));
+}
 
-#define reverse_order(l)\
-do {\
-   u8 *a = (u8 *)(l);  \
-   a[0] = bitrev8(a[0]);   \
-   a[1] = bitrev8(a[1]);   \
-   a[2] = bitrev8(a[2]);   \
-   a[3] = bitrev8(a[3]);   \
-} while(0)
 #else
-#define reverse_order(l) do { } while(0)
-#endif  /* __LITTLE_ENDIAN */
 
+static inline void reverse_order(u32 *data)
+{
+
+}
+
+#endif  /* __LITTLE_ENDIAN */
 #endif /* __NV_LOCAL_H__ */
-- 
1.9.1

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/