From patchwork Tue Jul 27 12:32:50 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 3915 Return-path: Envelope-to: mchehab@infradead.org Delivery-date: Tue, 27 Jul 2010 12:33:45 +0000 Received: from bombadil.infradead.org [18.85.46.34] by pedra with IMAP (fetchmail-6.3.17) for (single-drop); Tue, 27 Jul 2010 09:35:23 -0300 (BRT) Received: from vger.kernel.org ([209.132.180.67]) by bombadil.infradead.org with esmtp (Exim 4.72 #1 (Red Hat Linux)) id 1OdjLt-00048A-3F; Tue, 27 Jul 2010 12:33:45 +0000 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752677Ab0G0Mdn (ORCPT + 1 other); Tue, 27 Jul 2010 08:33:43 -0400 Received: from mail-fx0-f46.google.com ([209.85.161.46]:32924 "EHLO mail-fx0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752275Ab0G0Mdj (ORCPT ); Tue, 27 Jul 2010 08:33:39 -0400 Received: by fxm14 with SMTP id 14so580993fxm.19 for ; Tue, 27 Jul 2010 05:33:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:to:cc:subject:date :message-id:x-mailer:in-reply-to:references:in-reply-to:references; bh=WNsHh81Oc90nZzsvZcbRwGdSy00xVcMxw+bIFTE3RBM=; b=fhHKbZ4v5Bjjm4EjM9pZOYKwzZpVRbWCh7ufZ1kRtezC0dH/93+8/ssH97H8+lPppY RvOCOLJObgK0LGB4IEnOKZpOv8oXXz+7IW16P+HIgt8eLvotqvSx6ksFz2KHNFYLtRm3 wMWbeZ+LK/KojH09qXAcXTG9IzL0caaSoVpeo= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; b=vSzCNYhQEJDK0jfk38z95+RHw38XfeBep6vWCpp9sCt9wPtCn3+NMcDQYahmh1/SI2 ERrIpzN+8v4n3IT8rVf+/WDneyW7CO5oaDWvurIk5pgclqRW0xl/6PQ2hSxLj7qwtNmS jTFVd9wMG7/D/qkphYNvHQTUwRQK4jgIwTDfY= Received: by 10.223.109.2 with SMTP id h2mr7915083fap.95.1280234017686; Tue, 27 Jul 2010 05:33:37 -0700 (PDT) Received: from localhost.localdomain (79-134-110-189.cust.suomicom.fi [79.134.110.189]) by mx.google.com with ESMTPS id r5sm1882977faq.32.2010.07.27.05.33.36 (version=TLSv1/SSLv3 cipher=RC4-MD5); Tue, 27 Jul 2010 05:33:37 -0700 (PDT) From: Andy Shevchenko To: Mauro Carvalho Chehab , linux-media@vger.kernel.org Cc: Andy Shevchenko , Mike Isely Subject: [PATCH 2/2] media: video: pvrusb2: remove custom hex_to_bin() Date: Tue, 27 Jul 2010 15:32:50 +0300 Message-Id: <39e0be58882d4d5fd84e2b70a8fdc38bc1b4fc41.1280233873.git.andy.shevchenko@gmail.com> X-Mailer: git-send-email 1.7.1.1 In-Reply-To: References: In-Reply-To: References: Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Signed-off-by: Andy Shevchenko Cc: Mike Isely Acked-By: Mike Isely --- drivers/media/video/pvrusb2/pvrusb2-debugifc.c | 14 ++------------ 1 files changed, 2 insertions(+), 12 deletions(-) diff --git a/drivers/media/video/pvrusb2/pvrusb2-debugifc.c b/drivers/media/video/pvrusb2/pvrusb2-debugifc.c index e9b11e1..4279ebb 100644 --- a/drivers/media/video/pvrusb2/pvrusb2-debugifc.c +++ b/drivers/media/video/pvrusb2/pvrusb2-debugifc.c @@ -94,8 +94,6 @@ static int debugifc_parse_unsigned_number(const char *buf,unsigned int count, u32 *num_ptr) { u32 result = 0; - u32 val; - int ch; int radix = 10; if ((count >= 2) && (buf[0] == '0') && ((buf[1] == 'x') || (buf[1] == 'X'))) { @@ -107,17 +105,9 @@ static int debugifc_parse_unsigned_number(const char *buf,unsigned int count, } while (count--) { - ch = *buf++; - if ((ch >= '0') && (ch <= '9')) { - val = ch - '0'; - } else if ((ch >= 'a') && (ch <= 'f')) { - val = ch - 'a' + 10; - } else if ((ch >= 'A') && (ch <= 'F')) { - val = ch - 'A' + 10; - } else { + int val = hex_to_bin(*buf++); + if (val < 0 || val >= radix) return -EINVAL; - } - if (val >= radix) return -EINVAL; result *= radix; result += val; }