Received: by 2002:a05:7208:9594:b0:7e:5202:c8b4 with SMTP id gs20csp2497880rbb; Wed, 28 Feb 2024 03:59:33 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVKdqfjgd5nJPbNnE75iay22kIo+4JJH+kascu0HpZssCKqi5pgHh1bF5ZM7HZpbwOGHnlHeqNHaObO/MkbGVpa+02tH+qB0aGvcrliBA== X-Google-Smtp-Source: AGHT+IFBIcynpIIyualXcgy9G5OGAMD2/InbpeiXLm8A5+4Te9/tqLUqYYho6HsXo0ybNA/9olOV X-Received: by 2002:a05:6358:50cb:b0:17b:bf9f:ec22 with SMTP id m11-20020a05635850cb00b0017bbf9fec22mr5483024rwm.14.1709121573046; Wed, 28 Feb 2024 03:59:33 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709121573; cv=pass; d=google.com; s=arc-20160816; b=dHVXF/7wbuFVRU3KGATDWpWRx+M65V1m0/hrnWFnAXedlVxQQxu/xhFTfoWfpyTnFY a3udy6+2YgFj9ly2aWqVYCEFsVB8mTPIFQBRV3GmJorMtwRIh6Ye5QOXb5E2+S7pWuJX 0SahFmDkPx0lCXZxPecTd0fJsvDKA/oyr1rLdpzte+Ua9UXHiqMMef3YfU6k+w8QkopA E9gTlLpzVelFvx2qD91Cwhfo9JWv43x6nPSiKv9ldABeR8MsKWRx3CVfYJS3m56RN3kT QKM7jjoUMsb379ApnH9lcTDYzzm32Rj9EAJjpzLMcL0NrPQ0jbKLtNavSmm/y5BLrDUS BXaQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=date:message-id:user-agent:cc:to:references:in-reply-to:from :subject:content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:dkim-signature; bh=4wZzV0B8UvqcdMbuBZm6H+rkJTyru8ZZ0o4b83vzEy8=; fh=I4dcws7FZOFODLaw8vwhxo1vMy/Dp819SUExkj0CAvU=; b=S+nwYgO1281OzKASvyp/1AcTEfRaeQllGy57evmJNTVDm1DY/u2LDeaqhKQM2pfdOc uto+4KzaDZTgtKRIN66UTHJ5wOlZDLpRMx4FbT/jEpPN0CdU8BXOfIT2kz0c4Qr+YZ4v U8rCCWCxV30hfF32cgjs0vMA1Bz84Hx2EVqsVP7QUMc5/ZM7tPS5bKMkwP+7F8LuDzpA UzRV8CHqtTomzG06rqKvb10O5FHv7aIHSwpj1qHaGQuOnt3ylex1KBJ3IBhFB8fqBShr q/P/vP5hhjerSMKhgife/7aLmD/qho9hdK4vh0Y/eCCU5oxXDJhgmMDRwwO/QZadSUq9 VyQw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=c+RbXO7u; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-wireless+bounces-4187-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-wireless+bounces-4187-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id b35-20020a05620a272300b00787ef82563fsi1478460qkp.94.2024.02.28.03.59.32 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Feb 2024 03:59:33 -0800 (PST) Received-SPF: pass (google.com: domain of linux-wireless+bounces-4187-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=c+RbXO7u; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-wireless+bounces-4187-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-wireless+bounces-4187-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id C46F21C24640 for ; Wed, 28 Feb 2024 11:59:32 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 182223BBD5; Wed, 28 Feb 2024 11:54:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="c+RbXO7u" X-Original-To: linux-wireless@vger.kernel.org Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E90113BBC4 for ; Wed, 28 Feb 2024 11:54:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709121255; cv=none; b=bzSf1SDj8ZKTd/ZePWgBckcIK3ojlYQXQWEwrF3CyctdaR9wmH5RKMnz3rLHOYV6z1ODZ62mhS8avezFIiA5JBzE1nRjWLhLq6qpKn9r71WQs/dQ+HZagdVlAR+pq6rwCTUZuRn5Nmph35rBARpqlb0vAzNol3tCT1GrChM5M70= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709121255; c=relaxed/simple; bh=nqMafNlXl1HPu7b7h2D4wOn/LYFJbvKOatfRE8tIYOQ=; h=Content-Type:MIME-Version:Subject:From:In-Reply-To:References:To: Cc:Message-ID:Date; b=czrlUnu6vt4MzbFcq9JdDSnnOcULd6KLBrpoIf12j1kU4KxL2bm6IOE5hMRJY0Ux1Lr/kHElXwS2GTeH8izBw//Vl78JBaasFWwSZl14r+b2JkIx11sgxLmMh7zDAUvU3Zs3YN8dXBkNm+uxSf5ew+tJyrWSMb6SXSZ2jHNy89s= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=c+RbXO7u; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 210D5C433C7; Wed, 28 Feb 2024 11:54:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1709121254; bh=nqMafNlXl1HPu7b7h2D4wOn/LYFJbvKOatfRE8tIYOQ=; h=Subject:From:In-Reply-To:References:To:Cc:Date:From; b=c+RbXO7uaPl/MFkWqAMpm0Ae0N9i0yr9iPRslSJcxe4gvbTuGY2s0WM0M54Gxe+mZ czSuP4f/Ym4yzCmdIwgjORxTI84nbVYoLmCbVOZfkF4dNMFqirdW3oZuW3KwJdDxun 3jdZL5iyG9csKeX0w6NuU0IBWv9yy5JUU+1Bxr8gesaXW+Hy+J7udTWCugxxpdVUlX /YIzsc91tiE4FpNzMk3TQ7XiKhcmzXu301ywE1AlAJXLAwGzkax+6RU+EuM50j82OW HO2fkgab5EMPK5E3g24aKqP92ue2SQiKQxyUcl23OpKI1V1hL36OCKJ4xFrVhLcbM9 v8xEETfSfecLw== Content-Type: text/plain; charset="utf-8" Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: Re: [PATCH] bitfield: suppress "dubious: x & !y" sparse warning From: Kalle Valo In-Reply-To: <20240223100146.d243b6b1a9a1.I033828b1187c6bccf086e31400f7e933bb8373e7@changeid> References: <20240223100146.d243b6b1a9a1.I033828b1187c6bccf086e31400f7e933bb8373e7@changeid> To: Johannes Berg Cc: linux-wireless@vger.kernel.org, Felix Fietkau , Jeff Johnson , ath11k@lists.infradead.org, Johannes Berg User-Agent: pwcli/0.1.1-git (https://github.com/kvalo/pwcli/) Python/3.11.2 Message-ID: <170912125112.3868947.18107049542995601682.kvalo@kernel.org> Date: Wed, 28 Feb 2024 11:54:12 +0000 (UTC) Johannes Berg wrote: > From: Johannes Berg > > There's a somewhat common pattern of using FIELD_PREP() > even for single bits, e.g. > > cmd->info1 |= FIELD_PREP(HTT_SRNG_SETUP_CMD_INFO1_RING_FLAGS_MSI_SWAP, > !!(params.flags & HAL_SRNG_FLAGS_MSI_SWAP)); > > which might as well be written as > > if (params.flags & HAL_SRNG_FLAGS_MSI_SWAP) > cmd->info1 |= HTT_SRNG_SETUP_CMD_INFO1_RING_FLAGS_MSI_SWAP; > > (since info1 is fully initialized to start with), but in > a long chain of FIELD_PREP() this really seems fine. > > However, it triggers a sparse warning, in the check in > the macro for whether a constant value fits into the mask, > as this contains a "& (_val)". In this case, this really > is always intentional, so just suppress the warning by > adding "0+" to the expression, indicating explicitly that > this is correct. > > Signed-off-by: Johannes Berg Patch applied to wireless-next.git, thanks. 416eb60317c6 bitfield: suppress "dubious: x & !y" sparse warning -- https://patchwork.kernel.org/project/linux-wireless/patch/20240223100146.d243b6b1a9a1.I033828b1187c6bccf086e31400f7e933bb8373e7@changeid/ https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches