Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp719268pxb; Tue, 2 Feb 2021 16:36:44 -0800 (PST) X-Google-Smtp-Source: ABdhPJwS3Au9pngVODGYaTvWKByYqeT63siyp/K/Qsr6sIMfJtgGQcOoRfItBf7RWs36/JEExKKI X-Received: by 2002:a17:906:c09:: with SMTP id s9mr547701ejf.539.1612312604072; Tue, 02 Feb 2021 16:36:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612312604; cv=none; d=google.com; s=arc-20160816; b=O3CU1gaNwcMSPz4ZvJ4/yVYhlzD6ftzGu5KNlhwRSbZ/hOqmeRq8rB/HUys5bxJKp1 tKx3LghDi3wEdpCqSUEEAnaQb2jBSfQKCqelLRubjdMisKKokpAXwnWlrIvG312Sy9o7 NkVWd2bYhy4ORNguBL5cQwgGKvOIcgOrE/TjmTd4PFMECRBDt4MC137ShreHwOLANTDt pwYwLkZTTJlVvOwDTfNW9Sju6fWqKwKEXu3sZhbD0XvXD4MGVnJPplQDXkecnSIvbazW X0REeK+mANVlulQedN4cH5/6XJgIFuhiyvmdraemCmx2eWSJmNbpUhkBF0VTNbfeza99 SouQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=NF1HLRWXYuenoK18bwRhukljyPKdg9K5mCLeCWBVL+Q=; b=ewVHuwjEhhrhq3ASAXPg9sRdNd7xsss790jhNOtOAO78mzj53auiBnfTJY1V4GQz5n HESZr2opJqegs4lBlP4jzfIZWb1AxotWQ04P2kCvJqt71OJ+DiwwT3vlnqKvdAreExBn 8rqVdbz9EYP+Xd9Sw9DhINGIL4RDd9LLx2HQFZghglYaBeMk01AQbFE4Kd2GhK4rXUJU nQRs5Fqd5EXFa6sOVo3zUlcpG+wsBgGonBW6cfxTvl4HSjxYwCdj7LlzBFS6k1Je2CNn ZGeRjijeJ2xY7rhnn16GvQg2WpmF3tqs5E2HPeLLLS3zQTUNLxFVCAxdLEuP5Xf8u69w rO1w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Lk2zrgPy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id hb21si262091ejb.278.2021.02.02.16.36.19; Tue, 02 Feb 2021 16:36:44 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Lk2zrgPy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238204AbhBBSOT (ORCPT + 99 others); Tue, 2 Feb 2021 13:14:19 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:45239 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238298AbhBBSML (ORCPT ); Tue, 2 Feb 2021 13:12:11 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1612289445; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=NF1HLRWXYuenoK18bwRhukljyPKdg9K5mCLeCWBVL+Q=; b=Lk2zrgPyA4rQhf7ZE5QWSgjsKCnKB46/Ggecf0bW0Xvre6mTfNrZKNW7RMYdu+hxP5hAQi 5sl9bXp6EVHg1/+0jhAIAd5/8SUOag38+hE6hBP4JQfgXauDuUavo/0eAvhDhKFgHdmnGG PTbmXAiSNGmD5Yjjy9a2xZZETXvFk0k= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-587-6GlwiiBvNyG6VLBZaVSUBw-1; Tue, 02 Feb 2021 13:10:41 -0500 X-MC-Unique: 6GlwiiBvNyG6VLBZaVSUBw-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id D0470803F43; Tue, 2 Feb 2021 18:10:39 +0000 (UTC) Received: from localhost (unknown [10.18.25.174]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7E5DA50EDE; Tue, 2 Feb 2021 18:10:36 +0000 (UTC) Date: Tue, 2 Feb 2021 13:10:35 -0500 From: Mike Snitzer To: Ahmad Fatoum Cc: Alasdair Kergon , dm-devel@redhat.com, kernel@pengutronix.de, Arnd Bergmann , Dmitry Baryshkov , linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/2] dm crypt: replaced #if defined with IS_ENABLED Message-ID: <20210202181035.GA14886@redhat.com> References: <20210122084321.24012-1-a.fatoum@pengutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210122084321.24012-1-a.fatoum@pengutronix.de> User-Agent: Mutt/1.5.21 (2010-09-15) X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jan 22 2021 at 3:43am -0500, Ahmad Fatoum wrote: > IS_ENABLED(CONFIG_ENCRYPTED_KEYS) is true whether the option is built-in > or a module, so use it instead of #if defined checking for each > separately. > > The other #if was to avoid a static function defined, but unused > warning. As we now always build the callsite when the function > is defined, we can remove that first #if guard. > > Suggested-by: Arnd Bergmann > Signed-off-by: Ahmad Fatoum > --- > Cc: Dmitry Baryshkov > --- > drivers/md/dm-crypt.c | 7 ++----- > 1 file changed, 2 insertions(+), 5 deletions(-) > > diff --git a/drivers/md/dm-crypt.c b/drivers/md/dm-crypt.c > index 8c874710f0bc..7eeb9248eda5 100644 > --- a/drivers/md/dm-crypt.c > +++ b/drivers/md/dm-crypt.c > @@ -2436,7 +2436,6 @@ static int set_key_user(struct crypt_config *cc, struct key *key) > return 0; > } > > -#if defined(CONFIG_ENCRYPTED_KEYS) || defined(CONFIG_ENCRYPTED_KEYS_MODULE) > static int set_key_encrypted(struct crypt_config *cc, struct key *key) > { > const struct encrypted_key_payload *ekp; > @@ -2452,7 +2451,6 @@ static int set_key_encrypted(struct crypt_config *cc, struct key *key) > > return 0; > } > -#endif /* CONFIG_ENCRYPTED_KEYS */ > > static int crypt_set_keyring_key(struct crypt_config *cc, const char *key_string) > { > @@ -2482,11 +2480,10 @@ static int crypt_set_keyring_key(struct crypt_config *cc, const char *key_string > } else if (!strncmp(key_string, "user:", key_desc - key_string + 1)) { > type = &key_type_user; > set_key = set_key_user; > -#if defined(CONFIG_ENCRYPTED_KEYS) || defined(CONFIG_ENCRYPTED_KEYS_MODULE) > - } else if (!strncmp(key_string, "encrypted:", key_desc - key_string + 1)) { > + } else if (IS_ENABLED(CONFIG_ENCRYPTED_KEYS) && > + !strncmp(key_string, "encrypted:", key_desc - key_string + 1)) { > type = &key_type_encrypted; > set_key = set_key_encrypted; > -#endif > } else { > return -EINVAL; > } > -- > 2.30.0 > I could be mistaken but the point of the previous way used to enable this code was to not compile the code at all. How you have it, the branch just isn't taken but the compiled code is left to bloat dm-crypt. Why not leave this as is and follow same pattern in your next patch? Mike