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.
Date: Fri, 26 Aug 2005 14:27:37 -0500 [thread overview]
Message-ID: <d120d500050826122768cd3612@mail.gmail.com> (raw)
In-Reply-To: <1125069494.18155.27.camel@betsy>
On 8/26/05, Robert Love <rml@novell.com> wrote:
> +/* device class stuff */
> +
> +static DECLARE_COMPLETION(hdaps_obj_is_free);
> +static void hdaps_release_dev(struct device *dev)
> +{
> + complete(&hdaps_obj_is_free);
> +}
> +
What this completion is used for? I don't see any other references to it.
> +
> +static void hdaps_mousedev_poll(unsigned long unused)
> +{
> + int movex, movey, x, y, ret;
> +
> + ret = accelerometer_read_pair(HDAPS_PORT_XPOS, HDAPS_PORT_YPOS, &x, &y);
> + if (unlikely(ret))
> + return;
> +
> + movex = rest_x - x;
> + movey = rest_y - y;
> + if (abs(movex) > hdaps_mousedev_threshold)
> + input_report_rel(&hdaps_idev, REL_Y, movex);
> + if (abs(movey) > hdaps_mousedev_threshold)
> + input_report_rel(&hdaps_idev, REL_X, movey);
> + input_sync(&hdaps_idev);
> +
> + mod_timer(&hdaps_poll_timer, jiffies + msecs_to_jiffies(hdaps_poll_ms));
> +}
> +
I'd rather you used absolute coordinates and set up
hdaps_idev->absfuzz to do the filtering.
> +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\n", &enable) != 1)
> + return -EINVAL;
> +
> + if (enable == 1)
> + hdaps_mousedev_enable();
> + else if (enable == 0)
> + hdaps_mousedev_disable();
> +
> + return count;
> +}
> +
This is racy - 2 threads can try to do this simultaneously.
> +
> + device_create_file(&hdaps_plat_dev.dev, &dev_attr_position);
> + device_create_file(&hdaps_plat_dev.dev, &dev_attr_variance);
> + device_create_file(&hdaps_plat_dev.dev, &dev_attr_temp);
> + device_create_file(&hdaps_plat_dev.dev, &dev_attr_calibrate);
> + device_create_file(&hdaps_plat_dev.dev, &dev_attr_mousedev);
> + device_create_file(&hdaps_plat_dev.dev, &dev_attr_mousedev_threshold);
> + device_create_file(&hdaps_plat_dev.dev, &dev_attr_mousedev_poll_ms);
> +
What about using sysfs_attribute_group?
--
Dmitry
next prev parent reply other threads:[~2005-08-26 19:27 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-08-26 15:18 [patch] IBM HDAPS accelerometer driver Robert Love
2005-08-26 17:05 ` Bill Nottingham
2005-08-26 17:15 ` Robert Love
2005-08-26 17:33 ` Brian Gerst
2005-08-26 17:33 ` Robert Love
2005-08-26 18:01 ` Arjan van de Ven
2005-08-26 18:03 ` Robert Love
2005-08-26 18:45 ` Dave Jones
2005-08-26 18:52 ` Robert Love
2005-08-26 19:55 ` Alan Cox
2005-08-26 19:29 ` Robert Love
2005-08-26 19:33 ` Jeff Garzik
2005-08-26 19:37 ` Robert Love
2005-08-26 20:21 ` Alan Cox
2005-08-26 22:43 ` Andi Kleen
2005-08-26 20:27 ` Dave Jones
2005-08-26 19:54 ` Alan Cox
2005-08-26 18:18 ` Andrew Morton
2005-08-26 18:30 ` Robert Love
2005-08-26 19:27 ` Dmitry Torokhov [this message]
2005-08-26 19:39 ` Robert Love
2005-08-26 19:43 ` Robert Love
2005-08-26 20:09 ` Dmitry Torokhov
2005-08-26 20:12 ` Dmitry Torokhov
2005-08-28 11:00 ` Yani Ioannou
2005-08-27 12:41 ` Pavel Machek
2005-08-28 2:59 ` Mikulas Patocka
2005-08-28 8:09 ` Pavel Machek
2005-08-28 9:21 ` Oliver Neukum
2005-08-28 19:30 ` Mikulas Patocka
2005-08-29 8:35 ` Pavel Machek
2005-08-29 8:59 ` Oliver Neukum
2005-08-29 9:10 ` Pavel Machek
2005-08-30 17:44 ` Mikulas Patocka
2005-08-31 0:12 ` Yani Ioannou
[not found] <4FOa3-8fm-39@gated-at.bofh.it>
[not found] ` <4GlyV-3Rk-3@gated-at.bofh.it>
[not found] ` <4GqyE-2bk-19@gated-at.bofh.it>
[not found] ` <4GrEp-3E2-21@gated-at.bofh.it>
2005-08-28 16:26 ` Robert Hancock
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=d120d500050826122768cd3612@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