Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp3346056pxb; Mon, 18 Oct 2021 13:16:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy6jbzWGMw1DTf39JIk+hz2Ts0QC3drewk9iK0rm5ZgwwUbIJObd9wXkqTI6O+Rzx1Ak5WB X-Received: by 2002:a05:6402:40d2:: with SMTP id z18mr47318832edb.362.1634588207886; Mon, 18 Oct 2021 13:16:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634588207; cv=none; d=google.com; s=arc-20160816; b=0rPdxAuOKCtDYr1IH3Mb0aUPlNY+bu754It5E9Wfys67RoX0/yLFyDD3PlOPLcia4C HiSwUibTPtMO4Xg+jgEscyVtie2F+tos1DYqkZ8jDOyQGG+wPp/yL0W1NEMq+VN64Hau uJhhF+aAHDCVF/PYFIlaAOysg0uxtMDZ/1KYpZyUYz3v76kqJvcO14kDEX4bwHPBo2l0 2NR36ZKM6/PEFCl5rF7wcV7dpjdW5DeWWyQFkeqNZGBrhTXqTcehm0SgUAegbcoCIQ56 2sDIm6XCrvsattLLODn9n9xzRA2ZtWu6TPQWGFOev7AnroHaXOhhLqVMsGillv7Zo5+4 M/8Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=Tt24hSGflNdpheMRwlJmY7tz8SqrWMFdjzVrWWc99WA=; b=Qkx00WiXa9UNH/JiFD3ILgdrYwVUvGrN8SlKVld9LKdz94o0oo8/r2/YRnJAFDsX19 CowNi2Ag2vdk4EyPebk5SmT4QyrDgDDoZ3/vnLCREiWKVb99u9bAg88GMKvfObt9obBz iVNoPzQ84HEGCuz9xD6kkCniTsdmbSG7CvhIG6OpjwMbbSWXdNk7Yd10zM3AfcXYPadr 04cL62zyp8EnJq6h9ekh74osnEcoB42mzZqLW9Zo8QRZSo07Lqsgids+noFqOEweLIBo VQAtqcDw+NQWmE9Pvvi5LzkJs/35O0trqGq+BcmzCdGkKUIUKfCeqJ/zjo2OfAcKO4aP TtTw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=ThzaXo9W; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s13si21891612eju.701.2021.10.18.13.16.22; Mon, 18 Oct 2021 13:16:47 -0700 (PDT) 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=@google.com header.s=20210112 header.b=ThzaXo9W; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229941AbhJRUQa (ORCPT + 99 others); Mon, 18 Oct 2021 16:16:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43878 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230159AbhJRUQa (ORCPT ); Mon, 18 Oct 2021 16:16:30 -0400 Received: from mail-lf1-x130.google.com (mail-lf1-x130.google.com [IPv6:2a00:1450:4864:20::130]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 44AACC061745 for ; Mon, 18 Oct 2021 13:14:18 -0700 (PDT) Received: by mail-lf1-x130.google.com with SMTP id j21so2436257lfe.0 for ; Mon, 18 Oct 2021 13:14:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=Tt24hSGflNdpheMRwlJmY7tz8SqrWMFdjzVrWWc99WA=; b=ThzaXo9WMP/Hx60CctXyI47vb2LH1UDfrYY8Ar9oaSYyIGAmOezaOvDQ/jGlcx8JQ4 0brV7of05Lpixk+xH/TLFCWzQwK7jriqQMDLPnN5ss46nsAcOoEsTOur5rdnomWefoPe az7yIStcQN012YMWrb/4FUJ49saLFmUDhyvpWcWH6Rx/LzGqfPuBlth8b7OvQYhS+Ysm Bz9I+BJUt6goyo6D8gV6hg0vC06pn2nCP16akhI5YQ8Sa9RbvGYGi3pKJdr025cIHpbc pNxNRW+eTROo3kwt8ERY1h33eLQTL70ZZI+mcC4i+IT3rm63x9tVUisYuK7cgoANHt6k CvKA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=Tt24hSGflNdpheMRwlJmY7tz8SqrWMFdjzVrWWc99WA=; b=BSbDKBSIKGHF90P77gDhCJScmeSIOMEwH7OvZH0VrDe3rgZazI5Q5ljTAfcczoTrNe qjALR99Q1wriDCposjlaN4nFfVS5HD8rYpeM249CqAnEot/mO+vjbTQS9b1r9dnLzWc+ GtWHRTjWuKEzbFxpkiwTfT+yO/m/3+oBrnHZiWY+p4NT60tfj6TI5ouvUakyWcOKwqJk DQfmOmTZIaZtriTbZQ4WwobaGhm9j9rgOBtVOR3y3CqEgFaGlcwjI2dVUuMMjxNzt4OB 170YKQzzW4sr0VW0QowyOeM/qqIrMbYSgA0Tmc59tym/sp0juz0+t3mI5AYiSW/guKu/ nUuw== X-Gm-Message-State: AOAM530pM76z/V8NAmYjBXc00ILQX4ah1YaIRS7OBV7nnNJahWnxkKQb BjVN8VnyxMZESQbv7UYac8IBFTqbkPHY7qmEcAtZ1w== X-Received: by 2002:a05:6512:3ba3:: with SMTP id g35mr1762408lfv.651.1634588056448; Mon, 18 Oct 2021 13:14:16 -0700 (PDT) MIME-Version: 1.0 References: <20211018182537.2316800-1-nathan@kernel.org> In-Reply-To: From: Nick Desaulniers Date: Mon, 18 Oct 2021 13:14:05 -0700 Message-ID: Subject: Re: [PATCH] platform/x86: thinkpad_acpi: Fix bitwise vs. logical warning To: Linus Torvalds Cc: Nathan Chancellor , Henrique de Moraes Holschuh , Hans de Goede , Mark Gross , ibm-acpi-devel@lists.sourceforge.net, platform-driver-x86@vger.kernel.org, Linux Kernel Mailing List , llvm@lists.linux.dev, Tor Vic Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Oct 18, 2021 at 12:41 PM Linus Torvalds wrote: > > On Mon, Oct 18, 2021 at 8:34 AM Nick Desaulniers > wrote: > > > > LGTM, thanks for the patch! I guess this would be the first > > "interesting" case this warning has found in kernel sources? > > The patch looks obviously correct (tm), but I'm not convinced that the > warning is actually all that interesting. > > The thing is, using bitwise operators for booleans is _exactly_ the > same as using logical ones as long as there are no side effects. Right, the patch that added the warning explicitly checks for side effects. https://reviews.llvm.org/D108003 https://lore.kernel.org/lkml/20211018193101.2340261-1-nathan@kernel.org/ is another example that I would point to in favor of the error. -- Thanks, ~Nick Desaulniers