From patchwork Fri Mar 1 23:12:07 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Frank Schaefer X-Patchwork-Id: 17016 Received: from mail.tu-berlin.de ([130.149.7.33]) by www.linuxtv.org with esmtp (Exim 4.72) (envelope-from ) id 1UBZ78-0006j8-Vc; Sat, 02 Mar 2013 00:11:42 +0100 X-tubIT-Incoming-IP: 209.132.180.67 Received: from vger.kernel.org ([209.132.180.67]) by mail.tu-berlin.de (exim-4.75/mailfrontend-3) with esmtp id 1UBZ78-0006Wh-Dr; Sat, 02 Mar 2013 00:11:42 +0100 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751610Ab3CAXLk (ORCPT + 1 other); Fri, 1 Mar 2013 18:11:40 -0500 Received: from mail-ee0-f49.google.com ([74.125.83.49]:56109 "EHLO mail-ee0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751290Ab3CAXLj (ORCPT ); Fri, 1 Mar 2013 18:11:39 -0500 Received: by mail-ee0-f49.google.com with SMTP id d41so2701552eek.8 for ; Fri, 01 Mar 2013 15:11:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20120113; h=x-received:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references:mime-version:content-type:content-transfer-encoding; bh=9pE4kIH7HoRCFi5dyseE3PgTa+7WjBdGE168eW7Nn68=; b=J5icx6V53HqEpB7k7BP++R2dBHq5tYf4pfisaSeLHyHJMMsFiripCL9eWzsQZ4Dv67 FWHK0ZqV8nPjjoEUaXdElCLY9cLle4TThntRqz5GMEzGfiN91TqeQUPtO3BLNpVM6O7a 19V9e90Qv/pUHVKots+qiikC6TcDIg6+S6Yo6SxfTtRyHddghx58fWQdwNN7gGQyikJY S7UJjfWRVhTSjQrZz024k3RITBaSdU8ScWSNBDxhriX3yLUbsOewQEHHGL5Awis4feBA YFijErxGHWMWTqqi505ex17J0c+iTEQBYW3QHH5g6agcDhXNFNjYVr7nxJtioO3nUujK KmFw== X-Received: by 10.14.111.72 with SMTP id v48mr2708655eeg.11.1362179497846; Fri, 01 Mar 2013 15:11:37 -0800 (PST) Received: from Athlon64X2-5000.site (ip-178-201-83-213.unitymediagroup.de. [178.201.83.213]) by mx.google.com with ESMTPS id d47sm19488041eem.9.2013.03.01.15.11.36 (version=TLSv1.2 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 01 Mar 2013 15:11:37 -0800 (PST) From: =?UTF-8?q?Frank=20Sch=C3=A4fer?= To: mchehab@redhat.com Cc: linux-media@vger.kernel.org, =?UTF-8?q?Frank=20Sch=C3=A4fer?= Subject: [PATCH 03/11] em28xx-i2c: also print debug messages at debug level 1 Date: Sat, 2 Mar 2013 00:12:07 +0100 Message-Id: <1362179535-18929-4-git-send-email-fschaefer.oss@googlemail.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1362179535-18929-1-git-send-email-fschaefer.oss@googlemail.com> References: <1362179535-18929-1-git-send-email-fschaefer.oss@googlemail.com> MIME-Version: 1.0 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-PMX-Version: 5.6.1.2065439, Antispam-Engine: 2.7.2.376379, Antispam-Data: 2013.3.1.230018 X-PMX-Spam: Gauge=IIIIIIII, Probability=8%, Report=' MULTIPLE_RCPTS 0.1, HTML_00_01 0.05, HTML_00_10 0.05, BODYTEXTP_SIZE_3000_LESS 0, BODY_SIZE_2000_2999 0, BODY_SIZE_5000_LESS 0, BODY_SIZE_7000_LESS 0, CT_TEXT_PLAIN_UTF8_CAPS 0, DKIM_SIGNATURE 0, URI_ENDS_IN_HTML 0, __ANY_URI 0, __CP_URI_IN_BODY 0, __CT 0, __CTE 0, __CT_TEXT_PLAIN 0, __FRAUD_BODY_WEBMAIL 0, __FRAUD_WEBMAIL 0, __FRAUD_WEBMAIL_FROM 0, __HAS_FROM 0, __HAS_MSGID 0, __HAS_X_MAILER 0, __HAS_X_MAILING_LIST 0, __IN_REP_TO 0, __MIME_TEXT_ONLY 0, __MIME_VERSION 0, __MULTIPLE_RCPTS_CC_X2 0, __PHISH_SPEAR_STRUCTURE_1 0, __SANE_MSGID 0, __STOCK_PHRASE_7 0, __TO_MALFORMED_2 0, __TO_NO_NAME 0, __URI_NO_WWW 0, __URI_NS , __YOUTUBE_RCVD 0' The current code uses only a single debug level and all debug messages are printed for i2c_debug >= 2 only. So debug level 1 is actually the same as level 0, which is odd. Users expect debugging messages to become enabled for anything else than debug level 0. Fix it and simplify the code a bit by printing the debug messages also at debug level 1; Signed-off-by: Frank Schäfer --- drivers/media/usb/em28xx/em28xx-i2c.c | 12 ++++++------ 1 Datei geändert, 6 Zeilen hinzugefügt(+), 6 Zeilen entfernt(-) diff --git a/drivers/media/usb/em28xx/em28xx-i2c.c b/drivers/media/usb/em28xx/em28xx-i2c.c index f970c29..d765567 100644 --- a/drivers/media/usb/em28xx/em28xx-i2c.c +++ b/drivers/media/usb/em28xx/em28xx-i2c.c @@ -287,7 +287,7 @@ static int em28xx_i2c_xfer(struct i2c_adapter *i2c_adap, return 0; for (i = 0; i < num; i++) { addr = msgs[i].addr << 1; - if (i2c_debug >= 2) + if (i2c_debug) printk(KERN_DEBUG "%s at %s: %s %s addr=%02x len=%d:", dev->name, __func__ , (msgs[i].flags & I2C_M_RD) ? "read" : "write", @@ -299,7 +299,7 @@ static int em28xx_i2c_xfer(struct i2c_adapter *i2c_adap, else rc = em28xx_i2c_check_for_device(dev, addr); if (rc == -ENODEV) { - if (i2c_debug >= 2) + if (i2c_debug) printk(" no device\n"); return rc; } @@ -313,13 +313,13 @@ static int em28xx_i2c_xfer(struct i2c_adapter *i2c_adap, rc = em28xx_i2c_recv_bytes(dev, addr, msgs[i].buf, msgs[i].len); - if (i2c_debug >= 2) { + if (i2c_debug) { for (byte = 0; byte < msgs[i].len; byte++) printk(" %02x", msgs[i].buf[byte]); } } else { /* write bytes */ - if (i2c_debug >= 2) { + if (i2c_debug) { for (byte = 0; byte < msgs[i].len; byte++) printk(" %02x", msgs[i].buf[byte]); } @@ -334,11 +334,11 @@ static int em28xx_i2c_xfer(struct i2c_adapter *i2c_adap, i == num - 1); } if (rc < 0) { - if (i2c_debug >= 2) + if (i2c_debug) printk(" ERROR: %i\n", rc); return rc; } - if (i2c_debug >= 2) + if (i2c_debug) printk("\n"); }