From patchwork Fri Feb 16 12:44:55 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 128590 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp522460ljc; Fri, 16 Feb 2018 04:45:04 -0800 (PST) X-Google-Smtp-Source: AH8x225d8yIxAa+u3irQzOEMTR1kp+eeA6+NsMp9Gtt5pqGO/Ico5YNUwedpn47ZfltHwawZ+k9y X-Received: by 10.99.120.5 with SMTP id t5mr5039613pgc.156.1518785104328; Fri, 16 Feb 2018 04:45:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518785104; cv=none; d=google.com; s=arc-20160816; b=JIIObHtyOiNanw84YqIcC/yooUJlehRbrT6aMwQTpWS6lKa06AgIxVOAyh++Py5uXC UdwmDZd9AWyOz9m70Am8Dj6oubSiCJ57CQVJm6ihN1Vyv6hHXt9N6n7FK8AX2FYFW1PZ wPqZVzm2ESakTzUdT/csl2d8jcHoyTF3MW0Oal9ux0zCPXf3XEIwXgQVF4kbXPFJwO4V LdppyGpf55uzPwzADvHWw67RfW2MzXTh94EHIbh774m6JqA7yUqRQia1CUaafRQdsEKU EJccLiqxQZ/V9Uj1wAcahWTHflM68T0MXToq9qPjCptnoMRU/W4STPpBKbtn6IblU4Si iWnw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=4hESXwwhkUN8pbGes0RY9hafmFaFCTKvKB7Muq/ytss=; b=JscTJuPoDcaXukguRu8xzQhEAfGKj4BHIpKki3g4CyiY3y0cig6NqzVTYiOW3kZNAo zEeK06QZ1tKAi6lhjUJVS2FB8ykF2ZxDL2ucgTpin2IAXA8Q4+mzUyzF+oiGEhoAoEC1 eUc7crryyJHL7fNne99V7GLshBM2kwgRu592RFUf9XugQZORWuXyo2kBN689bfGEydFl dM53k/scmQz3eYsSFuGr9Zi/VNuFVAZCBxh/8e8Vub6BGuZMitBg8qlpZpCbu8BrdNOC 5mGwUbCGjnsGavnchrhCH+IANQLSfe1lNsmghJSyDslB7UI08WmCYNAfuidYdjhxOhL8 Gerg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=kjxReFnU; spf=pass (google.com: best guess record for domain of linux-i2c-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-i2c-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t1-v6si4738331plr.558.2018.02.16.04.45.03; Fri, 16 Feb 2018 04:45:04 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-i2c-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=kjxReFnU; spf=pass (google.com: best guess record for domain of linux-i2c-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-i2c-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S967429AbeBPMpD (ORCPT + 3 others); Fri, 16 Feb 2018 07:45:03 -0500 Received: from mail-lf0-f67.google.com ([209.85.215.67]:38649 "EHLO mail-lf0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S967416AbeBPMpC (ORCPT ); Fri, 16 Feb 2018 07:45:02 -0500 Received: by mail-lf0-f67.google.com with SMTP id g72so3876204lfg.5 for ; Fri, 16 Feb 2018 04:45:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=4hESXwwhkUN8pbGes0RY9hafmFaFCTKvKB7Muq/ytss=; b=kjxReFnUq43ZoNxbWaj9RBbghNvS4XtiCWrsXxJjXPlaTi+l0RaB9vgubxtgKdfnly gs6vKigSq3A6hryngIiBsoLNlUwOXK/sQxB6CsLa/lR+X2EmCKZd3Rg0L7+ZNbW64a2o nv3VqTO0uKGAjYl0bGCgyoH9d1Coy3HxefPDM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=4hESXwwhkUN8pbGes0RY9hafmFaFCTKvKB7Muq/ytss=; b=VkTzce5UJNgNNGhzl/N0FLi/Xynb2Tv7LFoPf0BDZAOJcVVbjd7FcwCDRGlsuBnKw3 sVkoz8VBFq9ECUDeEVTwvAhwSrpYC06ZQ+k8TE+TATXgLPO7lU/OCDAt4stIJ1vgoJ+p d4o4uOU+t+AQEx/AgRUjBl71judZoYuC40sierEjfYbn10yLzc8GOTD2PoaNeaXzdVzw PnE7wUSiUnXIn4xZ1Rxv4nlMf9pgQM6dqGo2GzWm/MfrohuUuTCqhntngDF4SVpPezx9 bRPhipjkKN/Akkv9b0aPyTgek0gQfZnQH8EsEveixxk2nQ4GyJokkiuABDy6O2SWArYC 3pEg== X-Gm-Message-State: APf1xPAkRGZ9I+dZAUuDCob8EgzSh1bTW3jvwH9d4pGz+L0Wlz9PbEtP YkA8Jxh8d6srdK2qcuHIakHdfr51vZo= X-Received: by 10.46.17.211 with SMTP id 80mr3987609ljr.87.1518785100764; Fri, 16 Feb 2018 04:45:00 -0800 (PST) Received: from genomnajs.ideon.se ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id s85sm1418607lfi.93.2018.02.16.04.44.59 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 16 Feb 2018 04:44:59 -0800 (PST) From: Linus Walleij To: Wolfram Sang , linux-i2c@vger.kernel.org Cc: Linus Walleij Subject: [PATCH] i2c: algo-bit: Move debug variable Date: Fri, 16 Feb 2018 13:44:55 +0100 Message-Id: <20180216124455.20491-1-linus.walleij@linaro.org> X-Mailer: git-send-email 2.14.3 Sender: linux-i2c-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-i2c@vger.kernel.org The variable "i2c_debug" is in a real weird place. If DEBUG happens to be defined (because someone wants to do debugging) the macro bit_dbg() is already using it some lines up in the code, so compilation will fail. After this patch, it is possible to define DEBUG and then pass a debug level to the module with the i2c_debug parameter, which is probably what is intended. Signed-off-by: Linus Walleij --- drivers/i2c/algos/i2c-algo-bit.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) -- 2.14.3 diff --git a/drivers/i2c/algos/i2c-algo-bit.c b/drivers/i2c/algos/i2c-algo-bit.c index 3df0efd69ae3..47e0088ab904 100644 --- a/drivers/i2c/algos/i2c-algo-bit.c +++ b/drivers/i2c/algos/i2c-algo-bit.c @@ -29,6 +29,10 @@ /* ----- global defines ----------------------------------------------- */ #ifdef DEBUG +static int i2c_debug = 1; +module_param(i2c_debug, int, S_IRUGO | S_IWUSR); +MODULE_PARM_DESC(i2c_debug, + "debug level - 0 off; 1 normal; 2 verbose; 3 very verbose"); #define bit_dbg(level, dev, format, args...) \ do { \ if (i2c_debug >= level) \ @@ -45,13 +49,6 @@ static int bit_test; /* see if the line-setting functions work */ module_param(bit_test, int, S_IRUGO); MODULE_PARM_DESC(bit_test, "lines testing - 0 off; 1 report; 2 fail if stuck"); -#ifdef DEBUG -static int i2c_debug = 1; -module_param(i2c_debug, int, S_IRUGO | S_IWUSR); -MODULE_PARM_DESC(i2c_debug, - "debug level - 0 off; 1 normal; 2 verbose; 3 very verbose"); -#endif - /* --- setting states on the bus with the right timing: --------------- */ #define setsda(adap, val) adap->setsda(adap->data, val)