From: Marek Vasut <marek.vasut@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v3 1/4] PXA: PXA27x Matrix keypad driver
Date: Fri, 13 Jan 2012 17:50:22 +0100 [thread overview]
Message-ID: <201201131750.22388.marek.vasut@gmail.com> (raw)
In-Reply-To: <1326460438.1800.6.camel@anarsoul-laptop.lan>
> On Fri, 2012-01-13 at 13:41 +0100, Marek Vasut wrote:
> > > +#define KPDK_DK1 (0x1 << 1)
> > > +#define KPDK_DK0 (0x1 << 0)
> >
> > Drop those two spaces here
>
> Two spaces? It's tabs! Btw, it's for good looking formatting and
> it was taken from pxa-regs.h. I'd like to preserve it like it is.
Then change it to space ... (1 <<[TAB]3) is even weirder. And on my side, it
still looks like two spaces.
>
> > > +static unsigned char queue[64] = {0};
> > > +static int queue_len;
> > > +static struct pxa_keypad_regs *regs;
> >
> > You can as well assign it here.
>
> Ok
>
> > > +static int scan_keys(int scan_modif, uint32_t kpasmkp[4])
> > > +{
> > > + uint32_t reg = 0;
> > > + int col, row;
> > > + static int mod = MOD_NONE;
> >
> > Are you sure you know what you're doing using all those static vars all
> > around?
>
> I'm sure I know what I'm doing, right here it preserves modifier between
> two function calls, i.e. scan_keys(1, ...); scan_keys(0, ...);
>
> > > + if ((reg >> 16) & (1 << row)) {
> > > + if (scan_modif) {
> > > + mod = kbd_get_mdf(row, col + 1);
> > > + if (mod != MOD_NONE)
> > > + return mod;
> > > + } else {
> > > + key = kbd_lookup(row, col + 1, mod);
> > > + if (key != 0xff)
> > > + return key;
> > > + }
> >
> > Can you do some elegant solution of this code duplication?
>
> Ok
>
> > > + }
> > > + }
> > > + }
> >
> > Newline
>
> Ok
>
> > > + /* wait for scan to finish */
> > > + while (timeout--) {
> > > + if (!(readl(®s->kpc) & KPC_AS))
> > > + break;
> > > + udelay(10);
> >
> > Use WATCHDOG_RESET()
>
> Why the heck you want to reset here? It's not fatal. We can handle this
> timeout gracefully, without resetting and messing up all the stuff.
WATCHDOG_RESET() reloads the WDT ...
>
> > > + } else {
> > > + key_counter = 0;
> > > + last_key_row = last_key_col = 0xff;
> > > + scan_keys(0, kpasmkp_diff);
> > > + serial_printf("New key\n");
> >
> > What's this dammit? And above too! Use debug() if you need it.
>
> Sorry, left it occasionally.
>
> > > + kbddev.getc = kbd_getc ;
> > > + kbddev.tstc = kbd_testc ;
> >
> > Drop spaces before semicolon
>
> Ok
>
> Thanks for review!
>
> Regards,
> Vasily
prev parent reply other threads:[~2012-01-13 16:50 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-01-13 7:11 [U-Boot] [PATCH v3 1/4] PXA: PXA27x Matrix keypad driver Vasily Khoruzhick
2012-01-13 7:11 ` [U-Boot] [PATCH v3 2/4] zipitz2: enable pxa27x_mkp driver Vasily Khoruzhick
2012-01-13 7:11 ` [U-Boot] [PATCH v3 3/4] zipitz2: use pxa_mmc_gen as MMC driver Vasily Khoruzhick
2012-01-13 12:35 ` Marek Vasut
2012-01-13 13:15 ` Vasily Khoruzhick
2012-01-13 16:48 ` Marek Vasut
2012-01-13 7:11 ` [U-Boot] [PATCH v3 4/4] zipitz2: fix boot issue introduced by PXA low level init rework Vasily Khoruzhick
2012-01-13 12:39 ` Marek Vasut
2012-01-13 12:41 ` [U-Boot] [PATCH v3 1/4] PXA: PXA27x Matrix keypad driver Marek Vasut
2012-01-13 13:13 ` Vasily Khoruzhick
2012-01-13 16:50 ` Marek Vasut [this message]
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=201201131750.22388.marek.vasut@gmail.com \
--to=marek.vasut@gmail.com \
--cc=u-boot@lists.denx.de \
/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