From: Vatika Harlalka <vatikaharlalka@gmail.com>
To: outreachy-kernel@googlegroups.com
Subject: [PATCH] Staging: fbtbt: Move variable declarations to improve codestyle
Date: Thu, 12 Mar 2015 12:34:07 +0530 [thread overview]
Message-ID: <20150312070407.GA5718@akanksha> (raw)
Signed-off-by: Vatika Harlalka <vatikaharlalka@gmail.com>
---
drivers/staging/fbtft/fb_agm1264k-fl.c | 24 +++++++++++-------------
1 file changed, 11 insertions(+), 13 deletions(-)
diff --git a/drivers/staging/fbtft/fb_agm1264k-fl.c b/drivers/staging/fbtft/fb_agm1264k-fl.c
index 9d74b23..2ec607d 100644
--- a/drivers/staging/fbtft/fb_agm1264k-fl.c
+++ b/drivers/staging/fbtft/fb_agm1264k-fl.c
@@ -275,22 +275,25 @@ static int write_vmem(struct fbtft_par *par, size_t offset, size_t len)
{
u16 *vmem16 = (u16 *)par->info->screen_base;
u8 *buf = par->txbuf.buf;
+ u16 i, j, b, g, r;
int x, y;
int ret = 0;
+ s16 pixel, error_b, error_w, error, *write_pos;
+ s8 coeff;
/* buffer to convert RGB565 -> grayscale16 -> Ditherd image 1bpp */
- signed short *convert_buf = kmalloc(par->info->var.xres *
+ s16 *convert_buf = kmalloc(par->info->var.xres *
par->info->var.yres * sizeof(signed short), GFP_NOIO);
-
fbtft_par_dbg(DEBUG_WRITE_VMEM, par, "%s()\n", __func__);
/* converting to grayscale16 */
for (x = 0; x < par->info->var.xres; ++x)
for (y = 0; y < par->info->var.yres; ++y) {
u16 pixel = vmem16[y * par->info->var.xres + x];
- u16 b = pixel & 0x1f;
- u16 g = (pixel & (0x3f << 5)) >> 5;
- u16 r = (pixel & (0x1f << (5 + 6))) >> (5 + 6);
+
+ b = pixel & 0x1f;
+ g = (pixel & (0x3f << 5)) >> 5;
+ r = (pixel & (0x1f << (5 + 6))) >> (5 + 6);
pixel = (299 * r + 587 * g + 114 * b) / 200;
if (pixel > 255)
@@ -304,12 +307,9 @@ static int write_vmem(struct fbtft_par *par, size_t offset, size_t len)
/* Image Dithering */
for (x = 0; x < par->info->var.xres; ++x)
for (y = 0; y < par->info->var.yres; ++y) {
- signed short pixel =
- convert_buf[y * par->info->var.xres + x];
- signed short error_b = pixel - BLACK;
- signed short error_w = pixel - WHITE;
- signed short error;
- u16 i, j;
+ pixel = convert_buf[y * par->info->var.xres + x];
+ error_b = pixel - BLACK;
+ error_w = pixel - WHITE;
/* what color close? */
if (abs(error_b) >= abs(error_w)) {
@@ -328,8 +328,6 @@ static int write_vmem(struct fbtft_par *par, size_t offset, size_t len)
for (i = 0; i < DIFFUSING_MATRIX_WIDTH; ++i)
/* diffusion matrix column */
for (j = 0; j < DIFFUSING_MATRIX_HEIGHT; ++j) {
- signed short *write_pos;
- signed char coeff;
/* skip pixels out of zone */
if (x + i < 0 ||
--
1.9.1
next reply other threads:[~2015-03-12 7:05 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-12 7:04 Vatika Harlalka [this message]
2015-03-15 10:45 ` [Outreachy kernel] [PATCH] Staging: fbtbt: Move variable declarations to improve codestyle Greg KH
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=20150312070407.GA5718@akanksha \
--to=vatikaharlalka@gmail.com \
--cc="Thedatatypesarereplacedwithtypedefsandthedeclarationsaremovedabovesoastofollowkernelcodingconventions."@akanksha \
--cc=outreachy-kernel@googlegroups.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.