From: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-fbdev-devel@lists.sourceforge.net,
yoichi_yuasa@tripeaks.co.jp, ralf@linux-mips.org,
linux-mips@linux-mips.org
Subject: Re: [PATCH][1/2] add new Cobalt LCD framebuffer driver
Date: Tue, 24 Jun 2008 14:15:15 -0700 [thread overview]
Message-ID: <20080624141515.f710969a.akpm@linux-foundation.org> (raw)
In-Reply-To: <20080624224654.1ef3d665.yoichi_yuasa@tripeaks.co.jp>
On Tue, 24 Jun 2008 22:46:54 +0900
Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp> wrote:
> Add new Cobalt LCD framebuffer driver.
>
> Signed-off-by: Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp>
>
>
> ...
>
> +static ssize_t cobalt_lcdfb_read(struct fb_info *info, char __user *buf,
> + size_t count, loff_t *ppos)
> +{
> + char src[LCD_CHARS_MAX];
> + unsigned long pos;
> + int len, retval;
> +
> + pos = *ppos;
> + if (pos >= LCD_CHARS_MAX)
> + return 0;
> +
> + if (pos + count >= LCD_CHARS_MAX)
> + count = LCD_CHARS_MAX - pos;
I think if sizeof(pos) == sizeof(count), and `count' is sufficiently
large (eg: 0xffffffff) then bad things will happen in this function.
> + for (len = 0; len < count; len++) {
> + retval = lcd_busy_wait(info);
> + if (retval < 0)
> + break;
> +
> + lcd_write_control(info, LCD_TEXT_POS(pos));
> +
> + retval = lcd_busy_wait(info);
> + if (retval < 0)
> + break;
> +
> + src[len] = lcd_read_data(info);
> + if (pos == 0x0f)
> + pos = 0x40;
> + else
> + pos++;
> + }
> +
> + if (copy_to_user(buf, src, len))
> + return -EFAULT;
> +
> + *ppos += len;
> +
> + return len;
> +}
> +
> +static ssize_t cobalt_lcdfb_write(struct fb_info *info, const char __user *buf,
> + size_t count, loff_t *ppos)
> +{
> + char dst[LCD_CHARS_MAX];
> + unsigned long pos;
> + int len, retval;
> +
> + pos = *ppos;
> + if (pos >= LCD_CHARS_MAX)
> + return 0;
> +
> + if (pos + count >= LCD_CHARS_MAX)
> + count = LCD_CHARS_MAX - pos;
Ditto.
> + if (copy_from_user(dst, buf, count))
> + return -EFAULT;
> +
> + for (len = 0; len < count; len++) {
> + retval = lcd_busy_wait(info);
> + if (retval < 0)
> + break;
> +
> + lcd_write_control(info, LCD_TEXT_POS(pos));
> +
> + retval = lcd_busy_wait(info);
> + if (retval < 0)
> + break;
> +
> + lcd_write_data(info, dst[len]);
> + if (pos == 0x0f)
> + pos = 0x40;
> + else
> + pos++;
> + }
> +
> + *ppos += len;
> +
> + return len;
> +}
Is there any real benefit in this handling of signal_pending()? afaict
it is done correctly, but why did we bother doing it?
next prev parent reply other threads:[~2008-06-24 21:15 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-06-24 13:46 [PATCH][1/2] add new Cobalt LCD framebuffer driver Yoichi Yuasa
2008-06-24 21:15 ` Andrew Morton [this message]
2008-06-25 13:46 ` Yoichi Yuasa
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=20080624141515.f710969a.akpm@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=linux-fbdev-devel@lists.sourceforge.net \
--cc=linux-mips@linux-mips.org \
--cc=ralf@linux-mips.org \
--cc=yoichi_yuasa@tripeaks.co.jp \
/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).