From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Robert Love <rml@novell.com>
Cc: Andrew Morton <akpm@osdl.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [patch] IBM HDAPS accelerometer driver, with probing.
Date: Fri, 26 Aug 2005 17:44:39 -0500 [thread overview]
Message-ID: <d120d50005082615445557d776@mail.gmail.com> (raw)
In-Reply-To: <1125094725.18155.120.camel@betsy>
On 8/26/05, Robert Love <rml@novell.com> wrote:
> +static void hdaps_calibrate(void)
> +{
> + int x, y, ret;
> +
> + ret = accelerometer_read_pair(HDAPS_PORT_XPOS, HDAPS_PORT_YPOS, &x, &y);
> + if (unlikely(ret))
> + return;
> +
> + rest_x = x;
> + rest_y = y;
> +}
Is this function used in a hot path to warrant using "unlikely"? There
are to many "unlikely" in the code for my taste.
> +
> +static ssize_t hdaps_mousedev_store(struct device *dev,
> + struct device_attribute *attr,
> + const char *buf, size_t count)
> +{
> + int enable;
> +
> + if (sscanf(buf, "%d", &enable) != 1)
> + return -EINVAL;
> +
> + spin_lock(&hdaps_lock);
> + if (enable == 1)
> + hdaps_mousedev_enable();
> + else if (enable == 0)
> + hdaps_mousedev_disable();
> + spin_unlock(&hdaps_lock);
> +
> + return count;
> +}
input_[un]register_device and del_timer_sync are "long" operations. I
think a semaphore would be better here.
--
Dmitry
next prev parent reply other threads:[~2005-08-26 22:44 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-08-26 22:18 [patch] IBM HDAPS accelerometer driver, with probing Robert Love
2005-08-26 22:44 ` Dmitry Torokhov [this message]
2005-08-26 23:37 ` Robert Love
2005-08-27 5:29 ` Arnaldo Carvalho de Melo
2005-08-27 14:45 ` Alan Cox
2005-08-26 22:58 ` Alexey Dobriyan
2005-08-26 23:15 ` David S. Miller
2005-08-27 2:34 ` Andi Kleen
2005-08-27 2:49 ` David S. Miller
2005-08-27 4:06 ` Mitchell Blank Jr
2005-08-27 5:34 ` Arnaldo Carvalho de Melo
2005-08-27 6:12 ` Dmitry Torokhov
2005-08-27 11:35 ` Alexey Dobriyan
2005-08-27 14:56 ` Andi Kleen
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=d120d50005082615445557d776@mail.gmail.com \
--to=dmitry.torokhov@gmail.com \
--cc=akpm@osdl.org \
--cc=dtor_core@ameritech.net \
--cc=linux-kernel@vger.kernel.org \
--cc=rml@novell.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