From: Andres Salomon <dilinger@queued.net>
To: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 3/3] OLPC: touchpad driver (take 2)
Date: Thu, 11 Sep 2008 14:32:16 -0400 [thread overview]
Message-ID: <20080911143216.3d618691@dev.queued.net> (raw)
In-Reply-To: <20080911090103.ZZRA012@mailhub.coreip.homeip.net>
On Thu, 11 Sep 2008 09:05:22 -0400
Dmitry Torokhov <dmitry.torokhov@gmail.com> wrote:
> On Thu, Sep 11, 2008 at 01:32:09AM -0400, Andres Salomon wrote:
> >
> > And here's the current touchpad driver after updating based upon
> > your comments.
> >
>
> Looks good. Care to respin it all thogether based on the attribute
> change I requested so I can be sure I'm applying the latest version of
> everything? Ummm....
>
Here's the patch. This is on top of the other 2 psmouse patches that
were previously sent.
From: Andres Salomon <dilinger@debian.org>
Subject: [PATCH] psmouse: tweak PSMOUSE_DEFINE_ATTR to support raw set callbacks
We want to support attr->set callbacks that may need psmouse->state to
not be updated, or may want to manually deal w/ enabling and disabling
the device. To do that, we create __PSMOUSE_DEFINE_ATTR which enables
us to set a 'protect' argument specifying whether or not the set
callback should be protected with psmouse_disable and state setting.
Signed-off-by: Andres Salomon <dilinger@debian.org>
---
drivers/input/mouse/psmouse-base.c | 30 +++++++++++++++++-------------
drivers/input/mouse/psmouse.h | 7 ++++++-
2 files changed, 23 insertions(+), 14 deletions(-)
diff --git a/drivers/input/mouse/psmouse-base.c b/drivers/input/mouse/psmouse-base.c
index 488ba95..f7278e6 100644
--- a/drivers/input/mouse/psmouse-base.c
+++ b/drivers/input/mouse/psmouse-base.c
@@ -1401,25 +1401,29 @@ ssize_t psmouse_attr_set_helper(struct device *dev, struct device_attribute *dev
psmouse = serio_get_drvdata(serio);
- if (psmouse->state == PSMOUSE_IGNORE) {
- retval = -ENODEV;
- goto out_unlock;
- }
+ if (attr->protect) {
+ if (psmouse->state == PSMOUSE_IGNORE) {
+ retval = -ENODEV;
+ goto out_unlock;
+ }
- if (serio->parent && serio->id.type == SERIO_PS_PSTHRU) {
- parent = serio_get_drvdata(serio->parent);
- psmouse_deactivate(parent);
- }
+ if (serio->parent && serio->id.type == SERIO_PS_PSTHRU) {
+ parent = serio_get_drvdata(serio->parent);
+ psmouse_deactivate(parent);
+ }
- psmouse_deactivate(psmouse);
+ psmouse_deactivate(psmouse);
+ }
retval = attr->set(psmouse, attr->data, buf, count);
- if (retval != -ENODEV)
- psmouse_activate(psmouse);
+ if (attr->protect) {
+ if (retval != -ENODEV)
+ psmouse_activate(psmouse);
- if (parent)
- psmouse_activate(parent);
+ if (parent)
+ psmouse_activate(parent);
+ }
out_unlock:
mutex_unlock(&psmouse_mutex);
diff --git a/drivers/input/mouse/psmouse.h b/drivers/input/mouse/psmouse.h
index 48e0112..0f13c1b 100644
--- a/drivers/input/mouse/psmouse.h
+++ b/drivers/input/mouse/psmouse.h
@@ -106,6 +106,7 @@ struct psmouse_attribute {
ssize_t (*show)(struct psmouse *psmouse, void *data, char *buf);
ssize_t (*set)(struct psmouse *psmouse, void *data,
const char *buf, size_t count);
+ int protect;
};
#define to_psmouse_attr(a) container_of((a), struct psmouse_attribute, dattr)
@@ -114,7 +115,7 @@ ssize_t psmouse_attr_show_helper(struct device *dev, struct device_attribute *at
ssize_t psmouse_attr_set_helper(struct device *dev, struct device_attribute *attr,
const char *buf, size_t count);
-#define PSMOUSE_DEFINE_ATTR(_name, _mode, _data, _show, _set) \
+#define __PSMOUSE_DEFINE_ATTR(_name, _mode, _data, _show, _set, _protect) \
static ssize_t _show(struct psmouse *, void *data, char *); \
static ssize_t _set(struct psmouse *, void *data, const char *, size_t); \
static struct psmouse_attribute psmouse_attr_##_name = { \
@@ -129,6 +130,10 @@ static struct psmouse_attribute psmouse_attr_##_name = { \
.data = _data, \
.show = _show, \
.set = _set, \
+ .protect = _protect, \
}
+#define PSMOUSE_DEFINE_ATTR(_name, _mode, _data, _show, _set) \
+ __PSMOUSE_DEFINE_ATTR(_name, _mode, _data, _show, _set, 1)
+
#endif /* _PSMOUSE_H */
--
1.5.6.5
next prev parent reply other threads:[~2008-09-11 18:32 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-08-13 19:24 [PATCH 3/3] OLPC: touchpad driver (take 2) Andres Salomon
2008-08-15 3:14 ` Dmitry Torokhov
2008-08-29 6:49 ` Andres Salomon
2008-09-10 13:00 ` Dmitry Torokhov
2008-09-10 21:55 ` Andres Salomon
2008-09-11 5:01 ` Andres Salomon
2008-09-11 5:32 ` Andres Salomon
2008-09-11 13:05 ` Dmitry Torokhov
2008-09-11 14:32 ` Andres Salomon
2008-09-11 18:32 ` Andres Salomon [this message]
2008-09-11 18:34 ` Andres Salomon
2008-09-11 12:59 ` Dmitry Torokhov
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=20080911143216.3d618691@dev.queued.net \
--to=dilinger@queued.net \
--cc=dmitry.torokhov@gmail.com \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/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).