Re: [Linux-fbdev-devel] [PATCH 2.6.18-rc4] sisusbvga: fix sisusb.c
From: Mitsuhiro KOGA <hidden>
Date: 2006-08-16 12:06:05
2006/8/16, Geert Uytterhoeven [off-list ref]:
On Wed, 16 Aug 2006, Mitsuhiro KOGA wrote:quoted
@@ -76,6 +76,63 @@ static struct usb_driver sisusb_driver; DEFINE_MUTEX(disconnect_mutex); +#ifdef __BIG_ENDIAN +static inline void sisusb_memcpy(u16 *dst, u16 *src, int count) +{ + while (count--) + *(dst++) = cpu_to_le16(*(src++)); +} +#else +static inline void sisusb_memcpy(u16 *dst, u16 *src, int count) +{ + memcpy(dst, src, count); +} +#endif + +#ifdef __BIG_ENDIAN +static inline void sisusb_order_wmem_24bit(char *src, u32 *dst) +{ + *dst = (*src << 16) | + (*(src + 1) << 8) | + *(src + 2); +} +#else +static inline void sisusb_order_wmem_24bit(char *src, u32 *dst) +{ + *dst = (*(src + 2) << 16) | + (*(src + 1) << 8) | + *src; +} +#endif + +#ifdef __BIG_ENDIAN +static inline void sisusb_order_rmem_24bit(u32 *src, char *dst) +{ + *dst = (*src >> 16) & 0xff; + *(dst + 1) = (*src >> 8) & 0xff; + *(dst + 2) = *src & 0xff; +} +#else +static inline void sisusb_order_rmem_24bit(u32 *src, char *dst) +{ + *(dst + 2) = (*src >> 16) & 0xff; + *(dst + 1) = (*src >> 8) & 0xff; + *dst = *src & 0xff; +} +#endif + +#ifdef __BIG_ENDIAN +static inline void sisusb_order_mem_32bit(u32 *src, u32 *dst) +{ + *dst = ((*src << 16) & 0xffff0000) | ((*src >> 16) & 0xffff); +} +#else +static inline void sisusb_order_mem_32bit(u32 *src, u32 *dst) +{ + *dst = *src; +} +#endif + static void sisusb_free_buffers(struct sisusb_usb_data *sisusb) {Why not merge the #ifdefs, so you need only one?
I think it is because legibly two functions of the same name queues up. Of course, both are not cared about either. -- Mitsuhiro KOGA [off-list ref] ------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ linux-usb-devel@lists.sourceforge.net To unsubscribe, use the last form field at: https://lists.sourceforge.net/lists/listinfo/linux-usb-devel