From patchwork Sun Mar 3 19:37:36 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Frank_Sch=C3=A4fer?= X-Patchwork-Id: 2208561 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id D58E9DF215 for ; Sun, 3 Mar 2013 19:37:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753831Ab3CCThL (ORCPT ); Sun, 3 Mar 2013 14:37:11 -0500 Received: from mail-ee0-f44.google.com ([74.125.83.44]:63657 "EHLO mail-ee0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753631Ab3CCThH (ORCPT ); Sun, 3 Mar 2013 14:37:07 -0500 Received: by mail-ee0-f44.google.com with SMTP id l10so3534756eei.3 for ; Sun, 03 Mar 2013 11:37:05 -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=f0ORFGOd5M9OxABJ0vU3Ve5jnTEeGVG1WhsM9Ptzt40VTcRshvJKFn9X6BbFM0ag0C qC89s0CI3+oO+b1SRQMINTzy0c78NyvSY6g3ank/NqJ5LzwgMG9XYRi4Te9I1moR9JVc f5rvMr5OphXzrJMMEzV76jjDKML8jiN95JS6rncO0yRAnSNiYsdiO5JNSs8QHbz/2Cx/ 7BOYl43NHNjpenSJ9H+1vDDkHUnQGw6SXcGRKo1+BYn8oiGDsgevjodv9ejbnvFtILOu 3Ecov0HIYN3odTLNG9d2MiVPryxZnRGYFd/AGTINan9VmAh0EdC9F/ogN+UW/IHHPxXz dvPg== X-Received: by 10.15.67.134 with SMTP id u6mr50382058eex.6.1362339425869; Sun, 03 Mar 2013 11:37:05 -0800 (PST) Received: from Athlon64X2-5000.site (ip-88-153-204-20.unitymediagroup.de. [88.153.204.20]) by mx.google.com with ESMTPS id d47sm28321257eem.9.2013.03.03.11.37.04 (version=TLSv1.2 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 03 Mar 2013 11:37:05 -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 v2 03/11] em28xx-i2c: also print debug messages at debug level 1 Date: Sun, 3 Mar 2013 20:37:36 +0100 Message-Id: <1362339464-3373-4-git-send-email-fschaefer.oss@googlemail.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1362339464-3373-1-git-send-email-fschaefer.oss@googlemail.com> References: <1362339464-3373-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 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"); }