Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp649525img; Fri, 22 Mar 2019 05:55:55 -0700 (PDT) X-Google-Smtp-Source: APXvYqwm27Lz1oY3nP5XdNg0sOx15uU8FpsQFEsn3b0dj+33RMf3bPOGmZQKSJTbm7SW9kRLAvXl X-Received: by 2002:a65:6105:: with SMTP id z5mr8886009pgu.434.1553259355298; Fri, 22 Mar 2019 05:55:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553259355; cv=none; d=google.com; s=arc-20160816; b=rTTAJc77b+njt3EWSd3uJg/vnkVkl//ERXrjCoUSkzPYHVaW8UESW1YxsC4GNmzKiA GvV414LadL2CoKnMWQcSQ+m7ZH8j8eW+KFqlSNSXWE8nUxEvI1qiAXbUiXFXFzCDEKt4 1fBgoWOVgiHswZksH8A/00NPv3uHIqkx+JkZQwJfSO/DkPz9BPJL60nBoLnvqgFy2kez v+y0y7qwWOyjyMkksjWtOezzOpUe/bF2Pfw4/DZRw8MLVLVEQM6P98/WRXaY3oi9rbtv QZZU8KkAiqt1G5yldCnmZhl9A9h2yLSuXQAnxYIJw0AqsKzuYXVp4DPYmhBG45ZobnpM nkVQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=26ZK7/CAEBxnxUnQkCvPSL1aG1SlmXekNJcGWX1XQnU=; b=f3vyciTMiVJdrst2sqISp39e9hFQvO8BJ6lqrSplOhQzEvssdwho72KIYKfjkw0P0C rAufjOSkaWZ/W2B7dSK2pOG3xgRogJk8Aiy0L2Hz7O2Pqc71057EFu8KXTLKLKsbKzE6 b20KdyD3CBk9UjiCAdTZiqjU0tgTyanYGMZA02qef/LmMo9jog9jXPcbRiNg1L/jyy3b 5uupr/97LtTiRlSY0l7jK2Ll60pMMgx3B4K26Cq5wUjPfHrfETKQxv2iITAWiQQ4Xpbv nY9UvZd+yE18ccmrMTNRp0QuwYDZ1MMtnUUXevXExMn2kghvQeOudbP5oeQWYeo/h/zO BT3w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@c-s.fr header.s=mail header.b=hIo3wzfE; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v5si917070pgr.121.2019.03.22.05.55.40; Fri, 22 Mar 2019 05:55:55 -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=@c-s.fr header.s=mail header.b=hIo3wzfE; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732943AbfCVMyy (ORCPT + 99 others); Fri, 22 Mar 2019 08:54:54 -0400 Received: from pegase1.c-s.fr ([93.17.236.30]:7606 "EHLO pegase1.c-s.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1733022AbfCVMyv (ORCPT ); Fri, 22 Mar 2019 08:54:51 -0400 Received: from localhost (mailhub1-int [192.168.12.234]) by localhost (Postfix) with ESMTP id 44QkBv5BVpz9txf3; Fri, 22 Mar 2019 13:54:47 +0100 (CET) Authentication-Results: localhost; dkim=pass reason="1024-bit key; insecure key" header.d=c-s.fr header.i=@c-s.fr header.b=hIo3wzfE; dkim-adsp=pass; dkim-atps=neutral X-Virus-Scanned: Debian amavisd-new at c-s.fr Received: from pegase1.c-s.fr ([192.168.12.234]) by localhost (pegase1.c-s.fr [192.168.12.234]) (amavisd-new, port 10024) with ESMTP id lWKAbOdjKAKz; Fri, 22 Mar 2019 13:54:47 +0100 (CET) Received: from messagerie.si.c-s.fr (messagerie.si.c-s.fr [192.168.25.192]) by pegase1.c-s.fr (Postfix) with ESMTP id 44QkBv3sgKz9txf2; Fri, 22 Mar 2019 13:54:47 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=c-s.fr; s=mail; t=1553259287; bh=26ZK7/CAEBxnxUnQkCvPSL1aG1SlmXekNJcGWX1XQnU=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=hIo3wzfE91ko+U3qR0ixhhHth22RQw+b7mbKkcrQ0ObXpo8kZCVf1UBqpplWr4VDY +bjgQIGXurFaK199LIC7MuXgF/4t2groe0tU9AiYnI5Cnp5e9it/3ClMFCXNdzV8V4 VrEp0c+AASEMBBY5svqLDw4MYgVpccscduynR+1w= Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id D46098BB11; Fri, 22 Mar 2019 13:54:48 +0100 (CET) X-Virus-Scanned: amavisd-new at c-s.fr Received: from messagerie.si.c-s.fr ([127.0.0.1]) by localhost (messagerie.si.c-s.fr [127.0.0.1]) (amavisd-new, port 10023) with ESMTP id 0KrXzgU9phTN; Fri, 22 Mar 2019 13:54:48 +0100 (CET) Received: from PO15451 (po15451.idsi0.si.c-s.fr [172.25.231.2]) by messagerie.si.c-s.fr (Postfix) with ESMTP id A8C428B848; Fri, 22 Mar 2019 13:54:48 +0100 (CET) Subject: Re: [possible PATCH] crypto: sahara - Use #ifdef DEBUG not IS_ENABLED(DEBUG) To: Joe Perches , Herbert Xu , "David S. Miller" Cc: linux-crypto@vger.kernel.org, LKML References: <5ef0cab4dee128058a43f43c723c13924662e80d.camel@perches.com> From: Christophe Leroy Message-ID: <4ea24643-5832-981f-3d39-9a84692be6e7@c-s.fr> Date: Fri, 22 Mar 2019 13:54:47 +0100 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.6.0 MIME-Version: 1.0 In-Reply-To: <5ef0cab4dee128058a43f43c723c13924662e80d.camel@perches.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: fr Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. I suggest to add the following helper: 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) >