aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input/mouse/sentelic.c
diff options
context:
space:
mode:
authorJJ Ding <dgdunix@gmail.com>2011-11-09 13:20:14 -0500
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2011-11-10 00:23:26 -0500
commit76496e7a02e99d42844f4fffa145b81e513e7acd (patch)
tree33812cc8a9b250a95cf90c237c46ec6fc6fcf2ff /drivers/input/mouse/sentelic.c
parent7cf801cfc0774b777aa6861cf4a43a90b112b1ed (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/mouse/sentelic.c')
-rw-r--r--drivers/input/mouse/sentelic.c43
1 files changed, 32 insertions, 11 deletions
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)
408static ssize_t fsp_attr_set_setreg(struct psmouse *psmouse, void *data, 408static 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, &reg);
458 if (err)
459 return err;
453 460
454 if (strict_strtoul(buf, 16, &reg) || 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,
480static ssize_t fsp_attr_set_pagereg(struct psmouse *psmouse, void *data, 487static 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,
505static ssize_t fsp_attr_set_vscroll(struct psmouse *psmouse, void *data, 516static 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,
529static ssize_t fsp_attr_set_hscroll(struct psmouse *psmouse, void *data, 545static 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);