Input: 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> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
This commit is contained in:

committed by
Dmitry Torokhov

parent
8bf020ee96
commit
68d482214b
@@ -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);
|
||||
|
Reference in New Issue
Block a user