netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] kstrtox: convert drivers/isdn/
@ 2011-03-27 12:58 Alexey Dobriyan
  2011-03-31  4:43 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Alexey Dobriyan @ 2011-03-27 12:58 UTC (permalink / raw)
  To: t.schmidt; +Cc: netdev

Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
---

 drivers/isdn/gigaset/ev-layer.c    |   26 +++++++++-----------------
 drivers/isdn/hysdn/hysdn_proclog.c |   11 ++++-------
 2 files changed, 13 insertions(+), 24 deletions(-)

--- a/drivers/isdn/gigaset/ev-layer.c
+++ b/drivers/isdn/gigaset/ev-layer.c
@@ -390,12 +390,12 @@ static const struct zsau_resp_t {
  */
 static int cid_of_response(char *s)
 {
-	unsigned long cid;
+	int cid;
 	int rc;
 
 	if (s[-1] != ';')
 		return 0;	/* no CID separator */
-	rc = strict_strtoul(s, 10, &cid);
+	rc = kstrtoint(s, 10, &cid);
 	if (rc)
 		return 0;	/* CID not numeric */
 	if (cid < 1 || cid > 65535)
@@ -566,27 +566,19 @@ void gigaset_handle_modem_response(struct cardstate *cs)
 		case RT_ZCAU:
 			event->parameter = -1;
 			if (curarg + 1 < params) {
-				unsigned long type, value;
-
-				i = strict_strtoul(argv[curarg++], 16, &type);
-				j = strict_strtoul(argv[curarg++], 16, &value);
+				u8 type, value;
 
-				if (i == 0 && type < 256 &&
-				    j == 0 && value < 256)
+				i = kstrtou8(argv[curarg++], 16, &type);
+				j = kstrtou8(argv[curarg++], 16, &value);
+				if (i == 0 && j == 0)
 					event->parameter = (type << 8) | value;
 			} else
 				curarg = params - 1;
 			break;
 		case RT_NUMBER:
-			event->parameter = -1;
-			if (curarg < params) {
-				unsigned long res;
-				int rc;
-
-				rc = strict_strtoul(argv[curarg++], 10, &res);
-				if (rc == 0)
-					event->parameter = res;
-			}
+			if (curarg >= params ||
+			    kstrtoint(argv[curarg++], 10, &event->parameter))
+				event->parameter = -1;
 			gig_dbg(DEBUG_EVENT, "parameter==%d", event->parameter);
 			break;
 		}
--- a/drivers/isdn/hysdn/hysdn_proclog.c
+++ b/drivers/isdn/hysdn/hysdn_proclog.c
@@ -155,7 +155,6 @@ put_log_buffer(hysdn_card * card, char *cp)
 static ssize_t
 hysdn_log_write(struct file *file, const char __user *buf, size_t count, loff_t * off)
 {
-	unsigned long u = 0;
 	int rc;
 	unsigned char valbuf[128];
 	hysdn_card *card = file->private_data;
@@ -167,12 +166,10 @@ hysdn_log_write(struct file *file, const char __user *buf, size_t count, loff_t
 
 	valbuf[count] = 0;	/* terminating 0 */
 
-	rc = strict_strtoul(valbuf, 0, &u);
-
-	if (rc == 0) {
-		card->debug_flags = u;	/* remember debug flags */
-		hysdn_addlog(card, "debug set to 0x%lx", card->debug_flags);
-	}
+	rc = kstrtoul(valbuf, 0, &card->debug_flags);
+	if (rc < 0)
+		return rc;
+	hysdn_addlog(card, "debug set to 0x%lx", card->debug_flags);
 	return (count);
 }				/* hysdn_log_write */
 

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

* Re: [PATCH] kstrtox: convert drivers/isdn/
  2011-03-27 12:58 [PATCH] kstrtox: convert drivers/isdn/ Alexey Dobriyan
@ 2011-03-31  4:43 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2011-03-31  4:43 UTC (permalink / raw)
  To: adobriyan; +Cc: t.schmidt, netdev

From: Alexey Dobriyan <adobriyan@gmail.com>
Date: Sun, 27 Mar 2011 15:58:35 +0300

> Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>

Applied.

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

end of thread, other threads:[~2011-03-31  4:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-03-27 12:58 [PATCH] kstrtox: convert drivers/isdn/ Alexey Dobriyan
2011-03-31  4:43 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).