Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp5114596pxb; Thu, 14 Oct 2021 19:53:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwB5yHqvodJIS5aEgveJn5rp5ZC5sFYBBPuO3d5yOZ8xmt8mm3G+cu8mGToqWpnDr2InT4o X-Received: by 2002:a65:6aa8:: with SMTP id x8mr7164493pgu.136.1634266387385; Thu, 14 Oct 2021 19:53:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634266387; cv=none; d=google.com; s=arc-20160816; b=x/6onfOrLNJx/LjBGzGjyq9yBLD1qc+CGOytmCSLMTKn5tBIQzMM3Qw7KxPdw/tZAT GNm0NPcXrDxuWNIlExGQlNflqlKXh/qJqziemmxvnQ4SWosYZotmEsGjyRrqYhx2OFqs kO6ZduYNZRpWkH6F8TsMxZXcrl9DwhpyAU1af1lawr7UlcmC44jBKhJyECXga4Fnm43B b/oPnrE4TvBLwxxS+6L/MXFpQSbjMPIQ8z9GrVi7AC4Jc/GsDG9kXuST50w/g8PpUoVy E17Ea/Pf4AAIGJ9ZwlqY8UVE933eY5A5Vekl9vxIIYrhqbztQmwckc1EiR/fAsWkAg2C dlJw== 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 :dkim-signature; bh=kQwUmmPeJ8Hce507ICCeYLH5aPrCZw/ZIJrPidgd9ZE=; b=mRs2YNeIxvOnKfT7RiumGo3lm4TuOqgIb3dyICSOTQkbHZLy77m2F2111zNelJARqJ ib+nCb1Vnx6DraUkFxDKQhjA1LGLW6uBVkS7+K4wdUFztWcXyWky2wfhGuAsBTrOjfXo bluPbMaQWvG/lxj96ddfrD+EDgF4rQhVH2LsWbU4a1zAo7cQOW6CRPZMiZ2QesC4rh/k wAH5HomNavzd1lZwI8apGPYOMLl+uH8OiH256VFZke2WdZtxrhb8+UZ0SzPpKXblgnri 3Lx96WRxSk72cbyGEZ8OY09CXzIiToGRRUI1OcA0RZ9t7BOwGic4KvE7lwnaA1AUMBaG HlMQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=HMN7qIWo; 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 m19si6406965pfk.333.2021.10.14.19.52.54; Thu, 14 Oct 2021 19:53:07 -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=HMN7qIWo; 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 S232742AbhJNVYD (ORCPT + 99 others); Thu, 14 Oct 2021 17:24:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49458 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230094AbhJNVYC (ORCPT ); Thu, 14 Oct 2021 17:24:02 -0400 Received: from mail-lf1-x12c.google.com (mail-lf1-x12c.google.com [IPv6:2a00:1450:4864:20::12c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E35E9C061570 for ; Thu, 14 Oct 2021 14:21:56 -0700 (PDT) Received: by mail-lf1-x12c.google.com with SMTP id u21so29460942lff.8 for ; Thu, 14 Oct 2021 14:21:56 -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:content-transfer-encoding; bh=kQwUmmPeJ8Hce507ICCeYLH5aPrCZw/ZIJrPidgd9ZE=; b=HMN7qIWonn2K5R4zTQ2lDey6lWwmzqJlSStqviM7qxSdzciKyT9pSF7PvGKF5nZtKe bIzc4Wim9DKWdo0s7t/S4Stw+bjX4NTSbQrEJXGloTpUc6lXYgElEKn+fmaT+mtRsmGm xGbMRdPYm9U4MsGWGEUCFlmSokKe85X36P7IgBgCqzKY4ZNddAphaTGb0qrQCavQXL1W rKbTCLqs/PIp8yRaN2vjKJ7nxoHhOh98POPoAqbsDljCp1c04VsHN4U+di73gsd3JdGJ EMi0ZmE1nolIZ2ZQmA0xOep6o/wongsjBW0ShfD0eCV2it/KczUx6S47vV01tPsfoEzY f14g== 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:content-transfer-encoding; bh=kQwUmmPeJ8Hce507ICCeYLH5aPrCZw/ZIJrPidgd9ZE=; b=1EJZw5BHlP4uKD2XXoN2tuOBl9kGSxTA7Y9S65s7uhBwBcZcPNvPzGrOefqNGTe5Fa 2tQcxpBVWj8jc32giwWc2od363o4acV1MHKYDd+q8070d19eeScOTCbvt7o5uZrh8M1G M7YVmFegZ6NY0BAK0fKPVb4j83XHc0wnIO4ES28VH6iQI2ClgJ7YlxOFXholpYxrT4rn VbdExBN2W2M6QGLz04dRBtepFoOa1lwIqZdsJJTms6Ce59NS5nV3kO3Z/xn6ZBQYYfYI YQOtPxe8ZOCLCvrO9VaPNukn6PbGjP8KayW1hQnUhZ9ERrRP3uavUMsX29FDh3XAgT9y snGA== X-Gm-Message-State: AOAM533n875lu7bvTc/r7eUxexvkeDIuPq8U7QoJC86dpFP5fNt/d4ff 4BPvx4R6/O5lh/TtyEv9PEOw4k2R/4uMSdFZHk5DSA== X-Received: by 2002:a2e:461a:: with SMTP id t26mr8609302lja.198.1634246515116; Thu, 14 Oct 2021 14:21:55 -0700 (PDT) MIME-Version: 1.0 References: <20211014211916.3550122-1-nathan@kernel.org> In-Reply-To: <20211014211916.3550122-1-nathan@kernel.org> From: Nick Desaulniers Date: Thu, 14 Oct 2021 14:21:43 -0700 Message-ID: Subject: Re: [PATCH] drm/i915: Avoid bitwise vs logical OR warning in snb_wm_latency_quirk() To: Nathan Chancellor Cc: Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, llvm@lists.linux.dev, =?UTF-8?B?RMOhdmlkIEJvbHZhbnNrw70=?= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Oct 14, 2021 at 2:19 PM Nathan Chancellor wrote= : > > A new warning in clang points out a place in this file where a bitwise > OR is being used with boolean types: > > drivers/gpu/drm/i915/intel_pm.c:3066:12: warning: use of bitwise '|' with= boolean operands [-Wbitwise-instead-of-logical] > changed =3D ilk_increase_wm_latency(dev_priv, dev_priv->wm.pri_la= tency, 12) | > ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~= ~~~~~~~~~~ > > This construct is intentional, as it allows every one of the calls to > ilk_increase_wm_latency() to occur (instead of short circuiting with > logical OR) while still caring about the result of each call. > > To make this clearer to the compiler, use the '|=3D' operator to assign > the result of each ilk_increase_wm_latency() call to changed, which > keeps the meaning of the code the same but makes it obvious that every > one of these calls is expected to happen. > > Link: https://github.com/ClangBuiltLinux/linux/issues/1473 > Reported-by: Nick Desaulniers Thanks for the patch! Suggested-by: D=C3=A1vid Bolvansk=C3=BD Reviewed-by: Nick Desaulniers > Signed-off-by: Nathan Chancellor > --- > drivers/gpu/drm/i915/intel_pm.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel= _pm.c > index f90fe39cf8ca..aaa3a0998e4c 100644 > --- a/drivers/gpu/drm/i915/intel_pm.c > +++ b/drivers/gpu/drm/i915/intel_pm.c > @@ -3050,9 +3050,9 @@ static void snb_wm_latency_quirk(struct drm_i915_pr= ivate *dev_priv) > * The BIOS provided WM memory latency values are often > * inadequate for high resolution displays. Adjust them. > */ > - changed =3D ilk_increase_wm_latency(dev_priv, dev_priv->wm.pri_la= tency, 12) | > - ilk_increase_wm_latency(dev_priv, dev_priv->wm.spr_latenc= y, 12) | > - ilk_increase_wm_latency(dev_priv, dev_priv->wm.cur_latenc= y, 12); > + changed =3D ilk_increase_wm_latency(dev_priv, dev_priv->wm.pri_la= tency, 12); > + changed |=3D ilk_increase_wm_latency(dev_priv, dev_priv->wm.spr_l= atency, 12); > + changed |=3D ilk_increase_wm_latency(dev_priv, dev_priv->wm.cur_l= atency, 12); > > if (!changed) > return; > > base-commit: d73b17465d6da0a94bc0fcc86b150e1e923e8f71 > -- > 2.33.1.637.gf443b226ca > --=20 Thanks, ~Nick Desaulniers