Linux-Next discussions
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: "Vincent Stehlé" <vincent.stehle@laposte.net>
Cc: devel@driverdev.osuosl.org,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	linux-next@vger.kernel.org,
	Magnus Damm <damm+renesas@opensource.se>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH linux-next] staging: emxx_udc: replace strict_strtol call
Date: Sat, 28 Jun 2014 10:09:35 -0700	[thread overview]
Message-ID: <1403975375.9064.29.camel@joe-AO725> (raw)
In-Reply-To: <1403974823-23578-1-git-send-email-vincent.stehle@laposte.net>

On Sat, 2014-06-28 at 19:00 +0200, Vincent Stehlé wrote:
> Commit 582e9d37a9a3 'include/linux: remove strict_strto* definitions' has
> obsoleted the strict_strtol function. Use kstrtol instead.
[]
> diff --git a/drivers/staging/emxx_udc/emxx_udc.c b/drivers/staging/emxx_udc/emxx_udc.c
[]
> @@ -3285,7 +3285,7 @@ static void __init nbu2ss_drv_set_ep_info(
>  
>  		tempbuf[0] = name[2];
>  		tempbuf[1] = '\0';
> -		res = strict_strtol(tempbuf, 16, &num);
> +		res = kstrtol(tempbuf, 16, &num);


The whole block if code is obtuse and should be simplified to:
---
 drivers/staging/emxx_udc/emxx_udc.c | 20 +++-----------------
 1 file changed, 3 insertions(+), 17 deletions(-)

diff --git a/drivers/staging/emxx_udc/emxx_udc.c b/drivers/staging/emxx_udc/emxx_udc.c
index c92ded8..f41831e 100644
--- a/drivers/staging/emxx_udc/emxx_udc.c
+++ b/drivers/staging/emxx_udc/emxx_udc.c
@@ -3276,24 +3276,10 @@ static void __init nbu2ss_drv_set_ep_info(
 	ep->ep.name = name;
 	ep->ep.ops = &nbu2ss_ep_ops;
 
-	if (isdigit(name[2])) {
-
-		long	num;
-		int	res;
-		char	tempbuf[2];
-
-		tempbuf[0] = name[2];
-		tempbuf[1] = '\0';
-		res = strict_strtol(tempbuf, 16, &num);
-
-		if (num == 0)
-			ep->ep.maxpacket = EP0_PACKETSIZE;
-		else
-			ep->ep.maxpacket = EP_PACKETSIZE;
-
-	} else {
+	if (name[2] == '0')
+		ep->ep.maxpacket = EP0_PACKETSIZE;
+	else
 		ep->ep.maxpacket = EP_PACKETSIZE;
-	}
 
 	list_add_tail(&ep->ep.ep_list, &udc->gadget.ep_list);
 	INIT_LIST_HEAD(&ep->queue);

      reply	other threads:[~2014-06-28 17:09 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-28 17:00 [PATCH linux-next] staging: emxx_udc: replace strict_strtol call Vincent Stehlé
2014-06-28 17:09 ` Joe Perches [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1403975375.9064.29.camel@joe-AO725 \
    --to=joe@perches.com \
    --cc=damm+renesas@opensource.se \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-next@vger.kernel.org \
    --cc=vincent.stehle@laposte.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox