summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>2013-03-28 11:02:43 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-03-29 08:41:15 -0700
commit1627ab92b2e6307525f43f775aaeac54407981ef (patch)
treee94003d538efaa5e2bded216916dafcd045879b8 /drivers
parentf7046bf08549a39dfc8365f8013e6ab43f42995a (diff)
staging: speakup: reuse native kernel functions
We have simple_strtoul and simple_strtol. Don't repeat their functionality here. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/staging/speakup/kobjects.c2
-rw-r--r--drivers/staging/speakup/main.c2
-rw-r--r--drivers/staging/speakup/speakup.h1
-rw-r--r--drivers/staging/speakup/varhandlers.c30
4 files changed, 3 insertions, 32 deletions
diff --git a/drivers/staging/speakup/kobjects.c b/drivers/staging/speakup/kobjects.c
index 35f647ce1f1e..d0f660baa4a6 100644
--- a/drivers/staging/speakup/kobjects.c
+++ b/drivers/staging/speakup/kobjects.c
@@ -617,7 +617,7 @@ ssize_t spk_var_store(struct kobject *kobj, struct kobj_attribute *attr,
len = E_INC;
else
len = E_SET;
- speakup_s2i(cp, &value);
+ value = simple_strtol(cp, NULL, 10);
ret = spk_set_num_var(value, param, len);
if (ret == E_RANGE) {
var_data = param->data;
diff --git a/drivers/staging/speakup/main.c b/drivers/staging/speakup/main.c
index 9916e94aa361..6c7b55c2947d 100644
--- a/drivers/staging/speakup/main.c
+++ b/drivers/staging/speakup/main.c
@@ -1892,7 +1892,7 @@ oops:
spk_special_handler = NULL;
return 1;
}
- cp = speakup_s2i(goto_buf, &go_pos);
+ go_pos = simple_strtol(goto_buf, &cp, 10);
goto_pos = (u_long) go_pos;
if (*cp == 'x') {
if (*goto_buf < '0')
diff --git a/drivers/staging/speakup/speakup.h b/drivers/staging/speakup/speakup.h
index 22f0fbb85f42..1e5691c3fce7 100644
--- a/drivers/staging/speakup/speakup.h
+++ b/drivers/staging/speakup/speakup.h
@@ -58,7 +58,6 @@ void spk_reset_index_count(int sc);
void spk_get_index_count(int *linecount, int *sentcount);
extern int spk_set_key_info(const u_char *key_info, u_char *k_buffer);
extern char *spk_strlwr(char *s);
-extern char *speakup_s2i(char *start, int *dest);
extern char *spk_s2uchar(char *start, char *dest);
extern char *spk_xlate(char *s);
extern int speakup_kobj_init(void);
diff --git a/drivers/staging/speakup/varhandlers.c b/drivers/staging/speakup/varhandlers.c
index f8c1e457d389..0a237da3acee 100644
--- a/drivers/staging/speakup/varhandlers.c
+++ b/drivers/staging/speakup/varhandlers.c
@@ -319,38 +319,10 @@ char *spk_strlwr(char *s)
return s;
}
-char *speakup_s2i(char *start, int *dest)
-{
- int val;
- char ch = *start;
- if (ch == '-' || ch == '+')
- start++;
- if (*start < '0' || *start > '9')
- return start;
- val = (*start) - '0';
- start++;
- while (*start >= '0' && *start <= '9') {
- val *= 10;
- val += (*start) - '0';
- start++;
- }
- if (ch == '-')
- *dest = -val;
- else
- *dest = val;
- return start;
-}
-
char *spk_s2uchar(char *start, char *dest)
{
int val = 0;
- while (*start && *start <= SPACE)
- start++;
- while (*start >= '0' && *start <= '9') {
- val *= 10;
- val += (*start) - '0';
- start++;
- }
+ val = simple_strtoul(skip_spaces(start), &start, 10);
if (*start == ',')
start++;
*dest = (u_char)val;