Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp840170rwd; Tue, 13 Jun 2023 00:42:47 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5Ehv1SosWJjSRoja86XCjCs+Yl8Md5e4SafNF84BhIlWNYdgrwQcgcxodn8u4LGgYOuMZC X-Received: by 2002:a17:90a:12:b0:256:797b:5039 with SMTP id 18-20020a17090a001200b00256797b5039mr10532716pja.9.1686642166655; Tue, 13 Jun 2023 00:42:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686642166; cv=none; d=google.com; s=arc-20160816; b=lDjKjNCBO8JCT3rnFa7QxtuEOkisiXBSmmFsu+8jcbiwiAOZHYCgh7mZukoRT4DUEV Wh6bEiXwhbj8eKJsSuYxkJoK4rH3VMayLXHaOP4JB0urdLi6dLoGl+ajcjYqmokD4RTh oVqwoKMfvTOP0a8CAuuA2o/tMg9rShqJnACL8chPXNYoguWpsixUgPUx+msBwsS+zwZF Z6IyNRqI9f7Xe52de6KObQighY/JiDs6vsyvinIpDHgtm6Qu72/TSKsLpd2dblt1Uhds Q4t0j1pYkNtJik9k3Zs8SOo4bNJ3urVPrRuisV9qnmKpAN1kKRToDclSKVzCc47eCWCg Hh1g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version; bh=rL3yBjhujEBk87NhlB2ovSsoCLoOMs/cXhoZ2OjmRV8=; b=uvfSF4s5Dx3J5P2NBJYgUxbwikQfGy6q8St6saixVQGkEXTxFKDUuwNivVw5qpEsC1 tUNlMbhCV7vRE408vJq33NORbBxKlKpuBvcDvWAk0wp5BhDyj9lMhZf07nMIgwfF9FKS uPVvGt0RM0QTzgLq8E0cJPVeCp3Krf/3n/YfYiUoJAwf+Sd4MtsCqAL64OAjKiapo0Mx tBdVeVlntbG0rnoDfa2zjSEVAoozF++V0hv4EvIA8y5PYqRWLABmhzCgTohnk0bx8rZB 5EIr5xxXcMlBy4hI/TeclkmVPSe9ppRtJgmL2up73oQMWf/29/MYKnyTlJzHwC7/z+3F JX/w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t23-20020a17090aba9700b00235dc16de3asi9992018pjr.16.2023.06.13.00.42.34; Tue, 13 Jun 2023 00:42:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238881AbjFMHig convert rfc822-to-8bit (ORCPT + 99 others); Tue, 13 Jun 2023 03:38:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38350 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234472AbjFMHie (ORCPT ); Tue, 13 Jun 2023 03:38:34 -0400 Received: from mail-yw1-f179.google.com (mail-yw1-f179.google.com [209.85.128.179]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6D7E3AA; Tue, 13 Jun 2023 00:38:33 -0700 (PDT) Received: by mail-yw1-f179.google.com with SMTP id 00721157ae682-56d5492850dso6764397b3.0; Tue, 13 Jun 2023 00:38:33 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686641912; x=1689233912; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=5HYSRhDPwRoW06pJwnVk/r95T6M6w1GodDXdJDLZ7hw=; b=ErTBJHcVFLs7fU0t/WS8JU/lWBKznx7RfhF6qFEZ8Mzwf/SU2w2i1gPeK9nEePwyYK 0O46g2jbCe27596CJMeQpACBJtUEZZAqKrDyCkEbC7sWHdgfM7sQXfyeFABqXAiW6vVI bn19WtZNg8YMqV62sr8OjzDogN4Nm71KrzZtCptZ2bptbWlCe6zE+j0n2nNYkEQnSlXH Ybu00AsNs6thwz97zcHDI5QyhicemJLbwQsfCQ/sJQCNmXRSjSQqHn3VYf1dDNQ0iPyB mhJCWvS2hDuSwm5mB7A5rQg2SJAj2qBMEx7LPZCvIbnnSM/BzVv0NWHzfNr+15VQn9Xi +uZg== X-Gm-Message-State: AC+VfDw8Q07fQh8YZLYGWdyJsuinzEGW1zC0KOcQRifEXz/e+SVrOLUl Stq5web72+MTSJNDtSIpwLLalouC9V7NxA== X-Received: by 2002:a25:cf8a:0:b0:ba6:b00d:b865 with SMTP id f132-20020a25cf8a000000b00ba6b00db865mr779527ybg.56.1686641912378; Tue, 13 Jun 2023 00:38:32 -0700 (PDT) Received: from mail-yb1-f181.google.com (mail-yb1-f181.google.com. [209.85.219.181]) by smtp.gmail.com with ESMTPSA id e72-20020a25e74b000000b00bc8f984984asm1258554ybh.35.2023.06.13.00.38.32 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 13 Jun 2023 00:38:32 -0700 (PDT) Received: by mail-yb1-f181.google.com with SMTP id 3f1490d57ef6-bc4e167c4b2so3115260276.3; Tue, 13 Jun 2023 00:38:32 -0700 (PDT) X-Received: by 2002:a25:4245:0:b0:ba8:1ebe:9b96 with SMTP id p66-20020a254245000000b00ba81ebe9b96mr762286yba.1.1686641911996; Tue, 13 Jun 2023 00:38:31 -0700 (PDT) MIME-Version: 1.0 References: <20230613021643.3330661-1-gongruiqi@huaweicloud.com> In-Reply-To: <20230613021643.3330661-1-gongruiqi@huaweicloud.com> From: Geert Uytterhoeven Date: Tue, 13 Jun 2023 09:38:20 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] pinctrl: renesas: remove checker warnings: x | !y To: "GONG, Ruiqi" Cc: Linus Walleij , linux-renesas-soc@vger.kernel.org, linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, gongruiqi1@huawei.com, linux-sparse@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8BIT X-Spam-Status: No, score=-1.4 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Gong, On Tue, Jun 13, 2023 at 4:13 AM GONG, Ruiqi wrote: > Eliminate the following Sparse reports when building with C=1: > > drivers/pinctrl/renesas/pinctrl-rzn1.c:187:52: warning: dubious: x | !y > drivers/pinctrl/renesas/pinctrl-rzn1.c:193:52: warning: dubious: x | !y > > Signed-off-by: GONG, Ruiqi Thanks for your patch! Looks like sparse needs to be taught the "|" is not used in a boolean context here? > --- a/drivers/pinctrl/renesas/pinctrl-rzn1.c > +++ b/drivers/pinctrl/renesas/pinctrl-rzn1.c > @@ -184,13 +184,15 @@ static void rzn1_hw_set_lock(struct rzn1_pinctrl *ipctl, u8 lock, u8 value) > * address | 1. > */ > if (lock & LOCK_LEVEL1) { > - u32 val = ipctl->lev1_protect_phys | !(value & LOCK_LEVEL1); > + u32 val = ipctl->lev1_protect_phys | > + (value & LOCK_LEVEL1 ? 0 : 1); > > writel(val, &ipctl->lev1->status_protect); > } > > if (lock & LOCK_LEVEL2) { > - u32 val = ipctl->lev2_protect_phys | !(value & LOCK_LEVEL2); > + u32 val = ipctl->lev2_protect_phys | > + (value & LOCK_LEVEL2 ? 0 : 1); > > writel(val, &ipctl->lev2->status_protect); > } Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds