On Mon, 2006-08-14 at 05:47 +0900, Mitsuhiro KOGA wrote:

Added the author to the CC list.

It would be better if you remove the #ifdef within the functions.
So something like...

> I had a problem with usb2vga and ppc linux.
> The background of the console greens, and the font is not displayed.
> 
> This patch can be normally displayed by the Big endian machine.
> Moreover, because KAIREN's usb2vga has two or more devices id, it adds it.
> 
> Signed-off-by: Mitsuhiro Koga <[EMAIL PROTECTED]>
> Cc: linux-usb-devel@lists.sourceforge.net
> Cc: [EMAIL PROTECTED]
> ---
>  drivers/usb/misc/sisusbvga/sisusb.c      |   27 ++++++++++++++++++++++++++-
>  1 files changed, 26 insertions(+), 1 deletions(-)
> --- a/drivers/usb/misc/sisusbvga/sisusb.c
> +++ b/drivers/usb/misc/sisusbvga/sisusb.c
> @@ -76,6 +76,16 @@
> 
>  DEFINE_MUTEX(disconnect_mutex);
> 
> +#ifdef __BIG_ENDIAN
> +static void
> +correct_endianness_buffer(u16* data, const int length)
> +{
> +   int i;
> +   for (i = 0; i < length; i++)
> +       *(data+i) = cpu_to_le16(*(data+i));
> +}
> +#endif
> +
>  static void
>  sisusb_free_buffers(struct sisusb_usb_data *sisusb)
>  {
> @@ -411,6 +421,10 @@
>             memcpy(buffer, kernbuffer, passsize);
>             kernbuffer += passsize;
> 
> +#ifdef __BIG_ENDIAN
> +           if ((len & 3) == 0)
> +               correct_endianness_buffer((u16 *)buffer, thispass/2);
> +#endif
>         }
> 

#ifdef __LITTLE_ENDIAN
static inline void sisusb_memcpy(void *d, void *s, int count)
{
        memcpy(d, s, count);
}
#else
static inline void sisusb_memcpy(void *d, void *s, int count)
{
        memcpy_and_reverse(d, s, count);
}
#endif

>         retry = 5;
> @@ -906,9 +920,13 @@
>             if (userbuffer) {
>                 if (get_user(swap32, (u32 __user *)userbuffer))
>                     return -EFAULT;
> -           } else
> +           } else {
>                 swap32 = *((u32 *)kernbuffer);
> 
> +#ifdef __BIG_ENDIAN
> +               swap32 = ((swap32 << 16) & 0xffff0000) | ((swap32 >>
> 16) & 0xffff);
> +#endif
> +           }
>             ret = sisusb_write_memio_long(sisusb,
>                             SISUSB_TYPE_MEM,
>                             addr,
> @@ -1259,7 +1277,11 @@
> 
>                     userbuffer += 4;
>                 } else {
> +#ifdef __BIG_ENDIAN
> +                   *((u32 *)kernbuffer) = ((swap32 << 16) &
> 0xffff0000) | ((swap32 >> 16) & 0xffff);
> +#else
>                     *((u32 *)kernbuffer) = swap32;
> +#endif
>                     kernbuffer += 4;
>                 }

And for the above 2, something like...

#ifdef __BIG_ENDIAN
static inline void sisusb_reverse(u32 *s, u32 *d)
{
        *d = ((*s << 16) & 0xffff0000) | ((*s >> 16) & 0xffff);
}
#else
static inline void sisiusb_reverse(u32 *s, u32 *d)
{
        *d = *s;
}
#endif

Tony
>                 addr += 4;
> @@ -3435,6 +3457,9 @@
> 
>  static struct usb_device_id sisusb_table [] = {
>     { USB_DEVICE(0x0711, 0x0900) },
> +   { USB_DEVICE(0x0711, 0x0901) },
> +   { USB_DEVICE(0x0711, 0x0902) },
> +   { USB_DEVICE(0x0711, 0x0920) },
>     { USB_DEVICE(0x182d, 0x021c) },
>     { USB_DEVICE(0x182d, 0x0269) },
>     { }
> 
> -------------------------------------------------------------------------
> 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-fbdev-devel mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/linux-fbdev-devel


-------------------------------------------------------------------------
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

Reply via email to