Input: tsc2005 - remove 'disable' sysfs attribute
I believe that enable/disable functionality should not be implemented on the individual driver level but rather in device core, potentially reusing parts of PM framework. Therefore the driver-specific "disable" attribute is removed from the mainline driver. Tested-by: Aaro Koskinen <aaro.koskinen@nokia.com> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
This commit is contained in:
@@ -138,7 +138,6 @@ struct tsc2005 {
|
|||||||
|
|
||||||
unsigned int x_plate_ohm;
|
unsigned int x_plate_ohm;
|
||||||
|
|
||||||
bool disabled;
|
|
||||||
bool opened;
|
bool opened;
|
||||||
bool suspended;
|
bool suspended;
|
||||||
|
|
||||||
@@ -365,48 +364,6 @@ static void __tsc2005_enable(struct tsc2005 *ts)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t tsc2005_disable_show(struct device *dev,
|
|
||||||
struct device_attribute *attr, char *buf)
|
|
||||||
{
|
|
||||||
struct spi_device *spi = to_spi_device(dev);
|
|
||||||
struct tsc2005 *ts = spi_get_drvdata(spi);
|
|
||||||
|
|
||||||
return sprintf(buf, "%u\n", ts->disabled);
|
|
||||||
}
|
|
||||||
|
|
||||||
static ssize_t tsc2005_disable_store(struct device *dev,
|
|
||||||
struct device_attribute *attr,
|
|
||||||
const char *buf, size_t count)
|
|
||||||
{
|
|
||||||
struct spi_device *spi = to_spi_device(dev);
|
|
||||||
struct tsc2005 *ts = spi_get_drvdata(spi);
|
|
||||||
unsigned long val;
|
|
||||||
int error;
|
|
||||||
|
|
||||||
error = strict_strtoul(buf, 10, &val);
|
|
||||||
if (error)
|
|
||||||
return error;
|
|
||||||
|
|
||||||
mutex_lock(&ts->mutex);
|
|
||||||
|
|
||||||
if (!ts->suspended && ts->opened) {
|
|
||||||
if (val) {
|
|
||||||
if (!ts->disabled)
|
|
||||||
__tsc2005_disable(ts);
|
|
||||||
} else {
|
|
||||||
if (ts->disabled)
|
|
||||||
__tsc2005_enable(ts);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ts->disabled = !!val;
|
|
||||||
|
|
||||||
mutex_unlock(&ts->mutex);
|
|
||||||
|
|
||||||
return count;
|
|
||||||
}
|
|
||||||
static DEVICE_ATTR(disable, 0664, tsc2005_disable_show, tsc2005_disable_store);
|
|
||||||
|
|
||||||
static ssize_t tsc2005_selftest_show(struct device *dev,
|
static ssize_t tsc2005_selftest_show(struct device *dev,
|
||||||
struct device_attribute *attr,
|
struct device_attribute *attr,
|
||||||
char *buf)
|
char *buf)
|
||||||
@@ -489,7 +446,6 @@ out:
|
|||||||
static DEVICE_ATTR(selftest, S_IRUGO, tsc2005_selftest_show, NULL);
|
static DEVICE_ATTR(selftest, S_IRUGO, tsc2005_selftest_show, NULL);
|
||||||
|
|
||||||
static struct attribute *tsc2005_attrs[] = {
|
static struct attribute *tsc2005_attrs[] = {
|
||||||
&dev_attr_disable.attr,
|
|
||||||
&dev_attr_selftest.attr,
|
&dev_attr_selftest.attr,
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
@@ -567,7 +523,7 @@ static int tsc2005_open(struct input_dev *input)
|
|||||||
|
|
||||||
mutex_lock(&ts->mutex);
|
mutex_lock(&ts->mutex);
|
||||||
|
|
||||||
if (!ts->suspended && !ts->disabled)
|
if (!ts->suspended)
|
||||||
__tsc2005_enable(ts);
|
__tsc2005_enable(ts);
|
||||||
|
|
||||||
ts->opened = true;
|
ts->opened = true;
|
||||||
@@ -583,7 +539,7 @@ static void tsc2005_close(struct input_dev *input)
|
|||||||
|
|
||||||
mutex_lock(&ts->mutex);
|
mutex_lock(&ts->mutex);
|
||||||
|
|
||||||
if (!ts->suspended && !ts->disabled)
|
if (!ts->suspended)
|
||||||
__tsc2005_disable(ts);
|
__tsc2005_disable(ts);
|
||||||
|
|
||||||
ts->opened = false;
|
ts->opened = false;
|
||||||
@@ -743,7 +699,7 @@ static int tsc2005_suspend(struct device *dev)
|
|||||||
|
|
||||||
mutex_lock(&ts->mutex);
|
mutex_lock(&ts->mutex);
|
||||||
|
|
||||||
if (!ts->suspended && !ts->disabled && ts->opened)
|
if (!ts->suspended && ts->opened)
|
||||||
__tsc2005_disable(ts);
|
__tsc2005_disable(ts);
|
||||||
|
|
||||||
ts->suspended = true;
|
ts->suspended = true;
|
||||||
@@ -760,7 +716,7 @@ static int tsc2005_resume(struct device *dev)
|
|||||||
|
|
||||||
mutex_lock(&ts->mutex);
|
mutex_lock(&ts->mutex);
|
||||||
|
|
||||||
if (ts->suspended && !ts->disabled && ts->opened)
|
if (ts->suspended && ts->opened)
|
||||||
__tsc2005_enable(ts);
|
__tsc2005_enable(ts);
|
||||||
|
|
||||||
ts->suspended = false;
|
ts->suspended = false;
|
||||||
|
Reference in New Issue
Block a user