linux-fbdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Antonino A. Daplas" <adaplas@gmail.com>
To: linux-fbdev-devel@lists.sourceforge.net
Cc: akpm@osdl.org, thomas@winischhofer.net,
	linux-usb-devel@lists.sourceforge.net
Subject: Re: [PATCH 2.6.18-rc4] sisusbvga: fix sisusb.c
Date: Tue, 15 Aug 2006 08:09:11 +0800	[thread overview]
Message-ID: <1155600551.3917.25.camel@daplas.org> (raw)
In-Reply-To: <6cb5f1c10608131347s69e2c1adgf0a72041314d6bf0@mail.gmail.com>

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 <shiena.jp@gmail.com>
> Cc: linux-usb-devel@lists.sourceforge.net
> Cc: linux-fbdev-devel@lists.sourceforge.net
> ---
>  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
> Linux-fbdev-devel@lists.sourceforge.net
> 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

  reply	other threads:[~2006-08-15  0:09 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-08-13 20:47 [PATCH 2.6.18-rc4] sisusbvga: fix sisusb.c Mitsuhiro KOGA
2006-08-15  0:09 ` Antonino A. Daplas [this message]
2006-08-16 11:31   ` Mitsuhiro KOGA
2006-08-16 11:41     ` [Linux-fbdev-devel] " Geert Uytterhoeven
2006-08-16 12:06       ` Mitsuhiro KOGA
2006-08-16 12:56     ` Antonino A. Daplas
2006-08-16 15:33       ` Mitsuhiro KOGA
2006-08-24  6:34         ` Mitsuhiro KOGA
  -- strict thread matches above, loose matches on Subject: below --
2006-08-13 21:13 Mitsuhiro KOGA

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=1155600551.3917.25.camel@daplas.org \
    --to=adaplas@gmail.com \
    --cc=akpm@osdl.org \
    --cc=linux-fbdev-devel@lists.sourceforge.net \
    --cc=linux-usb-devel@lists.sourceforge.net \
    --cc=thomas@winischhofer.net \
    /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).