From patchwork Tue Jul 27 12:32:49 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 3914 Return-path: Envelope-to: mchehab@infradead.org Delivery-date: Tue, 27 Jul 2010 12:33:42 +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:22 -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 1OdjLp-00046t-Jn; Tue, 27 Jul 2010 12:33:42 +0000 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752253Ab0G0Mdi (ORCPT + 1 other); Tue, 27 Jul 2010 08:33:38 -0400 Received: from mail-fx0-f46.google.com ([209.85.161.46]:43216 "EHLO mail-fx0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751811Ab0G0Mdh (ORCPT ); Tue, 27 Jul 2010 08:33:37 -0400 Received: by fxm14 with SMTP id 14so580986fxm.19 for ; Tue, 27 Jul 2010 05:33:36 -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; bh=i1CQbIJDSRt1deKxqGW0TGHoo3uHFaeLAnMuLgk1Nlo=; b=CmRz9KCwq2NJO8Worufgr5QPMeBPiXNgLNuvSmfKcVQU8LP6diwxfy0erFijs8CZBu QjdI3dzY3xtEek+FSWgbISTmKXB/W8HZ5kYBUrU9Wh5E2M04jBmvhbOIvtN1C2jEp9pl FQHEvJdZS0PpSZShp/7rtHDhwKPkjZQ025ivE= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer; b=jrxyJz7Hs3/Lf0byvEdwZyN6V4/Im+LALjI2yLL3bzOveEvQuUSEEHkvepuMeVamtl 1jMhAR1nIC4Xn+z+WIdTOPalJhLkH3ho2duseZMpMnJRqcTVWg16HwNfk3SOmUUEU+/j 2fiGq5B0MboMhkz0NT+wUNQwY/0yOFHpccnFs= Received: by 10.223.108.71 with SMTP id e7mr8016741fap.13.1280234016377; Tue, 27 Jul 2010 05:33:36 -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.35 (version=TLSv1/SSLv3 cipher=RC4-MD5); Tue, 27 Jul 2010 05:33:35 -0700 (PDT) From: Andy Shevchenko To: Mauro Carvalho Chehab , linux-media@vger.kernel.org Cc: Andy Shevchenko Subject: [PATCH 1/2] drivers: usbvideo: remove custom implementation of hex_to_bin() Date: Tue, 27 Jul 2010 15:32:49 +0300 Message-Id: X-Mailer: git-send-email 1.7.1.1 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Signed-off-by: Andy Shevchenko --- drivers/media/video/usbvideo/usbvideo.c | 12 ++++-------- 1 files changed, 4 insertions(+), 8 deletions(-) diff --git a/drivers/media/video/usbvideo/usbvideo.c b/drivers/media/video/usbvideo/usbvideo.c index 5ac37c6..f1fcf97 100644 --- a/drivers/media/video/usbvideo/usbvideo.c +++ b/drivers/media/video/usbvideo/usbvideo.c @@ -282,19 +282,15 @@ static void usbvideo_OverlayChar(struct uvd *uvd, struct usbvideo_frame *frame, }; unsigned short digit; int ix, iy; + int value; if ((uvd == NULL) || (frame == NULL)) return; - if (ch >= '0' && ch <= '9') - ch -= '0'; - else if (ch >= 'A' && ch <= 'F') - ch = 10 + (ch - 'A'); - else if (ch >= 'a' && ch <= 'f') - ch = 10 + (ch - 'a'); - else + value = hex_to_bin(ch); + if (value < 0) return; - digit = digits[ch]; + digit = digits[value]; for (iy=0; iy < 5; iy++) { for (ix=0; ix < 3; ix++) {