Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 115068
b: refs/heads/master
c: 68d4822
h: refs/heads/master
v: v3
  • Loading branch information
Andres Salomon authored and Dmitry Torokhov committed Sep 21, 2008
1 parent 4be073d commit ff6592e
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 15 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 8bf020ee9650899a45295d0c3a0744d4d1bf2801
refs/heads/master: 68d482214bb0eaac138ace329e72390d6c8d44ff
30 changes: 17 additions & 13 deletions trunk/drivers/input/mouse/psmouse-base.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
7 changes: 6 additions & 1 deletion trunk/drivers/input/mouse/psmouse.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand All @@ -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 = { \
Expand All @@ -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 */

0 comments on commit ff6592e

Please sign in to comment.