From patchwork Thu Sep 24 10:58:10 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 1660 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:16 -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-Nu; Thu, 24 Sep 2009 10:59:24 +0000 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751591AbZIXK7T (ORCPT + 1 other); Thu, 24 Sep 2009 06:59:19 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751512AbZIXK7T (ORCPT ); Thu, 24 Sep 2009 06:59:19 -0400 Received: from smtp.nokia.com ([192.100.122.230]:49840 "EHLO mgw-mx03.nokia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751145AbZIXK7S (ORCPT ); Thu, 24 Sep 2009 06:59:18 -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 n8OAwVcm018263; Thu, 24 Sep 2009 13:59:00 +0300 Received: from esebh102.NOE.Nokia.com ([172.21.138.183]) by vaebh105.NOE.Nokia.com with Microsoft SMTPSVC(6.0.3790.3959); Thu, 24 Sep 2009 13:58:26 +0300 Received: from mgw-sa02.ext.nokia.com ([147.243.1.48]) by esebh102.NOE.Nokia.com over TLS secured channel with Microsoft SMTPSVC(6.0.3790.3959); Thu, 24 Sep 2009 13:58:25 +0300 Received: from dilbert.research.nokia.com (esdhcp034223.research.nokia.com [172.21.34.223]) by mgw-sa02.ext.nokia.com (Switch-3.3.3/Switch-3.3.3) with ESMTP id n8OAwO7T031030 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NO); Thu, 24 Sep 2009 13:58:24 +0300 Received: from andy by dilbert.research.nokia.com with local (Exim 4.69) (envelope-from ) id 1Mqm1a-00088g-5U; 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 2/2] atoi: Drop custom atoi from drivers/video/modedb.c Date: Thu, 24 Sep 2009 13:58:10 +0300 Message-Id: <1253789890-31262-2-git-send-email-andy.shevchenko@gmail.com> X-Mailer: git-send-email 1.5.6.5 In-Reply-To: <1253789890-31262-1-git-send-email-andy.shevchenko@gmail.com> References: <1253789890-31262-1-git-send-email-andy.shevchenko@gmail.com> X-OriginalArrivalTime: 24 Sep 2009 10:58:25.0526 (UTC) FILETIME=[F0A9A160: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 Kernel has simple_strtol() implementation which could be used as atoi(). Signed-off-by: Andy Shevchenko --- drivers/video/modedb.c | 24 +++++------------------- 1 files changed, 5 insertions(+), 19 deletions(-) diff --git a/drivers/video/modedb.c b/drivers/video/modedb.c index 34e4e79..0129f1b 100644 --- a/drivers/video/modedb.c +++ b/drivers/video/modedb.c @@ -13,6 +13,7 @@ #include #include +#include #undef DEBUG @@ -402,21 +403,6 @@ const struct fb_videomode vesa_modes[] = { EXPORT_SYMBOL(vesa_modes); #endif /* CONFIG_FB_MODE_HELPERS */ -static int my_atoi(const char *name) -{ - int val = 0; - - for (;; name++) { - switch (*name) { - case '0' ... '9': - val = 10*val+(*name-'0'); - break; - default: - return val; - } - } -} - /** * fb_try_mode - test a video mode * @var: frame buffer user defined part of display @@ -539,7 +525,7 @@ int fb_find_mode(struct fb_var_screeninfo *var, namelen = i; if (!refresh_specified && !bpp_specified && !yres_specified) { - refresh = my_atoi(&name[i+1]); + refresh = simple_strtol(&name[i+1], NULL, 10); refresh_specified = 1; if (cvt || rb) cvt = 0; @@ -549,7 +535,7 @@ int fb_find_mode(struct fb_var_screeninfo *var, case '-': namelen = i; if (!bpp_specified && !yres_specified) { - bpp = my_atoi(&name[i+1]); + bpp = simple_strtol(&name[i+1], NULL, 10); bpp_specified = 1; if (cvt || rb) cvt = 0; @@ -558,7 +544,7 @@ int fb_find_mode(struct fb_var_screeninfo *var, break; case 'x': if (!yres_specified) { - yres = my_atoi(&name[i+1]); + yres = simple_strtol(&name[i+1], NULL, 10); yres_specified = 1; } else goto done; @@ -586,7 +572,7 @@ int fb_find_mode(struct fb_var_screeninfo *var, } } if (i < 0 && yres_specified) { - xres = my_atoi(name); + xres = simple_strtol(name, NULL, 10); res_specified = 1; } done: