All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] staging: speakup: replace simple_strtoul with kstrtoul
@ 2014-12-17 11:56 samuel kihahu
  2014-12-17 12:11 ` Dan Carpenter
  0 siblings, 1 reply; 21+ messages in thread
From: samuel kihahu @ 2014-12-17 11:56 UTC (permalink / raw)
  To: gregkh; +Cc: speakup, devel, linux-kernel, samuel kihahu

Replacing obsolete simple_strtoul with kstrtoul.

Signed-off-by: samuel kihahu <skihahu@gmail.com>
---
 drivers/staging/speakup/varhandlers.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/speakup/varhandlers.c b/drivers/staging/speakup/varhandlers.c
index d758284..b526c8e 100644
--- a/drivers/staging/speakup/varhandlers.c
+++ b/drivers/staging/speakup/varhandlers.c
@@ -323,7 +323,7 @@ char *spk_s2uchar(char *start, char *dest)
 {
 	int val = 0;
 
-	val = simple_strtoul(skip_spaces(start), &start, 10);
+	val = kstrtoul(skip_spaces(start), &start, 10);
 	if (*start == ',')
 		start++;
 	*dest = (u_char)val;
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 21+ messages in thread
* [PATCH] staging: speakup: Replace simple_strtoul with kstrtoul
@ 2016-02-22 12:18 Amitoj Kaur Chawla
  0 siblings, 0 replies; 21+ messages in thread
From: Amitoj Kaur Chawla @ 2016-02-22 12:18 UTC (permalink / raw)
  To: outreachy-kernel

Replace obsolete simple_strtoul with kstrtoul.
The Coccinelle semantic patch used to make this change is as follows:

// <smpl>
@@
unsigned long l;
expression e,f,g;
@@
- l = simple_strtoul(e, &f, g)
+ kstrtoul(e, g, &l)
// </smpl>

Additionally, since kstrtoul returns 0 on success and an error code on
failure introduced `err` variable to store and return the error code.
This change was made by hand.

Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com>
---
 drivers/staging/speakup/kobjects.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/speakup/kobjects.c b/drivers/staging/speakup/kobjects.c
index fdfeb42..f626084 100644
--- a/drivers/staging/speakup/kobjects.c
+++ b/drivers/staging/speakup/kobjects.c
@@ -125,7 +125,7 @@ static ssize_t chars_chartab_store(struct kobject *kobj,
 	int reset = 0;
 	int do_characters = !strcmp(attr->attr.name, "characters");
 	size_t desc_length = 0;
-	int i;
+	int i, err;
 
 	spin_lock_irqsave(&speakup_info.spinlock, flags);
 	while (cp < end) {
@@ -153,7 +153,9 @@ static ssize_t chars_chartab_store(struct kobject *kobj,
 			continue;
 		}
 
-		index = simple_strtoul(cp, &temp, 10);
+		err = kstrtoul(cp, 10, &index);
+		if (err)
+			return err;
 		if (index > 255) {
 			rejected++;
 			cp = linefeed + 1;
@@ -757,6 +759,7 @@ static ssize_t message_store_helper(const char *buf, size_t count,
 	enum msg_index_t firstmessage = group->start;
 	enum msg_index_t lastmessage = group->end;
 	enum msg_index_t curmessage;
+	int err;
 
 	while (cp < end) {
 
@@ -783,7 +786,9 @@ static ssize_t message_store_helper(const char *buf, size_t count,
 			continue;
 		}
 
-		index = simple_strtoul(cp, &temp, 10);
+		err = kstrtoul(cp, 10, &index);
+		if (err)
+			return err;
 
 		while ((temp < linefeed) && (*temp == ' ' || *temp == '\t'))
 			temp++;
-- 
1.9.1



^ permalink raw reply related	[flat|nested] 21+ messages in thread
* [PATCH] Staging: speakup: Replace simple_strtoul with kstrtoul
@ 2016-10-11  6:18 Mihaela Muraru
  2016-10-11  6:47 ` Greg Kroah-Hartman
  0 siblings, 1 reply; 21+ messages in thread
From: Mihaela Muraru @ 2016-10-11  6:18 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: outreachy-kernel

This patch fixes up a checkpatch.pl warning :
WARNING: simple_strtoul is obsolete, use kstrtoul instead.

Signed-off-by: Mihaela Muraru <mihaela.muraru21@gmail.com>
---
 drivers/staging/speakup/kobjects.c | 5 ++++-
 drivers/staging/speakup/main.c     | 5 ++++-
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/speakup/kobjects.c b/drivers/staging/speakup/kobjects.c
index e744aa9..6466a09 100644
--- a/drivers/staging/speakup/kobjects.c
+++ b/drivers/staging/speakup/kobjects.c
@@ -757,6 +757,7 @@ static ssize_t message_store_helper(const char *buf, size_t count,
 	int used = 0;
 	int rejected = 0;
 	int reset = 0;
+	int ret;
 	enum msg_index_t firstmessage = group->start;
 	enum msg_index_t lastmessage = group->end;
 	enum msg_index_t curmessage;
@@ -786,7 +787,9 @@ static ssize_t message_store_helper(const char *buf, size_t count,
 			continue;
 		}
 
-		index = simple_strtoul(cp, &temp, 10);
+		ret = kstrtoul(cp, 10, &index);
+		if (ret < 0)
+			return ret;
 
 		while ((temp < linefeed) && (*temp == ' ' || *temp == '\t'))
 			temp++;
diff --git a/drivers/staging/speakup/main.c b/drivers/staging/speakup/main.c
index 97ca4ec..6064fef 100644
--- a/drivers/staging/speakup/main.c
+++ b/drivers/staging/speakup/main.c
@@ -1906,6 +1906,7 @@ static int handle_goto(struct vc_data *vc, u_char type, u_char ch, u_short key)
 {
 	static u_char goto_buf[8];
 	static int num;
+	int ret;
 	int maxlen;
 	char *cp;
 
@@ -1944,7 +1945,9 @@ oops:
 		return 1;
 	}
 
-	goto_pos = simple_strtoul(goto_buf, &cp, 10);
+	ret = kstrtoul(goto_buf, 10, &goto_pos);
+	if (ret < 0)
+		return ret;
 
 	if (*cp == 'x') {
 		if (*goto_buf < '0')
-- 
2.7.4



^ permalink raw reply related	[flat|nested] 21+ messages in thread
* [PATCH] staging: speakup: Replace simple_strtoul with kstrtoul
@ 2018-03-08 19:27 Nishka Dasgupta
  2018-03-08 19:21 ` Nishka Dasgupta
  0 siblings, 1 reply; 21+ messages in thread
From: Nishka Dasgupta @ 2018-03-08 19:27 UTC (permalink / raw)
  To: gregkh, w.d.hubbs, chris, kirk, samuel.thibault, outreachy-kernel
  Cc: Nishka Dasgupta

Replace simple_strtoul with kstrtoul. Issue found with checkpatch.

Signed-off-by: Nishka Dasgupta <nishka.dasgupta_ug18@ashoka.edu.in>
---
 drivers/staging/speakup/kobjects.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/speakup/kobjects.c b/drivers/staging/speakup/kobjects.c
index bd7cfab..836e1b7 100644
--- a/drivers/staging/speakup/kobjects.c
+++ b/drivers/staging/speakup/kobjects.c
@@ -756,6 +756,7 @@ static ssize_t message_store_helper(const char *buf, size_t count,
 	ssize_t retval = count;
 	size_t desc_length = 0;
 	unsigned long index = 0;
+	unsigned long val = 0;
 	int received = 0;
 	int used = 0;
 	int rejected = 0;
@@ -788,7 +789,7 @@ static ssize_t message_store_helper(const char *buf, size_t count,
 			continue;
 		}
 
-		index = simple_strtoul(cp, &temp, 10);
+		index = kstrtoul(cp, 10, &val);
 
 		while ((temp < linefeed) && (*temp == ' ' || *temp == '\t'))
 			temp++;
-- 
1.9.1



^ permalink raw reply related	[flat|nested] 21+ messages in thread
* [PATCH] staging: speakup: Replace simple_strtoul with kstrtoul
@ 2018-03-08 19:43 Nishka Dasgupta
  2018-03-08 19:45 ` Samuel Thibault
  0 siblings, 1 reply; 21+ messages in thread
From: Nishka Dasgupta @ 2018-03-08 19:43 UTC (permalink / raw)
  To: gregkh, w.d.hubbs, chris, kirk, samuel.thibault, outreachy-kernel
  Cc: Nishka Dasgupta

Replace simple_strtoul with kstrtoul. Issue found with checkpatch.

Signed-off-by: Nishka Dasgupta <nishka.dasgupta_ug18@ashoka.edu.in>
---
 drivers/staging/speakup/main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/speakup/main.c b/drivers/staging/speakup/main.c
index af30b70..9db7160 100644
--- a/drivers/staging/speakup/main.c
+++ b/drivers/staging/speakup/main.c
@@ -1973,7 +1973,7 @@ static int handle_goto(struct vc_data *vc, u_char type, u_char ch, u_short key)
 		return 1;
 	}
 
-	goto_pos = simple_strtoul(goto_buf, &cp, 10);
+	kstrtoul(goto_buf, 10, &goto_pos);
 
 	if (*cp == 'x') {
 		if (*goto_buf < '0')
-- 
1.9.1



^ permalink raw reply related	[flat|nested] 21+ messages in thread
* [PATCH] staging: speakup: Replace simple_strtoul with kstrtoul
@ 2018-03-08 19:49 Nishka Dasgupta
  2018-03-08 19:53 ` Samuel Thibault
  0 siblings, 1 reply; 21+ messages in thread
From: Nishka Dasgupta @ 2018-03-08 19:49 UTC (permalink / raw)
  To: gregkh, w.d.hubbs, chris, kirk, samuel.thibault, outreachy-kernel
  Cc: Nishka Dasgupta

Replace simple_strtoul with kstrtoul. Issue found with checkpatch.

Signed-off-by: Nishka Dasgupta <nishka.dasgupta_ug18@ashoka.edu.in>
---
 drivers/staging/speakup/varhandlers.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/speakup/varhandlers.c b/drivers/staging/speakup/varhandlers.c
index 3214055..e27bd5c 100644
--- a/drivers/staging/speakup/varhandlers.c
+++ b/drivers/staging/speakup/varhandlers.c
@@ -327,8 +327,9 @@ char *spk_strlwr(char *s)
 char *spk_s2uchar(char *start, char *dest)
 {
 	int val;
+	unsigned long v = 0;
 
-	val = simple_strtoul(skip_spaces(start), &start, 10);
+	val = kstrtoul(skip_spaces(start), 10, &v);
 	if (*start == ',')
 		start++;
 	*dest = (u_char)val;
-- 
1.9.1



^ permalink raw reply related	[flat|nested] 21+ messages in thread
* [PATCH] staging: speakup: Replace simple_strtoul with kstrtoul
@ 2019-02-23 19:31 Bharath Vedartham
  2019-02-23 19:37 ` Samuel Thibault
  0 siblings, 1 reply; 21+ messages in thread
From: Bharath Vedartham @ 2019-02-23 19:31 UTC (permalink / raw)
  To: w.d.hubbs
  Cc: chris, kirk, samuel.thibault, gregkh, speakup, devel,
	linux-kernel

simple_strtoul is obsolete. Change it to kstrtoul. Kernel is building
and booting successfully.

Signed-off-by: Bharath Vedartham <linux.bhar@gmail.com>
---
 drivers/staging/speakup/kobjects.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/speakup/kobjects.c b/drivers/staging/speakup/kobjects.c
index 2e36d87..ad5a2b2 100644
--- a/drivers/staging/speakup/kobjects.c
+++ b/drivers/staging/speakup/kobjects.c
@@ -787,7 +787,9 @@ static ssize_t message_store_helper(const char *buf, size_t count,
 			continue;
 		}
 
-		index = simple_strtoul(cp, &temp, 10);
+		retval = kstrtoul(cp, 0, &index);
+		if (retval)
+			return retval;
 
 		while ((temp < linefeed) && (*temp == ' ' || *temp == '\t'))
 			temp++;
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2019-02-23 20:02 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-12-17 11:56 [PATCH] staging: speakup: replace simple_strtoul with kstrtoul samuel kihahu
2014-12-17 12:11 ` Dan Carpenter
2014-12-17 13:43   ` samuel kihahu
2014-12-17 14:03     ` Dan Carpenter
2014-12-18 14:48       ` samuel kihahu
2014-12-18 21:25         ` Dan Carpenter
  -- strict thread matches above, loose matches on Subject: below --
2016-02-22 12:18 [PATCH] staging: speakup: Replace " Amitoj Kaur Chawla
2016-10-11  6:18 [PATCH] Staging: " Mihaela Muraru
2016-10-11  6:47 ` Greg Kroah-Hartman
2016-10-11  7:29   ` Muraru Mihaela
2016-10-11 19:49   ` Muraru Mihaela
2018-03-08 19:27 [PATCH] staging: " Nishka Dasgupta
2018-03-08 19:21 ` Nishka Dasgupta
2018-03-08 19:34   ` Samuel Thibault
2018-03-08 19:43 Nishka Dasgupta
2018-03-08 19:45 ` Samuel Thibault
2018-03-08 19:49 Nishka Dasgupta
2018-03-08 19:53 ` Samuel Thibault
2019-02-23 19:31 Bharath Vedartham
2019-02-23 19:37 ` Samuel Thibault
2019-02-23 20:02   ` Bharath Vedartham

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.