diff options
author | JJ Ding <dgdunix@gmail.com> | 2011-11-09 13:20:14 -0500 |
---|---|---|
committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2011-11-10 00:23:26 -0500 |
commit | 76496e7a02e99d42844f4fffa145b81e513e7acd (patch) | |
tree | 33812cc8a9b250a95cf90c237c46ec6fc6fcf2ff /drivers/input | |
parent | 7cf801cfc0774b777aa6861cf4a43a90b112b1ed (diff) |
Input: convert obsolete strict_strtox to kstrtox
With commit 67d0a0754455f89ef3946946159d8ec9e45ce33a we mark strict_strtox
as obsolete. Convert all remaining such uses in drivers/input/.
Also change long to appropriate types, and return error conditions
from kstrtox separately, as Dmitry sugguests.
Signed-off-by: JJ Ding <dgdunix@gmail.com>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Diffstat (limited to 'drivers/input')
-rw-r--r-- | drivers/input/input-polldev.c | 8 | ||||
-rw-r--r-- | drivers/input/keyboard/atkbd.c | 40 | ||||
-rw-r--r-- | drivers/input/keyboard/lm8323.c | 11 | ||||
-rw-r--r-- | drivers/input/misc/adxl34x.c | 16 | ||||
-rw-r--r-- | drivers/input/misc/ati_remote2.c | 19 | ||||
-rw-r--r-- | drivers/input/mouse/elantech.c | 7 | ||||
-rw-r--r-- | drivers/input/mouse/hgpk.c | 18 | ||||
-rw-r--r-- | drivers/input/mouse/logips2pp.c | 9 | ||||
-rw-r--r-- | drivers/input/mouse/psmouse-base.c | 27 | ||||
-rw-r--r-- | drivers/input/mouse/sentelic.c | 43 | ||||
-rw-r--r-- | drivers/input/mouse/trackpoint.c | 17 | ||||
-rw-r--r-- | drivers/input/tablet/aiptek.c | 34 | ||||
-rw-r--r-- | drivers/input/touchscreen/ad7877.c | 16 | ||||
-rw-r--r-- | drivers/input/touchscreen/ad7879.c | 4 | ||||
-rw-r--r-- | drivers/input/touchscreen/ads7846.c | 8 |
15 files changed, 173 insertions, 104 deletions
diff --git a/drivers/input/input-polldev.c b/drivers/input/input-polldev.c index b253973881b8..1986a52a7ab9 100644 --- a/drivers/input/input-polldev.c +++ b/drivers/input/input-polldev.c | |||
@@ -83,10 +83,12 @@ static ssize_t input_polldev_set_poll(struct device *dev, | |||
83 | { | 83 | { |
84 | struct input_polled_dev *polldev = dev_get_drvdata(dev); | 84 | struct input_polled_dev *polldev = dev_get_drvdata(dev); |
85 | struct input_dev *input = polldev->input; | 85 | struct input_dev *input = polldev->input; |
86 | unsigned long interval; | 86 | unsigned int interval; |
87 | int err; | ||
87 | 88 | ||
88 | if (strict_strtoul(buf, 0, &interval)) | 89 | err = kstrtouint(buf, 0, &interval); |
89 | return -EINVAL; | 90 | if (err) |
91 | return err; | ||
90 | 92 | ||
91 | if (interval < polldev->poll_interval_min) | 93 | if (interval < polldev->poll_interval_min) |
92 | return -EINVAL; | 94 | return -EINVAL; |
diff --git a/drivers/input/keyboard/atkbd.c b/drivers/input/keyboard/atkbd.c index 19cfc0cf558c..e05a2e7073c6 100644 --- a/drivers/input/keyboard/atkbd.c +++ b/drivers/input/keyboard/atkbd.c | |||
@@ -1305,7 +1305,7 @@ static ssize_t atkbd_show_extra(struct atkbd *atkbd, char *buf) | |||
1305 | static ssize_t atkbd_set_extra(struct atkbd *atkbd, const char *buf, size_t count) | 1305 | static ssize_t atkbd_set_extra(struct atkbd *atkbd, const char *buf, size_t count) |
1306 | { | 1306 | { |
1307 | struct input_dev *old_dev, *new_dev; | 1307 | struct input_dev *old_dev, *new_dev; |
1308 | unsigned long value; | 1308 | unsigned int value; |
1309 | int err; | 1309 | int err; |
1310 | bool old_extra; | 1310 | bool old_extra; |
1311 | unsigned char old_set; | 1311 | unsigned char old_set; |
@@ -1313,7 +1313,11 @@ static ssize_t atkbd_set_extra(struct atkbd *atkbd, const char *buf, size_t coun | |||
1313 | if (!atkbd->write) | 1313 | if (!atkbd->write) |
1314 | return -EIO; | 1314 | return -EIO; |
1315 | 1315 | ||
1316 | if (strict_strtoul(buf, 10, &value) || value > 1) | 1316 | err = kstrtouint(buf, 10, &value); |
1317 | if (err) | ||
1318 | return err; | ||
1319 | |||
1320 | if (value > 1) | ||
1317 | return -EINVAL; | 1321 | return -EINVAL; |
1318 | 1322 | ||
1319 | if (atkbd->extra != value) { | 1323 | if (atkbd->extra != value) { |
@@ -1389,11 +1393,15 @@ static ssize_t atkbd_show_scroll(struct atkbd *atkbd, char *buf) | |||
1389 | static ssize_t atkbd_set_scroll(struct atkbd *atkbd, const char *buf, size_t count) | 1393 | static ssize_t atkbd_set_scroll(struct atkbd *atkbd, const char *buf, size_t count) |
1390 | { | 1394 | { |
1391 | struct input_dev *old_dev, *new_dev; | 1395 | struct input_dev *old_dev, *new_dev; |
1392 | unsigned long value; | 1396 | unsigned int value; |
1393 | int err; | 1397 | int err; |
1394 | bool old_scroll; | 1398 | bool old_scroll; |
1395 | 1399 | ||
1396 | if (strict_strtoul(buf, 10, &value) || value > 1) | 1400 | err = kstrtouint(buf, 10, &value); |
1401 | if (err) | ||
1402 | return err; | ||
1403 | |||
1404 | if (value > 1) | ||
1397 | return -EINVAL; | 1405 | return -EINVAL; |
1398 | 1406 | ||
1399 | if (atkbd->scroll != value) { | 1407 | if (atkbd->scroll != value) { |
@@ -1433,7 +1441,7 @@ static ssize_t atkbd_show_set(struct atkbd *atkbd, char *buf) | |||
1433 | static ssize_t atkbd_set_set(struct atkbd *atkbd, const char *buf, size_t count) | 1441 | static ssize_t atkbd_set_set(struct atkbd *atkbd, const char *buf, size_t count) |
1434 | { | 1442 | { |
1435 | struct input_dev *old_dev, *new_dev; | 1443 | struct input_dev *old_dev, *new_dev; |
1436 | unsigned long value; | 1444 | unsigned int value; |
1437 | int err; | 1445 | int err; |
1438 | unsigned char old_set; | 1446 | unsigned char old_set; |
1439 | bool old_extra; | 1447 | bool old_extra; |
@@ -1441,7 +1449,11 @@ static ssize_t atkbd_set_set(struct atkbd *atkbd, const char *buf, size_t count) | |||
1441 | if (!atkbd->write) | 1449 | if (!atkbd->write) |
1442 | return -EIO; | 1450 | return -EIO; |
1443 | 1451 | ||
1444 | if (strict_strtoul(buf, 10, &value) || (value != 2 && value != 3)) | 1452 | err = kstrtouint(buf, 10, &value); |
1453 | if (err) | ||
1454 | return err; | ||
1455 | |||
1456 | if (value != 2 && value != 3) | ||
1445 | return -EINVAL; | 1457 | return -EINVAL; |
1446 | 1458 | ||
1447 | if (atkbd->set != value) { | 1459 | if (atkbd->set != value) { |
@@ -1484,14 +1496,18 @@ static ssize_t atkbd_show_softrepeat(struct atkbd *atkbd, char *buf) | |||
1484 | static ssize_t atkbd_set_softrepeat(struct atkbd *atkbd, const char *buf, size_t count) | 1496 | static ssize_t atkbd_set_softrepeat(struct atkbd *atkbd, const char *buf, size_t count) |
1485 | { | 1497 | { |
1486 | struct input_dev *old_dev, *new_dev; | 1498 | struct input_dev *old_dev, *new_dev; |
1487 | unsigned long value; | 1499 | unsigned int value; |
1488 | int err; | 1500 | int err; |
1489 | bool old_softrepeat, old_softraw; | 1501 | bool old_softrepeat, old_softraw; |
1490 | 1502 | ||
1491 | if (!atkbd->write) | 1503 | if (!atkbd->write) |
1492 | return -EIO; | 1504 | return -EIO; |
1493 | 1505 | ||
1494 | if (strict_strtoul(buf, 10, &value) || value > 1) | 1506 | err = kstrtouint(buf, 10, &value); |
1507 | if (err) | ||
1508 | return err; | ||
1509 | |||
1510 | if (value > 1) | ||
1495 | return -EINVAL; | 1511 | return -EINVAL; |
1496 | 1512 | ||
1497 | if (atkbd->softrepeat != value) { | 1513 | if (atkbd->softrepeat != value) { |
@@ -1534,11 +1550,15 @@ static ssize_t atkbd_show_softraw(struct atkbd *atkbd, char *buf) | |||
1534 | static ssize_t atkbd_set_softraw(struct atkbd *atkbd, const char *buf, size_t count) | 1550 | static ssize_t atkbd_set_softraw(struct atkbd *atkbd, const char *buf, size_t count) |
1535 | { | 1551 | { |
1536 | struct input_dev *old_dev, *new_dev; | 1552 | struct input_dev *old_dev, *new_dev; |
1537 | unsigned long value; | 1553 | unsigned int value; |
1538 | int err; | 1554 | int err; |
1539 | bool old_softraw; | 1555 | bool old_softraw; |
1540 | 1556 | ||
1541 | if (strict_strtoul(buf, 10, &value) || value > 1) | 1557 | err = kstrtouint(buf, 10, &value); |
1558 | if (err) | ||
1559 | return err; | ||
1560 | |||
1561 | if (value > 1) | ||
1542 | return -EINVAL; | 1562 | return -EINVAL; |
1543 | 1563 | ||
1544 | if (atkbd->softraw != value) { | 1564 | if (atkbd->softraw != value) { |
diff --git a/drivers/input/keyboard/lm8323.c b/drivers/input/keyboard/lm8323.c index 82d1dc8badd5..21823bfc7911 100644 --- a/drivers/input/keyboard/lm8323.c +++ b/drivers/input/keyboard/lm8323.c | |||
@@ -545,13 +545,12 @@ static ssize_t lm8323_pwm_store_time(struct device *dev, | |||
545 | { | 545 | { |
546 | struct led_classdev *led_cdev = dev_get_drvdata(dev); | 546 | struct led_classdev *led_cdev = dev_get_drvdata(dev); |
547 | struct lm8323_pwm *pwm = cdev_to_pwm(led_cdev); | 547 | struct lm8323_pwm *pwm = cdev_to_pwm(led_cdev); |
548 | int ret; | 548 | int ret, time; |
549 | unsigned long time; | ||
550 | 549 | ||
551 | ret = strict_strtoul(buf, 10, &time); | 550 | ret = kstrtoint(buf, 10, &time); |
552 | /* Numbers only, please. */ | 551 | /* Numbers only, please. */ |
553 | if (ret) | 552 | if (ret) |
554 | return -EINVAL; | 553 | return ret; |
555 | 554 | ||
556 | pwm->fade_time = time; | 555 | pwm->fade_time = time; |
557 | 556 | ||
@@ -613,9 +612,9 @@ static ssize_t lm8323_set_disable(struct device *dev, | |||
613 | { | 612 | { |
614 | struct lm8323_chip *lm = dev_get_drvdata(dev); | 613 | struct lm8323_chip *lm = dev_get_drvdata(dev); |
615 | int ret; | 614 | int ret; |
616 | unsigned long i; | 615 | unsigned int i; |
617 | 616 | ||
618 | ret = strict_strtoul(buf, 10, &i); | 617 | ret = kstrtouint(buf, 10, &i); |
619 | 618 | ||
620 | mutex_lock(&lm->lock); | 619 | mutex_lock(&lm->lock); |
621 | lm->kp_enabled = !i; | 620 | lm->kp_enabled = !i; |
diff --git a/drivers/input/misc/adxl34x.c b/drivers/input/misc/adxl34x.c index 144ddbdeb9b3..87918592993c 100644 --- a/drivers/input/misc/adxl34x.c +++ b/drivers/input/misc/adxl34x.c | |||
@@ -451,10 +451,10 @@ static ssize_t adxl34x_disable_store(struct device *dev, | |||
451 | const char *buf, size_t count) | 451 | const char *buf, size_t count) |
452 | { | 452 | { |
453 | struct adxl34x *ac = dev_get_drvdata(dev); | 453 | struct adxl34x *ac = dev_get_drvdata(dev); |
454 | unsigned long val; | 454 | unsigned int val; |
455 | int error; | 455 | int error; |
456 | 456 | ||
457 | error = strict_strtoul(buf, 10, &val); | 457 | error = kstrtouint(buf, 10, &val); |
458 | if (error) | 458 | if (error) |
459 | return error; | 459 | return error; |
460 | 460 | ||
@@ -540,10 +540,10 @@ static ssize_t adxl34x_rate_store(struct device *dev, | |||
540 | const char *buf, size_t count) | 540 | const char *buf, size_t count) |
541 | { | 541 | { |
542 | struct adxl34x *ac = dev_get_drvdata(dev); | 542 | struct adxl34x *ac = dev_get_drvdata(dev); |
543 | unsigned long val; | 543 | unsigned char val; |
544 | int error; | 544 | int error; |
545 | 545 | ||
546 | error = strict_strtoul(buf, 10, &val); | 546 | error = kstrtou8(buf, 10, &val); |
547 | if (error) | 547 | if (error) |
548 | return error; | 548 | return error; |
549 | 549 | ||
@@ -575,10 +575,10 @@ static ssize_t adxl34x_autosleep_store(struct device *dev, | |||
575 | const char *buf, size_t count) | 575 | const char *buf, size_t count) |
576 | { | 576 | { |
577 | struct adxl34x *ac = dev_get_drvdata(dev); | 577 | struct adxl34x *ac = dev_get_drvdata(dev); |
578 | unsigned long val; | 578 | unsigned int val; |
579 | int error; | 579 | int error; |
580 | 580 | ||
581 | error = strict_strtoul(buf, 10, &val); | 581 | error = kstrtouint(buf, 10, &val); |
582 | if (error) | 582 | if (error) |
583 | return error; | 583 | return error; |
584 | 584 | ||
@@ -622,13 +622,13 @@ static ssize_t adxl34x_write_store(struct device *dev, | |||
622 | const char *buf, size_t count) | 622 | const char *buf, size_t count) |
623 | { | 623 | { |
624 | struct adxl34x *ac = dev_get_drvdata(dev); | 624 | struct adxl34x *ac = dev_get_drvdata(dev); |
625 | unsigned long val; | 625 | unsigned int val; |
626 | int error; | 626 | int error; |
627 | 627 | ||
628 | /* | 628 | /* |
629 | * This allows basic ADXL register write access for debug purposes. | 629 | * This allows basic ADXL register write access for debug purposes. |
630 | */ | 630 | */ |
631 | error = strict_strtoul(buf, 16, &val); | 631 | error = kstrtouint(buf, 16, &val); |
632 | if (error) | 632 | if (error) |
633 | return error; | 633 | return error; |
634 | 634 | ||
diff --git a/drivers/input/misc/ati_remote2.c b/drivers/input/misc/ati_remote2.c index 1de58e8a1b71..afbe3e760551 100644 --- a/drivers/input/misc/ati_remote2.c +++ b/drivers/input/misc/ati_remote2.c | |||
@@ -41,13 +41,13 @@ static int ati_remote2_set_mask(const char *val, | |||
41 | const struct kernel_param *kp, | 41 | const struct kernel_param *kp, |
42 | unsigned int max) | 42 | unsigned int max) |
43 | { | 43 | { |
44 | unsigned long mask; | 44 | unsigned int mask; |
45 | int ret; | 45 | int ret; |
46 | 46 | ||
47 | if (!val) | 47 | if (!val) |
48 | return -EINVAL; | 48 | return -EINVAL; |
49 | 49 | ||
50 | ret = strict_strtoul(val, 0, &mask); | 50 | ret = kstrtouint(val, 0, &mask); |
51 | if (ret) | 51 | if (ret) |
52 | return ret; | 52 | return ret; |
53 | 53 | ||
@@ -719,11 +719,12 @@ static ssize_t ati_remote2_store_channel_mask(struct device *dev, | |||
719 | struct usb_device *udev = to_usb_device(dev); | 719 | struct usb_device *udev = to_usb_device(dev); |
720 | struct usb_interface *intf = usb_ifnum_to_if(udev, 0); | 720 | struct usb_interface *intf = usb_ifnum_to_if(udev, 0); |
721 | struct ati_remote2 *ar2 = usb_get_intfdata(intf); | 721 | struct ati_remote2 *ar2 = usb_get_intfdata(intf); |
722 | unsigned long mask; | 722 | unsigned int mask; |
723 | int r; | 723 | int r; |
724 | 724 | ||
725 | if (strict_strtoul(buf, 0, &mask)) | 725 | r = kstrtouint(buf, 0, &mask); |
726 | return -EINVAL; | 726 | if (r) |
727 | return r; | ||
727 | 728 | ||
728 | if (mask & ~ATI_REMOTE2_MAX_CHANNEL_MASK) | 729 | if (mask & ~ATI_REMOTE2_MAX_CHANNEL_MASK) |
729 | return -EINVAL; | 730 | return -EINVAL; |
@@ -768,10 +769,12 @@ static ssize_t ati_remote2_store_mode_mask(struct device *dev, | |||
768 | struct usb_device *udev = to_usb_device(dev); | 769 | struct usb_device *udev = to_usb_device(dev); |
769 | struct usb_interface *intf = usb_ifnum_to_if(udev, 0); | 770 | struct usb_interface *intf = usb_ifnum_to_if(udev, 0); |
770 | struct ati_remote2 *ar2 = usb_get_intfdata(intf); | 771 | struct ati_remote2 *ar2 = usb_get_intfdata(intf); |
771 | unsigned long mask; | 772 | unsigned int mask; |
773 | int err; | ||
772 | 774 | ||
773 | if (strict_strtoul(buf, 0, &mask)) | 775 | err = kstrtouint(buf, 0, &mask); |
774 | return -EINVAL; | 776 | if (err) |
777 | return err; | ||
775 | 778 | ||
776 | if (mask & ~ATI_REMOTE2_MAX_MODE_MASK) | 779 | if (mask & ~ATI_REMOTE2_MAX_MODE_MASK) |
777 | return -EINVAL; | 780 | return -EINVAL; |
diff --git a/drivers/input/mouse/elantech.c b/drivers/input/mouse/elantech.c index 09b93b11a274..b562392d0cd8 100644 --- a/drivers/input/mouse/elantech.c +++ b/drivers/input/mouse/elantech.c | |||
@@ -1031,16 +1031,13 @@ static ssize_t elantech_set_int_attr(struct psmouse *psmouse, | |||
1031 | struct elantech_data *etd = psmouse->private; | 1031 | struct elantech_data *etd = psmouse->private; |
1032 | struct elantech_attr_data *attr = data; | 1032 | struct elantech_attr_data *attr = data; |
1033 | unsigned char *reg = (unsigned char *) etd + attr->field_offset; | 1033 | unsigned char *reg = (unsigned char *) etd + attr->field_offset; |
1034 | unsigned long value; | 1034 | unsigned char value; |
1035 | int err; | 1035 | int err; |
1036 | 1036 | ||
1037 | err = strict_strtoul(buf, 16, &value); | 1037 | err = kstrtou8(buf, 16, &value); |
1038 | if (err) | 1038 | if (err) |
1039 | return err; | 1039 | return err; |
1040 | 1040 | ||
1041 | if (value > 0xff) | ||
1042 | return -EINVAL; | ||
1043 | |||
1044 | /* Do we need to preserve some bits for version 2 hardware too? */ | 1041 | /* Do we need to preserve some bits for version 2 hardware too? */ |
1045 | if (etd->hw_version == 1) { | 1042 | if (etd->hw_version == 1) { |
1046 | if (attr->reg == 0x10) | 1043 | if (attr->reg == 0x10) |
diff --git a/drivers/input/mouse/hgpk.c b/drivers/input/mouse/hgpk.c index 0470dd46b566..1c5d521de600 100644 --- a/drivers/input/mouse/hgpk.c +++ b/drivers/input/mouse/hgpk.c | |||
@@ -789,11 +789,14 @@ static ssize_t hgpk_set_powered(struct psmouse *psmouse, void *data, | |||
789 | const char *buf, size_t count) | 789 | const char *buf, size_t count) |
790 | { | 790 | { |
791 | struct hgpk_data *priv = psmouse->private; | 791 | struct hgpk_data *priv = psmouse->private; |
792 | unsigned long value; | 792 | unsigned int value; |
793 | int err; | 793 | int err; |
794 | 794 | ||
795 | err = strict_strtoul(buf, 10, &value); | 795 | err = kstrtouint(buf, 10, &value); |
796 | if (err || value > 1) | 796 | if (err) |
797 | return err; | ||
798 | |||
799 | if (value > 1) | ||
797 | return -EINVAL; | 800 | return -EINVAL; |
798 | 801 | ||
799 | if (value != priv->powered) { | 802 | if (value != priv->powered) { |
@@ -881,11 +884,14 @@ static ssize_t hgpk_trigger_recal(struct psmouse *psmouse, void *data, | |||
881 | const char *buf, size_t count) | 884 | const char *buf, size_t count) |
882 | { | 885 | { |
883 | struct hgpk_data *priv = psmouse->private; | 886 | struct hgpk_data *priv = psmouse->private; |
884 | unsigned long value; | 887 | unsigned int value; |
885 | int err; | 888 | int err; |
886 | 889 | ||
887 | err = strict_strtoul(buf, 10, &value); | 890 | err = kstrtouint(buf, 10, &value); |
888 | if (err || value != 1) | 891 | if (err) |
892 | return err; | ||
893 | |||
894 | if (value != 1) | ||
889 | return -EINVAL; | 895 | return -EINVAL; |
890 | 896 | ||
891 | /* | 897 | /* |
diff --git a/drivers/input/mouse/logips2pp.c b/drivers/input/mouse/logips2pp.c index faac2c3bef74..84de2fc6acc1 100644 --- a/drivers/input/mouse/logips2pp.c +++ b/drivers/input/mouse/logips2pp.c | |||
@@ -155,9 +155,14 @@ static ssize_t ps2pp_attr_show_smartscroll(struct psmouse *psmouse, | |||
155 | static ssize_t ps2pp_attr_set_smartscroll(struct psmouse *psmouse, void *data, | 155 | static ssize_t ps2pp_attr_set_smartscroll(struct psmouse *psmouse, void *data, |
156 | const char *buf, size_t count) | 156 | const char *buf, size_t count) |
157 | { | 157 | { |
158 | unsigned long value; | 158 | unsigned int value; |
159 | int err; | ||
159 | 160 | ||
160 | if (strict_strtoul(buf, 10, &value) || value > 1) | 161 | err = kstrtouint(buf, 10, &value); |
162 | if (err) | ||
163 | return err; | ||
164 | |||
165 | if (value > 1) | ||
161 | return -EINVAL; | 166 | return -EINVAL; |
162 | 167 | ||
163 | ps2pp_set_smartscroll(psmouse, value); | 168 | ps2pp_set_smartscroll(psmouse, value); |
diff --git a/drivers/input/mouse/psmouse-base.c b/drivers/input/mouse/psmouse-base.c index 9f352fbd7b4f..a6973e575aa9 100644 --- a/drivers/input/mouse/psmouse-base.c +++ b/drivers/input/mouse/psmouse-base.c | |||
@@ -1558,13 +1558,12 @@ static ssize_t psmouse_show_int_attr(struct psmouse *psmouse, void *offset, char | |||
1558 | static ssize_t psmouse_set_int_attr(struct psmouse *psmouse, void *offset, const char *buf, size_t count) | 1558 | static ssize_t psmouse_set_int_attr(struct psmouse *psmouse, void *offset, const char *buf, size_t count) |
1559 | { | 1559 | { |
1560 | unsigned int *field = (unsigned int *)((char *)psmouse + (size_t)offset); | 1560 | unsigned int *field = (unsigned int *)((char *)psmouse + (size_t)offset); |
1561 | unsigned long value; | 1561 | unsigned int value; |
1562 | 1562 | int err; | |
1563 | if (strict_strtoul(buf, 10, &value)) | ||
1564 | return -EINVAL; | ||
1565 | 1563 | ||
1566 | if ((unsigned int)value != value) | 1564 | err = kstrtouint(buf, 10, &value); |
1567 | return -EINVAL; | 1565 | if (err) |
1566 | return err; | ||
1568 | 1567 | ||
1569 | *field = value; | 1568 | *field = value; |
1570 | 1569 | ||
@@ -1671,10 +1670,12 @@ static ssize_t psmouse_attr_set_protocol(struct psmouse *psmouse, void *data, co | |||
1671 | 1670 | ||
1672 | static ssize_t psmouse_attr_set_rate(struct psmouse *psmouse, void *data, const char *buf, size_t count) | 1671 | static ssize_t psmouse_attr_set_rate(struct psmouse *psmouse, void *data, const char *buf, size_t count) |
1673 | { | 1672 | { |
1674 | unsigned long value; | 1673 | unsigned int value; |
1674 | int err; | ||
1675 | 1675 | ||
1676 | if (strict_strtoul(buf, 10, &value)) | 1676 | err = kstrtouint(buf, 10, &value); |
1677 | return -EINVAL; | 1677 | if (err) |
1678 | return err; | ||
1678 | 1679 | ||
1679 | psmouse->set_rate(psmouse, value); | 1680 | psmouse->set_rate(psmouse, value); |
1680 | return count; | 1681 | return count; |
@@ -1682,10 +1683,12 @@ static ssize_t psmouse_attr_set_rate(struct psmouse *psmouse, void *data, const | |||
1682 | 1683 | ||
1683 | static ssize_t psmouse_attr_set_resolution(struct psmouse *psmouse, void *data, const char *buf, size_t count) | 1684 | static ssize_t psmouse_attr_set_resolution(struct psmouse *psmouse, void *data, const char *buf, size_t count) |
1684 | { | 1685 | { |
1685 | unsigned long value; | 1686 | unsigned int value; |
1687 | int err; | ||
1686 | 1688 | ||
1687 | if (strict_strtoul(buf, 10, &value)) | 1689 | err = kstrtouint(buf, 10, &value); |
1688 | return -EINVAL; | 1690 | if (err) |
1691 | return err; | ||
1689 | 1692 | ||
1690 | psmouse->set_resolution(psmouse, value); | 1693 | psmouse->set_resolution(psmouse, value); |
1691 | return count; | 1694 | return count; |
diff --git a/drivers/input/mouse/sentelic.c b/drivers/input/mouse/sentelic.c index c5b12d2e955a..5babc47b39aa 100644 --- a/drivers/input/mouse/sentelic.c +++ b/drivers/input/mouse/sentelic.c | |||
@@ -408,7 +408,7 @@ static int fsp_onpad_hscr(struct psmouse *psmouse, bool enable) | |||
408 | static ssize_t fsp_attr_set_setreg(struct psmouse *psmouse, void *data, | 408 | static ssize_t fsp_attr_set_setreg(struct psmouse *psmouse, void *data, |
409 | const char *buf, size_t count) | 409 | const char *buf, size_t count) |
410 | { | 410 | { |
411 | unsigned long reg, val; | 411 | int reg, val; |
412 | char *rest; | 412 | char *rest; |
413 | ssize_t retval; | 413 | ssize_t retval; |
414 | 414 | ||
@@ -416,7 +416,11 @@ static ssize_t fsp_attr_set_setreg(struct psmouse *psmouse, void *data, | |||
416 | if (rest == buf || *rest != ' ' || reg > 0xff) | 416 | if (rest == buf || *rest != ' ' || reg > 0xff) |
417 | return -EINVAL; | 417 | return -EINVAL; |
418 | 418 | ||
419 | if (strict_strtoul(rest + 1, 16, &val) || val > 0xff) | 419 | retval = kstrtoint(rest + 1, 16, &val); |
420 | if (retval) | ||
421 | return retval; | ||
422 | |||
423 | if (val > 0xff) | ||
420 | return -EINVAL; | 424 | return -EINVAL; |
421 | 425 | ||
422 | if (fsp_reg_write_enable(psmouse, true)) | 426 | if (fsp_reg_write_enable(psmouse, true)) |
@@ -448,10 +452,13 @@ static ssize_t fsp_attr_set_getreg(struct psmouse *psmouse, void *data, | |||
448 | const char *buf, size_t count) | 452 | const char *buf, size_t count) |
449 | { | 453 | { |
450 | struct fsp_data *pad = psmouse->private; | 454 | struct fsp_data *pad = psmouse->private; |
451 | unsigned long reg; | 455 | int reg, val, err; |
452 | int val; | 456 | |
457 | err = kstrtoint(buf, 16, ®); | ||
458 | if (err) | ||
459 | return err; | ||
453 | 460 | ||
454 | if (strict_strtoul(buf, 16, ®) || reg > 0xff) | 461 | if (reg > 0xff) |
455 | return -EINVAL; | 462 | return -EINVAL; |
456 | 463 | ||
457 | if (fsp_reg_read(psmouse, reg, &val)) | 464 | if (fsp_reg_read(psmouse, reg, &val)) |
@@ -480,9 +487,13 @@ static ssize_t fsp_attr_show_pagereg(struct psmouse *psmouse, | |||
480 | static ssize_t fsp_attr_set_pagereg(struct psmouse *psmouse, void *data, | 487 | static ssize_t fsp_attr_set_pagereg(struct psmouse *psmouse, void *data, |
481 | const char *buf, size_t count) | 488 | const char *buf, size_t count) |
482 | { | 489 | { |
483 | unsigned long val; | 490 | int val, err; |
484 | 491 | ||
485 | if (strict_strtoul(buf, 16, &val) || val > 0xff) | 492 | err = kstrtoint(buf, 16, &val); |
493 | if (err) | ||
494 | return err; | ||
495 | |||
496 | if (val > 0xff) | ||
486 | return -EINVAL; | 497 | return -EINVAL; |
487 | 498 | ||
488 | if (fsp_page_reg_write(psmouse, val)) | 499 | if (fsp_page_reg_write(psmouse, val)) |
@@ -505,9 +516,14 @@ static ssize_t fsp_attr_show_vscroll(struct psmouse *psmouse, | |||
505 | static ssize_t fsp_attr_set_vscroll(struct psmouse *psmouse, void *data, | 516 | static ssize_t fsp_attr_set_vscroll(struct psmouse *psmouse, void *data, |
506 | const char *buf, size_t count) | 517 | const char *buf, size_t count) |
507 | { | 518 | { |
508 | unsigned long val; | 519 | unsigned int val; |
520 | int err; | ||
521 | |||
522 | err = kstrtouint(buf, 10, &val); | ||
523 | if (err) | ||
524 | return err; | ||
509 | 525 | ||
510 | if (strict_strtoul(buf, 10, &val) || val > 1) | 526 | if (val > 1) |
511 | return -EINVAL; | 527 | return -EINVAL; |
512 | 528 | ||
513 | fsp_onpad_vscr(psmouse, val); | 529 | fsp_onpad_vscr(psmouse, val); |
@@ -529,9 +545,14 @@ static ssize_t fsp_attr_show_hscroll(struct psmouse *psmouse, | |||
529 | static ssize_t fsp_attr_set_hscroll(struct psmouse *psmouse, void *data, | 545 | static ssize_t fsp_attr_set_hscroll(struct psmouse *psmouse, void *data, |
530 | const char *buf, size_t count) | 546 | const char *buf, size_t count) |
531 | { | 547 | { |
532 | unsigned long val; | 548 | unsigned int val; |
549 | int err; | ||
550 | |||
551 | err = kstrtouint(buf, 10, &val); | ||
552 | if (err) | ||
553 | return err; | ||
533 | 554 | ||
534 | if (strict_strtoul(buf, 10, &val) || val > 1) | 555 | if (val > 1) |
535 | return -EINVAL; | 556 | return -EINVAL; |
536 | 557 | ||
537 | fsp_onpad_hscr(psmouse, val); | 558 | fsp_onpad_hscr(psmouse, val); |
diff --git a/drivers/input/mouse/trackpoint.c b/drivers/input/mouse/trackpoint.c index 54b2fa892e19..22b218018137 100644 --- a/drivers/input/mouse/trackpoint.c +++ b/drivers/input/mouse/trackpoint.c | |||
@@ -89,10 +89,12 @@ static ssize_t trackpoint_set_int_attr(struct psmouse *psmouse, void *data, | |||
89 | struct trackpoint_data *tp = psmouse->private; | 89 | struct trackpoint_data *tp = psmouse->private; |
90 | struct trackpoint_attr_data *attr = data; | 90 | struct trackpoint_attr_data *attr = data; |
91 | unsigned char *field = (unsigned char *)((char *)tp + attr->field_offset); | 91 | unsigned char *field = (unsigned char *)((char *)tp + attr->field_offset); |
92 | unsigned long value; | 92 | unsigned char value; |
93 | int err; | ||
93 | 94 | ||
94 | if (strict_strtoul(buf, 10, &value) || value > 255) | 95 | err = kstrtou8(buf, 10, &value); |
95 | return -EINVAL; | 96 | if (err) |
97 | return err; | ||
96 | 98 | ||
97 | *field = value; | 99 | *field = value; |
98 | trackpoint_write(&psmouse->ps2dev, attr->command, value); | 100 | trackpoint_write(&psmouse->ps2dev, attr->command, value); |
@@ -115,9 +117,14 @@ static ssize_t trackpoint_set_bit_attr(struct psmouse *psmouse, void *data, | |||
115 | struct trackpoint_data *tp = psmouse->private; | 117 | struct trackpoint_data *tp = psmouse->private; |
116 | struct trackpoint_attr_data *attr = data; | 118 | struct trackpoint_attr_data *attr = data; |
117 | unsigned char *field = (unsigned char *)((char *)tp + attr->field_offset); | 119 | unsigned char *field = (unsigned char *)((char *)tp + attr->field_offset); |
118 | unsigned long value; | 120 | unsigned int value; |
121 | int err; | ||
122 | |||
123 | err = kstrtouint(buf, 10, &value); | ||
124 | if (err) | ||
125 | return err; | ||
119 | 126 | ||
120 | if (strict_strtoul(buf, 10, &value) || value > 1) | 127 | if (value > 1) |
121 | return -EINVAL; | 128 | return -EINVAL; |
122 | 129 | ||
123 | if (attr->inverted) | 130 | if (attr->inverted) |
diff --git a/drivers/input/tablet/aiptek.c b/drivers/input/tablet/aiptek.c index 6d89fd1842c3..85bace2c8fe8 100644 --- a/drivers/input/tablet/aiptek.c +++ b/drivers/input/tablet/aiptek.c | |||
@@ -1198,9 +1198,9 @@ static ssize_t | |||
1198 | store_tabletXtilt(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) | 1198 | store_tabletXtilt(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) |
1199 | { | 1199 | { |
1200 | struct aiptek *aiptek = dev_get_drvdata(dev); | 1200 | struct aiptek *aiptek = dev_get_drvdata(dev); |
1201 | long x; | 1201 | int x; |
1202 | 1202 | ||
1203 | if (strict_strtol(buf, 10, &x)) { | 1203 | if (kstrtoint(buf, 10, &x)) { |
1204 | size_t len = buf[count - 1] == '\n' ? count - 1 : count; | 1204 | size_t len = buf[count - 1] == '\n' ? count - 1 : count; |
1205 | 1205 | ||
1206 | if (strncmp(buf, "disable", len)) | 1206 | if (strncmp(buf, "disable", len)) |
@@ -1240,9 +1240,9 @@ static ssize_t | |||
1240 | store_tabletYtilt(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) | 1240 | store_tabletYtilt(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) |
1241 | { | 1241 | { |
1242 | struct aiptek *aiptek = dev_get_drvdata(dev); | 1242 | struct aiptek *aiptek = dev_get_drvdata(dev); |
1243 | long y; | 1243 | int y; |
1244 | 1244 | ||
1245 | if (strict_strtol(buf, 10, &y)) { | 1245 | if (kstrtoint(buf, 10, &y)) { |
1246 | size_t len = buf[count - 1] == '\n' ? count - 1 : count; | 1246 | size_t len = buf[count - 1] == '\n' ? count - 1 : count; |
1247 | 1247 | ||
1248 | if (strncmp(buf, "disable", len)) | 1248 | if (strncmp(buf, "disable", len)) |
@@ -1277,12 +1277,13 @@ static ssize_t | |||
1277 | store_tabletJitterDelay(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) | 1277 | store_tabletJitterDelay(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) |
1278 | { | 1278 | { |
1279 | struct aiptek *aiptek = dev_get_drvdata(dev); | 1279 | struct aiptek *aiptek = dev_get_drvdata(dev); |
1280 | long j; | 1280 | int err, j; |
1281 | 1281 | ||
1282 | if (strict_strtol(buf, 10, &j)) | 1282 | err = kstrtoint(buf, 10, &j); |
1283 | return -EINVAL; | 1283 | if (err) |
1284 | return err; | ||
1284 | 1285 | ||
1285 | aiptek->newSetting.jitterDelay = (int)j; | 1286 | aiptek->newSetting.jitterDelay = j; |
1286 | return count; | 1287 | return count; |
1287 | } | 1288 | } |
1288 | 1289 | ||
@@ -1306,12 +1307,13 @@ static ssize_t | |||
1306 | store_tabletProgrammableDelay(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) | 1307 | store_tabletProgrammableDelay(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) |
1307 | { | 1308 | { |
1308 | struct aiptek *aiptek = dev_get_drvdata(dev); | 1309 | struct aiptek *aiptek = dev_get_drvdata(dev); |
1309 | long d; | 1310 | int err, d; |
1310 | 1311 | ||
1311 | if (strict_strtol(buf, 10, &d)) | 1312 | err = kstrtoint(buf, 10, &d); |
1312 | return -EINVAL; | 1313 | if (err) |
1314 | return err; | ||
1313 | 1315 | ||
1314 | aiptek->newSetting.programmableDelay = (int)d; | 1316 | aiptek->newSetting.programmableDelay = d; |
1315 | return count; | 1317 | return count; |
1316 | } | 1318 | } |
1317 | 1319 | ||
@@ -1557,11 +1559,13 @@ static ssize_t | |||
1557 | store_tabletWheel(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) | 1559 | store_tabletWheel(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) |
1558 | { | 1560 | { |
1559 | struct aiptek *aiptek = dev_get_drvdata(dev); | 1561 | struct aiptek *aiptek = dev_get_drvdata(dev); |
1560 | long w; | 1562 | int err, w; |
1561 | 1563 | ||
1562 | if (strict_strtol(buf, 10, &w)) return -EINVAL; | 1564 | err = kstrtoint(buf, 10, &w); |
1565 | if (err) | ||
1566 | return err; | ||
1563 | 1567 | ||
1564 | aiptek->newSetting.wheel = (int)w; | 1568 | aiptek->newSetting.wheel = w; |
1565 | return count; | 1569 | return count; |
1566 | } | 1570 | } |
1567 | 1571 | ||
diff --git a/drivers/input/touchscreen/ad7877.c b/drivers/input/touchscreen/ad7877.c index 714d4e0f9f95..374370ec73ac 100644 --- a/drivers/input/touchscreen/ad7877.c +++ b/drivers/input/touchscreen/ad7877.c | |||
@@ -487,10 +487,10 @@ static ssize_t ad7877_disable_store(struct device *dev, | |||
487 | const char *buf, size_t count) | 487 | const char *buf, size_t count) |
488 | { | 488 | { |
489 | struct ad7877 *ts = dev_get_drvdata(dev); | 489 | struct ad7877 *ts = dev_get_drvdata(dev); |
490 | unsigned long val; | 490 | unsigned int val; |
491 | int error; | 491 | int error; |
492 | 492 | ||
493 | error = strict_strtoul(buf, 10, &val); | 493 | error = kstrtouint(buf, 10, &val); |
494 | if (error) | 494 | if (error) |
495 | return error; | 495 | return error; |
496 | 496 | ||
@@ -517,10 +517,10 @@ static ssize_t ad7877_dac_store(struct device *dev, | |||
517 | const char *buf, size_t count) | 517 | const char *buf, size_t count) |
518 | { | 518 | { |
519 | struct ad7877 *ts = dev_get_drvdata(dev); | 519 | struct ad7877 *ts = dev_get_drvdata(dev); |
520 | unsigned long val; | 520 | unsigned int val; |
521 | int error; | 521 | int error; |
522 | 522 | ||
523 | error = strict_strtoul(buf, 10, &val); | 523 | error = kstrtouint(buf, 10, &val); |
524 | if (error) | 524 | if (error) |
525 | return error; | 525 | return error; |
526 | 526 | ||
@@ -547,10 +547,10 @@ static ssize_t ad7877_gpio3_store(struct device *dev, | |||
547 | const char *buf, size_t count) | 547 | const char *buf, size_t count) |
548 | { | 548 | { |
549 | struct ad7877 *ts = dev_get_drvdata(dev); | 549 | struct ad7877 *ts = dev_get_drvdata(dev); |
550 | unsigned long val; | 550 | unsigned int val; |
551 | int error; | 551 | int error; |
552 | 552 | ||
553 | error = strict_strtoul(buf, 10, &val); | 553 | error = kstrtouint(buf, 10, &val); |
554 | if (error) | 554 | if (error) |
555 | return error; | 555 | return error; |
556 | 556 | ||
@@ -578,10 +578,10 @@ static ssize_t ad7877_gpio4_store(struct device *dev, | |||
578 | const char *buf, size_t count) | 578 | const char *buf, size_t count) |
579 | { | 579 | { |
580 | struct ad7877 *ts = dev_get_drvdata(dev); | 580 | struct ad7877 *ts = dev_get_drvdata(dev); |
581 | unsigned long val; | 581 | unsigned int val; |
582 | int error; | 582 | int error; |
583 | 583 | ||
584 | error = strict_strtoul(buf, 10, &val); | 584 | error = kstrtouint(buf, 10, &val); |
585 | if (error) | 585 | if (error) |
586 | return error; | 586 | return error; |
587 | 587 | ||
diff --git a/drivers/input/touchscreen/ad7879.c b/drivers/input/touchscreen/ad7879.c index 131f9d1c921b..76f5cb4e6ea9 100644 --- a/drivers/input/touchscreen/ad7879.c +++ b/drivers/input/touchscreen/ad7879.c | |||
@@ -339,10 +339,10 @@ static ssize_t ad7879_disable_store(struct device *dev, | |||
339 | const char *buf, size_t count) | 339 | const char *buf, size_t count) |
340 | { | 340 | { |
341 | struct ad7879 *ts = dev_get_drvdata(dev); | 341 | struct ad7879 *ts = dev_get_drvdata(dev); |
342 | unsigned long val; | 342 | unsigned int val; |
343 | int error; | 343 | int error; |
344 | 344 | ||
345 | error = strict_strtoul(buf, 10, &val); | 345 | error = kstrtouint(buf, 10, &val); |
346 | if (error) | 346 | if (error) |
347 | return error; | 347 | return error; |
348 | 348 | ||
diff --git a/drivers/input/touchscreen/ads7846.c b/drivers/input/touchscreen/ads7846.c index d507b9b67806..c69536c97c0f 100644 --- a/drivers/input/touchscreen/ads7846.c +++ b/drivers/input/touchscreen/ads7846.c | |||
@@ -601,10 +601,12 @@ static ssize_t ads7846_disable_store(struct device *dev, | |||
601 | const char *buf, size_t count) | 601 | const char *buf, size_t count) |
602 | { | 602 | { |
603 | struct ads7846 *ts = dev_get_drvdata(dev); | 603 | struct ads7846 *ts = dev_get_drvdata(dev); |
604 | unsigned long i; | 604 | unsigned int i; |
605 | int err; | ||
605 | 606 | ||
606 | if (strict_strtoul(buf, 10, &i)) | 607 | err = kstrtouint(buf, 10, &i); |
607 | return -EINVAL; | 608 | if (err) |
609 | return err; | ||
608 | 610 | ||
609 | if (i) | 611 | if (i) |
610 | ads7846_disable(ts); | 612 | ads7846_disable(ts); |