aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input/tablet
diff options
context:
space:
mode:
authorDmitry Torokhov <dmitry.torokhov@gmail.com>2008-10-15 23:29:12 -0400
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2008-10-15 23:29:12 -0400
commit4c0e799a9a6dc64426ddb6c03aea1a154357658f (patch)
tree2d9aa9493d80fceb178a63bf15bb3d9edfc5fbae /drivers/input/tablet
parent3fa8749e584b55f1180411ab1b51117190bac1e5 (diff)
parentb8d055a878ee0f997ded40649701089d2486f850 (diff)
Merge branch 'next' into for-linus
Diffstat (limited to 'drivers/input/tablet')
-rw-r--r--drivers/input/tablet/aiptek.c53
1 files changed, 38 insertions, 15 deletions
diff --git a/drivers/input/tablet/aiptek.c b/drivers/input/tablet/aiptek.c
index 8f037a1d44a6..e53c838f1866 100644
--- a/drivers/input/tablet/aiptek.c
+++ b/drivers/input/tablet/aiptek.c
@@ -1202,16 +1202,22 @@ static ssize_t
1202store_tabletXtilt(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) 1202store_tabletXtilt(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
1203{ 1203{
1204 struct aiptek *aiptek = dev_get_drvdata(dev); 1204 struct aiptek *aiptek = dev_get_drvdata(dev);
1205 int x; 1205 long x;
1206
1207 if (strict_strtol(buf, 10, &x)) {
1208 size_t len = buf[count - 1] == '\n' ? count - 1 : count;
1209
1210 if (strncmp(buf, "disable", len))
1211 return -EINVAL;
1206 1212
1207 if (strcmp(buf, "disable") == 0) {
1208 aiptek->newSetting.xTilt = AIPTEK_TILT_DISABLE; 1213 aiptek->newSetting.xTilt = AIPTEK_TILT_DISABLE;
1209 } else { 1214 } else {
1210 x = (int)simple_strtol(buf, NULL, 10); 1215 if (x < AIPTEK_TILT_MIN || x > AIPTEK_TILT_MAX)
1211 if (x >= AIPTEK_TILT_MIN && x <= AIPTEK_TILT_MAX) { 1216 return -EINVAL;
1212 aiptek->newSetting.xTilt = x; 1217
1213 } 1218 aiptek->newSetting.xTilt = x;
1214 } 1219 }
1220
1215 return count; 1221 return count;
1216} 1222}
1217 1223
@@ -1238,16 +1244,22 @@ static ssize_t
1238store_tabletYtilt(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) 1244store_tabletYtilt(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
1239{ 1245{
1240 struct aiptek *aiptek = dev_get_drvdata(dev); 1246 struct aiptek *aiptek = dev_get_drvdata(dev);
1241 int y; 1247 long y;
1248
1249 if (strict_strtol(buf, 10, &y)) {
1250 size_t len = buf[count - 1] == '\n' ? count - 1 : count;
1251
1252 if (strncmp(buf, "disable", len))
1253 return -EINVAL;
1242 1254
1243 if (strcmp(buf, "disable") == 0) {
1244 aiptek->newSetting.yTilt = AIPTEK_TILT_DISABLE; 1255 aiptek->newSetting.yTilt = AIPTEK_TILT_DISABLE;
1245 } else { 1256 } else {
1246 y = (int)simple_strtol(buf, NULL, 10); 1257 if (y < AIPTEK_TILT_MIN || y > AIPTEK_TILT_MAX)
1247 if (y >= AIPTEK_TILT_MIN && y <= AIPTEK_TILT_MAX) { 1258 return -EINVAL;
1248 aiptek->newSetting.yTilt = y; 1259
1249 } 1260 aiptek->newSetting.yTilt = y;
1250 } 1261 }
1262
1251 return count; 1263 return count;
1252} 1264}
1253 1265
@@ -1269,8 +1281,12 @@ static ssize_t
1269store_tabletJitterDelay(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) 1281store_tabletJitterDelay(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
1270{ 1282{
1271 struct aiptek *aiptek = dev_get_drvdata(dev); 1283 struct aiptek *aiptek = dev_get_drvdata(dev);
1284 long j;
1285
1286 if (strict_strtol(buf, 10, &j))
1287 return -EINVAL;
1272 1288
1273 aiptek->newSetting.jitterDelay = (int)simple_strtol(buf, NULL, 10); 1289 aiptek->newSetting.jitterDelay = (int)j;
1274 return count; 1290 return count;
1275} 1291}
1276 1292
@@ -1294,8 +1310,12 @@ static ssize_t
1294store_tabletProgrammableDelay(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) 1310store_tabletProgrammableDelay(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
1295{ 1311{
1296 struct aiptek *aiptek = dev_get_drvdata(dev); 1312 struct aiptek *aiptek = dev_get_drvdata(dev);
1313 long d;
1297 1314
1298 aiptek->newSetting.programmableDelay = (int)simple_strtol(buf, NULL, 10); 1315 if (strict_strtol(buf, 10, &d))
1316 return -EINVAL;
1317
1318 aiptek->newSetting.programmableDelay = (int)d;
1299 return count; 1319 return count;
1300} 1320}
1301 1321
@@ -1541,8 +1561,11 @@ static ssize_t
1541store_tabletWheel(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) 1561store_tabletWheel(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
1542{ 1562{
1543 struct aiptek *aiptek = dev_get_drvdata(dev); 1563 struct aiptek *aiptek = dev_get_drvdata(dev);
1564 long w;
1565
1566 if (strict_strtol(buf, 10, &w)) return -EINVAL;
1544 1567
1545 aiptek->newSetting.wheel = (int)simple_strtol(buf, NULL, 10); 1568 aiptek->newSetting.wheel = (int)w;
1546 return count; 1569 return count;
1547} 1570}
1548 1571