From: Wu Zhangjin <wuzhangjin@gmail.com>
To: Ralf Baechle <ralf@linux-mips.org>
Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>,
linux-mips@linux-mips.org, zhangfx@lemote.com, yanh@lemote.com,
huhb@lemote.com, linux-input@vger.kernel.org
Subject: Re: [PATCH v5 8/8] Loongson: YeeLoong: add hotkey driver
Date: Mon, 30 Nov 2009 13:18:15 +0800 [thread overview]
Message-ID: <1259558295.5516.5.camel@falcon.domain.org> (raw)
In-Reply-To: <739db9c7b5bab429d0df5a7c68f301aa12f1402d.1259414649.git.wuzhangjin@gmail.com>
On Sat, 2009-11-28 at 21:44 +0800, Wu Zhangjin wrote:
[...]
> +
> +static int camera_handler(int status)
> +{
> + int value;
> + static int camera_status;
> +
> + status = !!status;
> + camera_status = ec_read(REG_CAMERA_STATUS);
> + if (status != camera_status) {
> + value = ec_read(REG_CAMERA_CONTROL);
> + ec_write(REG_CAMERA_CONTROL, value | (1 << 1));
> + }
> + return ec_read(REG_CAMERA_STATUS);
> +}
The above stuff is very awful, the camera event work as a switch, so
this is enough:
static int camera_handler(int status)
{
int value;
value = ec_read(REG_CAMERA_CONTROL);
ec_write(REG_CAMERA_CONTROL, value | (1 << 1));
return status;
}
[...]
> +/*
> + * SCI(system control interrupt) main interrupt routine
> + *
> + * We will do the query and get event number together so the interrupt routine
> + * should be longer than 120us now at least 3ms elpase for it.
> + */
> +static irqreturn_t sci_irq_handler(int irq, void *dev_id)
> +{
> + int ret;
> +
> + if (SCI_IRQ_NUM != irq)
> + return IRQ_NONE;
> +
> + /* Query the event number */
> + ret = ec_query_event_num();
> + if (ret < 0)
> + return IRQ_NONE;
> +
> + event = ec_get_event_num();
> + if (event < 0)
> + return IRQ_NONE;
> +
> + if ((event != 0x00) && (event != 0xff)) {
It's better to use somethig else:
if (event >= EVENT_START && event <= EVENT_END) {
....
Best Regards,
Wu Zhangjin
prev parent reply other threads:[~2009-11-30 5:18 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <cover.1259414649.git.wuzhangjin@gmail.com>
2009-11-28 13:44 ` [PATCH v5 8/8] Loongson: YeeLoong: add hotkey driver Wu Zhangjin
2009-11-29 5:35 ` Dmitry Torokhov
2009-11-29 5:50 ` Wu Zhangjin
2009-11-29 7:29 ` Ralf Baechle
2009-11-29 7:40 ` Wu Zhangjin
2009-11-30 5:18 ` Wu Zhangjin [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=1259558295.5516.5.camel@falcon.domain.org \
--to=wuzhangjin@gmail.com \
--cc=dmitry.torokhov@gmail.com \
--cc=huhb@lemote.com \
--cc=linux-input@vger.kernel.org \
--cc=linux-mips@linux-mips.org \
--cc=ralf@linux-mips.org \
--cc=yanh@lemote.com \
--cc=zhangfx@lemote.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 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).