Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp721192img; Fri, 22 Mar 2019 07:15:18 -0700 (PDT) X-Google-Smtp-Source: APXvYqy4TpinXveqPomho0h9aDYN0ueh8tHs9TKJOg/XTmYEeEIYtDCCQvhTZPwf0oJTev+0kelt X-Received: by 2002:a65:625a:: with SMTP id q26mr9178476pgv.61.1553264118343; Fri, 22 Mar 2019 07:15:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553264118; cv=none; d=google.com; s=arc-20160816; b=fI0yf+6/1x0z2Tcn+mjeJrJWzSdX+OPyav2D+w0sIl6xvhWqHYglPJTG0fTxgws1gq NyN579D51pwha3BTRfDSTECMYOdSu58chjXe10kq4yLaAsT9fqWh10zZnfSByqnRyppI 3wVZXK+Lxm/DwHMTcW1tfcHk1mr5ii+m/uyxuB5/QOOch6dACcG23a9hOUejKhvo+VJy +EbPUSX3rVHufeDhhSUNjTETYh2NiLK7badaDQg0zU6Hj46uO24Npt6YU0SeUac+3FNs LP2+RW+jdXMVkH33BXxC4XbRxEq5x5kXiJXrAsX1chk9qh1b9K4U39/3k5zV+TJRPygD wg6Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=pyh8vTTyohuChTUCwCbUo+zep28Eqjn+MIdM/zUjGMM=; b=DslywAbuYgXo0AQS6oPqa1SEkbfiqSgWm3s0Z2J9MiszhqBMsfb++l3Z9yjPVhwdXp uXBpwq//fT47q3lhY1i31ja3rmZDt70NRUQv5ykGVc7UuTzN7pANf8vbDABrr9XzA+Yq iLoDe42elQcyugHlklzphTAhdIysYMQza3SNKJ2qq0bkrgKdj89n3uMI4KI2v+pjl+OO Hihyhk3zo8KkKA6hJmGh9gHmQT6D2WN4fyTGI3l7C+DC4ml76foBNUNtjS5IG3wZ8uWP NbKkOmMuMhrm9m6Zsw3QvkzVPPGSMLQON6U6VhYWGxbUCmRW6s4kK1NK2tMbt8C6eu9l IZIA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=GpwSX9sP; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-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 v18si6498257pfm.241.2019.03.22.07.15.03; Fri, 22 Mar 2019 07:15:18 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-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=GpwSX9sP; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-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 S1728144AbfCVONF (ORCPT + 99 others); Fri, 22 Mar 2019 10:13:05 -0400 Received: from mail-wr1-f67.google.com ([209.85.221.67]:34471 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727746AbfCVONE (ORCPT ); Fri, 22 Mar 2019 10:13:04 -0400 Received: by mail-wr1-f67.google.com with SMTP id p10so2559428wrq.1 for ; Fri, 22 Mar 2019 07:13:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=pyh8vTTyohuChTUCwCbUo+zep28Eqjn+MIdM/zUjGMM=; b=GpwSX9sP+gNxrrwDGevhFnH156BVULnPdMflC4EtA2nV5lH09Tj9ZNxZfRoZPonkkk EZYp9DTPfimc62wMxnLuYxS/1wRf6cgCWrpp6d2XWUYKRjZKBVrMef1zmIwZQITWGpdu 2pzENXU7WyIAu3mT4EIk4vaUGZfffzBs9CkyJ8RvEBBKRwthR607UR1a9dBaok1bwXPy nC6+h5AyM9NkpksPsthgutWR7BYgD3F8CFnCXA0y6NL5fbhbnxQxcgqOeSVja29p7OfG 85UWRqiC9taTqaSglL+sJL8+7K1c7lqmuT1FmHe43dNts2yP95v0oWQEmvNaM38fRYYj 6u+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to:user-agent; bh=pyh8vTTyohuChTUCwCbUo+zep28Eqjn+MIdM/zUjGMM=; b=ZQSXBu/GZal2lHSalNeYng7Au3B5kceuWhPbSTVrmMtSwAZyB0DzM6URUt8c7GoLIU +Q0XwldWrYSuMjEnYKnn8XS6fDLYgpNsN4kXtBAgIew076Nz+S+hlS0bV/LjaG+2ruwH puYUrj0mnAB23o6JgE4Ts++jUzEy+itTZw19lMNU4j9CH8tnoBNEyXdc1nKzpfJh3DhO jZbIWukjjC8BuEttFEajWSNipu958hUmsMDHH1DMNhZTLUT6hOJHfsgIJuNlWhc8x/PX 4+pFcCEB1tUzmXPEs4BH+ID66Ozy4IPHqSOMwBS8hYaxvjQuQsXkBpxHduHCwrppJAsW YpZQ== X-Gm-Message-State: APjAAAX/jtVghx8sOv54+ajKxR3bzPrfCANhKld9fHKwZ40Cyireg/DN BsW4CjjDr9yV4JtZiqbaJ3flsw== X-Received: by 2002:adf:f451:: with SMTP id f17mr2603032wrp.272.1553263983118; Fri, 22 Mar 2019 07:13:03 -0700 (PDT) Received: from holly.lan (cpc141214-aztw34-2-0-cust773.18-1.cable.virginm.net. [86.9.19.6]) by smtp.gmail.com with ESMTPSA id x18sm520275wrw.14.2019.03.22.07.13.02 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 22 Mar 2019 07:13:02 -0700 (PDT) Date: Fri, 22 Mar 2019 14:13:00 +0000 From: Daniel Thompson To: Christophe Leroy Cc: Joe Perches , Herbert Xu , "David S. Miller" , linux-crypto@vger.kernel.org, LKML Subject: Re: [possible PATCH] crypto: sahara - Use #ifdef DEBUG not IS_ENABLED(DEBUG) Message-ID: <20190322141300.foza2h2lx5aklchq@holly.lan> References: <5ef0cab4dee128058a43f43c723c13924662e80d.camel@perches.com> <4ea24643-5832-981f-3d39-9a84692be6e7@c-s.fr> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <4ea24643-5832-981f-3d39-9a84692be6e7@c-s.fr> User-Agent: NeoMutt/20180716 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Mar 22, 2019 at 01:54:47PM +0100, Christophe Leroy wrote: > > > Le 08/03/2019 ? 01:15, Joe Perches a ?crit?: > > Normal use of IS_ENABLED is with a CONFIG_ and > > there is no -DDEBUG in the Makefile here. > > > > Replace the IS_ENABLED(DEBUG) with #ifdef DEBUG/#endif > > blocks. > > By doing this you hide a big part of the code which cannot be verified > unless DEBUG is defined. The dump functions already use dev_dbg() throughout and appear not to have any side effects (only local variables are modified). Can we not simply *remove* the if(IS_ENABLED_DEBUG) and rely on dev_dbg() to hide things from the code generater when the debug messages are disabled? Or put another way, is there any harm in allowing a system that enables CONFIG_DYNAMIC_DEBUG to observe the status dumps? Daniel. > static bool is_debug_enabled(void) > { > #ifdef DEBUG > return true; > #else > return false; > #endif > } > > then replace > > if (IS_ENABLED(DEBUG)) > > by > > if (is_debug_enabled()) > > Christophe > > > > > Miscellanea: > > > > o Move the sahara_state array into the function that uses it. > > > > Signed-off-by: Joe Perches > > --- > > drivers/crypto/sahara.c | 20 +++++++++----------- > > 1 file changed, 9 insertions(+), 11 deletions(-) > > > > diff --git a/drivers/crypto/sahara.c b/drivers/crypto/sahara.c > > index 8c32a3059b4a..d2b4bd483507 100644 > > --- a/drivers/crypto/sahara.c > > +++ b/drivers/crypto/sahara.c > > @@ -348,14 +348,13 @@ static void sahara_decode_error(struct sahara_dev *dev, unsigned int error) > > dev_err(dev->device, "\n"); > > } > > -static const char *sahara_state[4] = { "Idle", "Busy", "Error", "HW Fault" }; > > - > > static void sahara_decode_status(struct sahara_dev *dev, unsigned int status) > > { > > +#ifdef DEBUG > > u8 state; > > - > > - if (!IS_ENABLED(DEBUG)) > > - return; > > + static const char *sahara_state[4] = { > > + "Idle", "Busy", "Error", "HW Fault" > > + }; > > state = SAHARA_STATUS_GET_STATE(status); > > @@ -400,15 +399,14 @@ static void sahara_decode_status(struct sahara_dev *dev, unsigned int status) > > sahara_read(dev, SAHARA_REG_CDAR)); > > dev_dbg(dev->device, "Initial DAR: 0x%08x\n\n", > > sahara_read(dev, SAHARA_REG_IDAR)); > > +#endif > > } > > static void sahara_dump_descriptors(struct sahara_dev *dev) > > { > > +#ifdef DEBUG > > int i; > > - if (!IS_ENABLED(DEBUG)) > > - return; > > - > > for (i = 0; i < SAHARA_MAX_HW_DESC; i++) { > > dev_dbg(dev->device, "Descriptor (%d) (%pad):\n", > > i, &dev->hw_phys_desc[i]); > > @@ -421,15 +419,14 @@ static void sahara_dump_descriptors(struct sahara_dev *dev) > > dev->hw_desc[i]->next); > > } > > dev_dbg(dev->device, "\n"); > > +#endif > > } > > static void sahara_dump_links(struct sahara_dev *dev) > > { > > +#ifdef DEBUG > > int i; > > - if (!IS_ENABLED(DEBUG)) > > - return; > > - > > for (i = 0; i < SAHARA_MAX_HW_LINK; i++) { > > dev_dbg(dev->device, "Link (%d) (%pad):\n", > > i, &dev->hw_phys_link[i]); > > @@ -439,6 +436,7 @@ static void sahara_dump_links(struct sahara_dev *dev) > > dev->hw_link[i]->next); > > } > > dev_dbg(dev->device, "\n"); > > +#endif > > } > > static int sahara_hw_descriptor_create(struct sahara_dev *dev) > >