From patchwork Thu Sep 24 10:58:09 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 1659 Return-path: Envelope-to: mchehab@infradead.org Delivery-date: Thu, 24 Sep 2009 10:59:24 +0000 Received: from bombadil.infradead.org [18.85.46.34] by pedra.chehab.org with IMAP (fetchmail-6.3.6) for (single-drop); Thu, 24 Sep 2009 08:03:15 -0300 (BRT) Received: from vger.kernel.org ([209.132.176.167]) by bombadil.infradead.org with esmtp (Exim 4.69 #1 (Red Hat Linux)) id 1Mqm2m-0008IP-Eo; Thu, 24 Sep 2009 10:59:24 +0000 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751372AbZIXK7R (ORCPT + 1 other); Thu, 24 Sep 2009 06:59:17 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751145AbZIXK7R (ORCPT ); Thu, 24 Sep 2009 06:59:17 -0400 Received: from smtp.nokia.com ([192.100.122.230]:49828 "EHLO mgw-mx03.nokia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751084AbZIXK7Q (ORCPT ); Thu, 24 Sep 2009 06:59:16 -0400 Received: from vaebh105.NOE.Nokia.com (vaebh105.europe.nokia.com [10.160.244.31]) by mgw-mx03.nokia.com (Switch-3.3.3/Switch-3.3.3) with ESMTP id n8OAwVci018263; Thu, 24 Sep 2009 13:58:58 +0300 Received: from vaebh104.NOE.Nokia.com ([10.160.244.30]) by vaebh105.NOE.Nokia.com with Microsoft SMTPSVC(6.0.3790.3959); Thu, 24 Sep 2009 13:58:18 +0300 Received: from mgw-da01.ext.nokia.com ([147.243.128.24]) by vaebh104.NOE.Nokia.com over TLS secured channel with Microsoft SMTPSVC(6.0.3790.3959); Thu, 24 Sep 2009 13:58:13 +0300 Received: from dilbert.research.nokia.com (esdhcp034223.research.nokia.com [172.21.34.223]) by mgw-da01.ext.nokia.com (Switch-3.3.3/Switch-3.3.3) with ESMTP id n8OAw5AN014614 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NO); Thu, 24 Sep 2009 13:58:06 +0300 Received: from andy by dilbert.research.nokia.com with local (Exim 4.69) (envelope-from ) id 1Mqm1a-00088e-2w; Thu, 24 Sep 2009 13:58:10 +0300 From: Andy Shevchenko To: linux-media@vger.kernel.org Cc: mchehab@redhat.com, Andy Shevchenko Subject: [PATCH 1/2] media: video: pwc: Use kernel's simple_strtol() Date: Thu, 24 Sep 2009 13:58:09 +0300 Message-Id: <1253789890-31262-1-git-send-email-andy.shevchenko@gmail.com> X-Mailer: git-send-email 1.5.6.5 X-OriginalArrivalTime: 24 Sep 2009 10:58:13.0941 (UTC) FILETIME=[E9C1E650:01CA3D05] X-Nokia-AV: Clean Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org From: Andy Shevchenko Change own implementation of pwc_atoi() by simple_strtol(x, NULL, 10). Signed-off-by: Andy Shevchenko Acked-by: Pekka Enberg --- drivers/media/video/pwc/pwc-if.c | 23 +++++++---------------- 1 files changed, 7 insertions(+), 16 deletions(-) diff --git a/drivers/media/video/pwc/pwc-if.c b/drivers/media/video/pwc/pwc-if.c index f976df4..89b620f 100644 --- a/drivers/media/video/pwc/pwc-if.c +++ b/drivers/media/video/pwc/pwc-if.c @@ -68,6 +68,7 @@ #endif #include #include +#include /* simple_strtol() */ #include "pwc.h" #include "pwc-kiara.h" @@ -1916,19 +1917,6 @@ disconnect_out: unlock_kernel(); } -/* *grunt* We have to do atoi ourselves :-( */ -static int pwc_atoi(const char *s) -{ - int k = 0; - - k = 0; - while (*s != '\0' && *s >= '0' && *s <= '9') { - k = 10 * k + (*s - '0'); - s++; - } - return k; -} - /* * Initialization code & module stuff @@ -2078,13 +2066,16 @@ static int __init usb_pwc_init(void) } else { /* No type or serial number specified, just a number. */ - device_hint[i].device_node = pwc_atoi(s); + device_hint[i].device_node = + simple_strtol(s, NULL, 10); } } else { /* There's a colon, so we have at least a type and a device node */ - device_hint[i].type = pwc_atoi(s); - device_hint[i].device_node = pwc_atoi(colon + 1); + device_hint[i].type = + simple_strtol(s, NULL, 10); + device_hint[i].device_node = + simple_strtol(colon + 1, NULL, 10); if (*dot != '\0') { /* There's a serial number as well */ int k;